This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
patch for label handling in flow
- To: egcs-patches at cygnus dot com
- Subject: patch for label handling in flow
- From: Philip Blundell <philb at gnu dot org>
- Date: Mon, 25 Jan 1999 20:25:13 +0100
This patch provides a mechanism for a backend to prevent flow from applying
the usual rules for reachability analysis to a label.
Normally if a label has its address taken, flow will consider it to be a
potential target for any computed goto. Unfortunately on the ARM port the
prologue used for functions compiled as PIC includes such a label. Since the
arguments are still in the hard regs they were passed in at this point,
treating the label as reachable will cause those registers to be spuriously
marked live throughout large areas of the function. This usually leads to
an abort in some subsequent compilation pass.
(An accompanying patch, which I'll send to the ARM maintainers directly, is
obviously needed to make the arm backend use this facility.)
p.
1998-12-27 Philip Blundell <philb@gnu.org>
* flow.c (find_basic_blocks_1): If RTX_FRAME_RELATED_P is set on a
label, don't add it to label_value_list.
* rtl.h: Add comment documenting this behaviour.
diff -u --recursive --new-file clean/egcs-1.1.1/gcc/flow.c egcs-1.1.1/gcc/flow.c
--- clean/egcs-1.1.1/gcc/flow.c Wed Jul 8 22:15:55 1998
+++ egcs-1.1.1/gcc/flow.c Sun Dec 27 19:03:13 1998
@@ -485,8 +485,12 @@
/* Make a list of all labels referred to other than by jumps. */
for (note = REG_NOTES (insn); note; note = XEXP (note, 1))
if (REG_NOTE_KIND (note) == REG_LABEL)
- label_value_list = gen_rtx_EXPR_LIST (VOIDmode, XEXP (note, 0),
- label_value_list);
+ {
+ rtx lab = XEXP (note, 0);
+ if (! RTX_FRAME_RELATED_P (lab))
+ label_value_list = gen_rtx_EXPR_LIST (VOIDmode, lab,
+ label_value_list);
+ }
}
/* Keep a lifo list of the currently active exception notes. */
diff -u --recursive --new-file clean/egcs-1.1.1/gcc/rtl.h egcs-1.1.1/gcc/rtl.h
--- clean/egcs-1.1.1/gcc/rtl.h Mon Jul 13 04:34:12 1998
+++ egcs-1.1.1/gcc/rtl.h Sun Dec 27 19:03:13 1998
@@ -165,7 +165,10 @@
unsigned integrated : 1;
/* Nonzero if this rtx is related to the call frame, either changing how
we compute the frame address or saving and restoring registers in
- the prologue and epilogue. */
+ the prologue and epilogue.
+ 1 in a CODE_LABEL if this label is only used as part of the prologue.
+ Flow will assume the label is not a potential nonlocal goto
+ destination in this case. */
unsigned frame_related : 1;
/* The first element of the operands of this rtx.
The number of operands and their types are controlled