PR middle-end/43631
	* emit-rtl.c (make_note_raw): New function.
	(link_insn_into_chain): New static inline function.
	(add_insn): Use it.
	(add_insn_before, add_insn_after): Factor insn chain linking code...
	(add_insn_before_nobb, add_insn_after_nobb): ...here, new functions
	using link_insn_into_chain.
	(note_outside_basic_block_p): New helper function for emit_note_after
	and emit_note_before.
	(emit_note_after): Use nobb variant of add_insn_after if the note
	should not be contained in a basic block.
	(emit_note_before): Use nobb variant of add_insn_before if the note
	should not be contained in a basic block.
	(emit_note_copy): Use make_note_raw.
	(emit_note): Likewise.
	* bb-reorder.c (insert_section_boundary_note): Remove hack to set
	BLOCK_FOR_INSN to NULL manually for NOTE_INSN_SWITCH_TEXT_SECTIONS.
	* jump.c (cleanup_barriers): Use reorder_insns_nobb to avoid making
	the moved barrier the tail of the basic block it follows.
	* var-tracking.c (pass_variable_tracking): Add TODO_verify_flow.



git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@197994 138bc75d-0d04-0410-961f-82ee72b054a4
	* cfgrtl.c (cfg_layout_merge_blocks): Revert r184005, implement
	correct fix by moving header and footer insn to the footer of
	the merged basic block.  Clear BB_END of the merged-away block.


git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@197995 138bc75d-0d04-0410-961f-82ee72b054a4
EDIT GCC/MAKEFILE.IN To avoid failures in parallel builds of core pass2

with errors relating to

optabs.h:25:25: error: insn-opinit.h: No such file or directory

BROKE in UPSTREAM, when fixed, can be removed

Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com>
[Patch, microblaze]: Enable DWARF exception handling support.

Changelog

2013-03-18  Edgar E. Iglesias <edgar.iglesias@xilinx.com>
            David Holsgrove <david.holsgrove@xilinx.com>

 * common/config/microblaze/microblaze-common.c: Remove
   TARGET_EXCEPT_UNWIND_INFO definition.
 * config/microblaze/microblaze-protos.h: Add
   microblaze_eh_return prototype.
 * gcc/config/microblaze/microblaze.c: (microblaze_must_save_register,
   microblaze_expand_epilogue, microblaze_return_addr): Handle
   calls_eh_return
   (microblaze_eh_return): New function.
 * gcc/config/microblaze/microblaze.h: Define RETURN_ADDR_OFFSET,
   EH_RETURN_DATA_REGNO, MB_EH_STACKADJ_REGNUM, EH_RETURN_STACKADJ_RTX,
   ASM_PREFERRED_EH_DATA_FORMAT
 * gcc/config/microblaze/microblaze.md: Define eh_return pattern.

Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
[Patch, microblaze]: Add 4 byte implementation for 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

Add __sync_lock_test_and_set 4 byte atomic builtin

Changelog

2013-03-18  David Holsgrove <david.holsgrove@xilinx.com>

 * gcc/config/microblaze/sync.md: New file.
 * gcc/config/microblaze/microblaze.md: Add UNSPEC_SYNC_CAS,
   UNSPEC_SYNC_XCHG and include sync.md.
 * gcc/config/microblaze/microblaze.c: Add print_operand 'y'.
 * gcc/config/microblaze/constraints.md: Add memory_contraint
   'Q' which is a single register.

Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com>
[Patch, 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

Changelog

2013-03-18  David Holsgrove <david.holsgrove@xilinx.com>

 * gcc/config/microblaze/microblaze.md (jump):
   Account for jumps to SYMBOL_REFs.

Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com>
[Patch, 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 '...'

Changelog

2013-03-18  David Holsgrove <david.holsgrove@xilinx.com>

 * gcc/config/microblaze/microblaze.c: Add microblaze_asm_output_mi_thunk
   and define TARGET_ASM_OUTPUT_MI_THUNK and TARGET_ASM_CAN_OUTPUT_MI_THUNK

Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com>
[Patch, microblaze]: Add -fstack-usage support

Changelog

2013-03-18  David Holsgrove <david.holsgrove@xilinx.com>

 * gcc/config/microblaze/microblaze.c (microblaze_expand_prologue):
   Add check for flag_stack_usage to enable -fstack-usage support

Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com>
[Patch, 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.

Changelog

2013-03-18  Edgar E. Iglesias <edgar.iglesias@xilinx.com>

 * gcc/config/microblaze/microblaze.h: Remove SECONDARY_MEMORY_NEEDED
   definition.

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Signed-off-by: Peter A. G. Crosthwaite <peter.crosthwaite@xilinx.com>
[Patch, 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]

Changelog

2013-03-18  David Holsgrove <david.holsgrove@xilinx.com>

 * gcc/config/microblaze/microblaze.h: Define SIZE_TYPE
   and PTRDIFF_TYPE.

Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com>
[Patch, 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

Changelog

2013-03-19  David Holsgrove <david.holsgrove@xilinx.com>

 * gcc/config/microblaze/predicates.md: Add cmp_op predicate.
 * gcc/config/microblaze/microblaze.md: Add branch_compare
   instruction which uses cmp_op predicate and emits cmp insn
   before branch.
 * gcc/config/microblaze/microblaze.c
   (microblaze_emit_compare): Rename to
   microblaze_expand_conditional_branch and consolidate logic.
   (microblaze_expand_conditional_branch): emit branch_compare
   insn instead of handling cmp op separate from branch insn.

Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com>
[Patch, microblaze]: Disable fivopts by default

Turn off ivopts by default. Interferes with cse.

Changelog

2013-03-18  Edgar E. Iglesias <edgar.iglesias@xilinx.com>

 * gcc/common/config/microblaze/microblaze-common.c
   (microblaze_option_optimization_table): Disable fivopts by default.

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com>
[Patch, microblaze]: Increase max ailgnment to please the testsuite

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
[Patch, microblaze]: Use bralid for profiler calls

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
[Patch, microblaze]: updated gcc.target/microblaze/others/strings1.c

for new scan-assembly output resulting in use of $LC label

Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com>
[Patch, microblaze]: For dejagnu static testing on qemu, suppress warnings

about multiple definitions from the test function and libc in line
with method used by powerpc. Dynamic linking and using a qemu binary
which understands sysroot resolves all test failures with builtins

Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com>
[Patch, microblaze]: Testsuite - explicitely add -fivopts for tests that depend on it

(test gcc/testsuite/gcc.dg/tree-ssa/ivopts-lt.c doesnt exist in 4.6 branch)

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
Quick fail g++.dg/opt/memcpy1.C

This particular testcase fails with a timeout. Instead, fail it
at compile-time for microblaze. This speeds up the testsuite without
removing it from the FAIL reports.

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>