This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
PATCH: mips16 machine_dependent_reorg
- To: egcs-patches@egcs.cygnus.com
- Subject: PATCH: mips16 machine_dependent_reorg
- From: Andrew Haley <aph@pasanda.cygnus.co.uk>
- Date: 20 Aug 1999 14:41:00 -0000
This MIPS16 patch forces the output of the local constant pool if no
barrier has been found before a relative load instruction has gone out
of range. This can happen if a function is, for example, a very long
list of assignments.
Andrew.
Fri Aug 20 13:43:41 1999 Andrew Haley <aph@cygnus.com>
* config/mips/mips.c (machine_dependent_reorg): Force a
barrier to output the local constant pool if a barrier hasn't
been found at a natural point in the instruction stream.
Index: mips.c
===================================================================
RCS file: /cvs/egcs/egcs/gcc/config/mips/mips.c,v
retrieving revision 1.62
diff -p -2 -c -r1.62 mips.c
*** mips.c 1999/08/09 14:00:07 1.62
--- mips.c 1999/08/20 14:24:58
*************** machine_dependent_reorg (first)
*** 8373,8377 ****
rtx first;
{
! int insns_len, max_internal_pool_size, pool_size, addr;
rtx insn;
struct constant *constants;
--- 8373,8377 ----
rtx first;
{
! int insns_len, max_internal_pool_size, pool_size, addr, first_constant_ref;
rtx insn;
struct constant *constants;
*************** machine_dependent_reorg (first)
*** 8441,8444 ****
--- 8441,8445 ----
constants = NULL;
addr = 0;
+ first_constant_ref = -1;
for (insn = first; insn; insn = NEXT_INSN (insn))
*************** machine_dependent_reorg (first)
*** 8499,8502 ****
--- 8500,8506 ----
newsrc);
INSN_CODE (insn) = -1;
+
+ if (first_constant_ref < 0)
+ first_constant_ref = addr;
}
}
*************** machine_dependent_reorg (first)
*** 8530,8554 ****
dump_constants (constants, insn);
constants = NULL;
}
!
! /* ??? If we don't find a barrier within 0x8000 bytes of
! instructions and constants in CONSTANTS, we need to invent
! one. This seems sufficiently unlikely that I am not going to
! worry about it. */
! }
!
! if (constants != NULL)
! {
! rtx label, jump, barrier;
!
! label = gen_label_rtx ();
! jump = emit_jump_insn_after (gen_jump (label), get_last_insn ());
! JUMP_LABEL (jump) = label;
! LABEL_NUSES (label) = 1;
! barrier = emit_barrier_after (jump);
! emit_label_after (label, barrier);
! dump_constants (constants, barrier);
! constants = NULL;
! }
/* ??? If we output all references to a constant in internal
--- 8534,8564 ----
dump_constants (constants, insn);
constants = NULL;
+ first_constant_ref = -1;
}
!
! if (constants != NULL
! && (NEXT_INSN (insn) == NULL
! || (first_constant_ref >= 0
! && (((addr - first_constant_ref)
! + 2 /* for alignment */
! + 2 /* for a short jump insn */
! + pool_size)
! >= 0x8000))))
! {
! /* If we haven't had a barrier within 0x8000 bytes of a
! constant reference or we are at the end of the function,
! emit a barrier now. */
!
! rtx label, jump, barrier;
!
! label = gen_label_rtx ();
! jump = emit_jump_insn_after (gen_jump (label), insn);
! JUMP_LABEL (jump) = label;
! LABEL_NUSES (label) = 1;
! barrier = emit_barrier_after (jump);
! emit_label_after (label, barrier);
! first_constant_ref = -1;
! }
! }
/* ??? If we output all references to a constant in internal