Added INIT_PRIORITY support

Added TARGET_ASM_CONSTRUCTOR and TARGET_ASM_DESTRUCTOR macros.

These macros allows users to control the order of initialization
of objects defined at namespace scope with the init_priority
attribute by specifying a relative priority, a constant integral
expression currently bounded between 101 and 65535 inclusive.

Lower numbers indicate a higher priority.
microblaze: Cannot emit swap insns if -mno-xl-reorder passed on cmd line

The content of this patch will be merged into the initial swap instruction
patch for upstream submission to gcc mainline.

Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com>
extended mcpu version formats

Earlier Microblaze used to support only mcpu version of format vX.YY.Z
Now with this patch Microblaze will accept vX.YY.Z/vXX.YY.Z/vXX.YY/vX.YY.Z mcpu formats

Signed-off-by:nagaraju <nmekala@xilix.com>
<Add lshrsi3_with_size_opt>:

With this RTL pattern microblaze will generate few instruction instead of huge number of srl instructions
When barrel shifter is not present, immediate value is greater than #5 and optimization is -OS then compiler will generate shift operation using loop.

Signed-off-by: [Nagaraju] [nmekala@xilinx.com>]
microblaze: Add 4 byte implementation for __sync_compare_and_swap atomic builtin

By providing this initial atomic implementation, gcc is able to generate the other atomic
builtins by using a __sync_compare_and_swap loop

1,2,8 byte implementations not currently supported and will still result in undefined
reference from linker

Signed-off-by: David Holsgrove <david.holsgrove@petalogix.com>
microblaze: Add __sync_lock_test_and_set 4 byte atomic builtin

Signed-off-by: David Holsgrove <david.holsgrove@petalogix.com>
microblaze: Add TARGET_ASM_OUTPUT_MI_THUNK to support varargs thunk

Without this macro, generic gcc generates a less efficient thunk
that calls function instead of jumping to it. The generic code
does not support varargs and produces an error message on compilation;

 error: generic thunk code fails for method
 'virtual void C::f(const char*, ...)' which uses '...'

Signed-off-by: David Holsgrove <david.holsgrove@petalogix.com>
microblaze: Extend jump insn to accept bri to SYMBOL_REFS

Current insn checks if operand is a REG - if so, uses br
else it bri to %l0 - using a label_ref print operand

Check if operand is a SYMBOL_REF, and if so, use %0

Signed-off-by: David Holsgrove <david.holsgrove@petalogix.com>
microblaze: Remove SECONDARY_MEMORY_NEEDED

MicroBlaze doesn't have restrictions that would force us to
reload regs via memory. Don't define SECONDARY_MEMORY_NEEDED.
Fixes an ICE when compiling OpenSSL for linux.

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
Signed-off-by: Peter A. G. Crosthwaite <peter.crosthwaite@petalogix.com>
microblaze: Add -fstack-usage support

Signed-off-by: David Holsgrove <david.holsgrove@petalogix.com>
microblaze: Add SIZE_TYPE and PTRDIFF_TYPE to microblaze.h

Fixes warnings like;

warning: format '%zX' expects argument of type 'size_t',
but argument 3 has type 'unsigned int' [-Wformat]

Signed-off-by: David Holsgrove <david.holsgrove@petalogix.com>
microblaze: Add branch_compare instruction

To facilitate optimization pass understanding of the conditional
branch for microblaze, remove the UNSPEC'd signed_compare /
unsigned_compare instructions, and replace with a complete
branch_compare which will output_asm_insn the correct cmp/cmpu
depending on comparison code and signed / unsigned.

We then return the correct branch instruction.

cbranchsi now calls an expanded microblaze_expand_conditional_branch
function which will carry out compare against zero, compare EQ/NE,
and all other compares appropriately.

-funroll-loops optimization pass can now proceed

Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com>