* except.h (current_function_eh_stub_label): Declare.
(current_function_eh_old_stub_label): Declare.
* function.h (struct function): New members eh_stub_label and
eh_old_stub_label.
* except.c (current_function_eh_stub_label): New variable.
(current_function_eh_old_stub_label): New variable.
(init_eh_for_function): Clear them.
(save_eh_status): Save them.
(restore_eh_status): Restore them.
(expand_builtin_eh_stub): Set current_function_eh_stub_label.
(expand_builtin_eh_stub_old): Set current_function_eh_old_stub_label.
* flow.c (find_basic_blocks_1): When handling a REG_LABEL note, don't
make an edge from the block that contains it to the block starting
with the label if this label is one of the eh stub labels.
If eh stub labels exist, show they are reachable from the last block
in the function.
From-SVN: r22369
Wed Sep 9 21:58:41 1998 Bernd Schmidt <crux@pool.informatik.rwth-aachen.de>
+ * except.h (current_function_eh_stub_label): Declare.
+ (current_function_eh_old_stub_label): Declare.
+ * function.h (struct function): New members eh_stub_label and
+ eh_old_stub_label.
+ * except.c (current_function_eh_stub_label): New variable.
+ (current_function_eh_old_stub_label): New variable.
+ (init_eh_for_function): Clear them.
+ (save_eh_status): Save them.
+ (restore_eh_status): Restore them.
+ (expand_builtin_eh_stub): Set current_function_eh_stub_label.
+ (expand_builtin_eh_stub_old): Set current_function_eh_old_stub_label.
+ * flow.c (find_basic_blocks_1): When handling a REG_LABEL note, don't
+ make an edge from the block that contains it to the block starting
+ with the label if this label is one of the eh stub labels.
+ If eh stub labels exist, show they are reachable from the last block
+ in the function.
+
* reload1.c (reload): Break out several subroutines and make some
variables global.
(calculate_needs_all_insns): New function, broken out of reload.
rtx current_function_ehc;
+/* The labels generated by expand_builtin_eh_stub and
+ expand_builtin_eh_stub_old. */
+
+rtx current_function_eh_stub_label;
+rtx current_function_eh_old_stub_label;
+
/* A stack used for keeping track of the currently active exception
handling region. As each exception region is started, an entry
describing the region is pushed onto this stack. The current
caught_return_label_stack = 0;
protect_list = NULL_TREE;
current_function_ehc = NULL_RTX;
+ current_function_eh_stub_label = NULL_RTX;
+ current_function_eh_old_stub_label = NULL_RTX;
}
/* Save some of the per-function EH info into the save area denoted by
p->caught_return_label_stack = caught_return_label_stack;
p->protect_list = protect_list;
p->ehc = current_function_ehc;
+ p->eh_stub_label = current_function_eh_stub_label;
+ p->eh_old_stub_label = current_function_eh_old_stub_label;
init_eh_for_function ();
}
ehstack = p->ehstack;
catchstack = p->catchstack;
current_function_ehc = p->ehc;
+ current_function_eh_stub_label = p->eh_stub_label;
+ current_function_eh_old_stub_label = p->eh_old_stub_label;
}
\f
/* This section is for the exception handling specific optimization
rtx after_stub = gen_label_rtx ();
rtx handler, offset;
+ current_function_eh_old_stub_label = stub_start;
+
emit_jump (after_stub);
emit_label (stub_start);
rtx handler, offset;
rtx temp;
+ current_function_eh_stub_label = stub_start;
+
emit_jump (after_stub);
emit_label (stub_start);
#define rtx _except_rtx
#endif
+/* The labels generated by expand_builtin_eh_stub and
+ expand_builtin_eh_stub_old. */
+
+extern rtx current_function_eh_stub_label;
+extern rtx current_function_eh_old_stub_label;
+
#ifdef TREE_CODE
/* A stack of labels. CHAIN points to the next entry in the stack. */
struct eh_node *tail;
};
-
/* Start an exception handling region. All instructions emitted after
this point are considered to be part of the region until
expand_eh_region_end () is invoked. */
{
/* 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)
+ if (REG_NOTE_KIND (note) == REG_LABEL
+ && XEXP (note, 0) != current_function_eh_stub_label
+ && XEXP (note, 0) != current_function_eh_old_stub_label)
label_value_list = gen_rtx_EXPR_LIST (VOIDmode, XEXP (note, 0),
label_value_list);
}
{
if (GET_RTX_CLASS (GET_CODE (insn)) == 'i')
{
-
/* References to labels in non-jumping insns have
REG_LABEL notes attached to them.
associated insns aren't marked dead, so we make
the block in question live and create an edge from
this insn to the label. This is not strictly
- correct, but it is close enough for now. */
+ correct, but it is close enough for now.
+
+ See below for code that handles the eh_stub labels
+ specially. */
for (note = REG_NOTES (insn);
note;
note = XEXP (note, 1))
{
- if (REG_NOTE_KIND (note) == REG_LABEL)
+ if (REG_NOTE_KIND (note) == REG_LABEL
+ && XEXP (note, 0) != current_function_eh_stub_label
+ && XEXP (note, 0) != current_function_eh_old_stub_label)
{
x = XEXP (note, 0);
block_live[BLOCK_NUM (x)] = 1;
}
}
}
+ /* We know something about the structure of the function
+ __throw in libgcc2.c. It is the only function that ever
+ contains eh_stub labels. It modifies its return address
+ so that the last block returns to one of the eh_stub labels
+ within it. So we have to make additional edges in the
+ flow graph. */
+ if (i + 1 == n_basic_blocks
+ && current_function_eh_stub_label != 0)
+ {
+ mark_label_ref (gen_rtx_LABEL_REF (VOIDmode,
+ current_function_eh_stub_label),
+ basic_block_end[i], 0);
+ mark_label_ref (gen_rtx_LABEL_REF (VOIDmode,
+ current_function_eh_old_stub_label),
+ basic_block_end[i], 0);
+ }
}
}
rtx catch_clauses;
struct label_node *false_label_stack;
struct label_node *caught_return_label_stack;
+ rtx eh_stub_label;
+ rtx eh_old_stub_label;
tree protect_list;
rtx ehc;