Commit acd693d1 by Richard Henderson Committed by Richard Henderson

output.h (current_function_has_computed_jump): Rename from current_function_addresses_labels.

        * output.h (current_function_has_computed_jump): Rename from
        current_function_addresses_labels.
        * function.h (struct function): Likewise for addresses_labels member.
        * rtl.h (FUNCTION_FLAGS_HAS_COMPUTED_JUMP): Likewise.
        * function.c (current_function_has_computed_jump): Likewise.
        Update all references.
        * integrate.c (function_cannot_inline_p):
        Test current_function_has_computed_jump instead of addresses_labels.
        (initialize_for_inline): Likewise save.
        (output_inline_function): Likewise restore.
        * expr.c (expand_expr): Don't reference addresses_labels variables.
        * stmt.c (expand_computed_goto): Set has_computed_jump.

From-SVN: r25100
parent 6ffc8580
Mon Feb 8 21:36:44 1999 Richard Henderson <rth@cygnus.com>
* output.h (current_function_has_computed_jump): Rename from
current_function_addresses_labels.
* function.h (struct function): Likewise for addresses_labels member.
* rtl.h (FUNCTION_FLAGS_HAS_COMPUTED_JUMP): Likewise.
* function.c (current_function_has_computed_jump): Likewise.
Update all references.
* integrate.c (function_cannot_inline_p):
Test current_function_has_computed_jump instead of addresses_labels.
(initialize_for_inline): Likewise save.
(output_inline_function): Likewise restore.
* expr.c (expand_expr): Don't reference addresses_labels variables.
* stmt.c (expand_computed_goto): Set has_computed_jump.
1999-02-08 Michael Meissner <meissner@cygnus.com> 1999-02-08 Michael Meissner <meissner@cygnus.com>
This is being installed only to get it into the repository to help This is being installed only to get it into the repository to help
......
...@@ -5603,12 +5603,10 @@ expand_expr (exp, target, tmode, modifier) ...@@ -5603,12 +5603,10 @@ expand_expr (exp, target, tmode, modifier)
p->forced_labels = gen_rtx_EXPR_LIST (VOIDmode, p->forced_labels = gen_rtx_EXPR_LIST (VOIDmode,
label_rtx (exp), label_rtx (exp),
p->forced_labels); p->forced_labels);
p->addresses_labels = 1;
pop_obstacks (); pop_obstacks ();
} }
else else
{ {
current_function_addresses_labels = 1;
if (modifier == EXPAND_INITIALIZER) if (modifier == EXPAND_INITIALIZER)
forced_labels = gen_rtx_EXPR_LIST (VOIDmode, forced_labels = gen_rtx_EXPR_LIST (VOIDmode,
label_rtx (exp), label_rtx (exp),
......
...@@ -148,10 +148,9 @@ int current_function_contains_functions; ...@@ -148,10 +148,9 @@ int current_function_contains_functions;
int current_function_sp_is_unchanging; int current_function_sp_is_unchanging;
/* Nonzero if the function being compiled has the address of its /* Nonzero if the function being compiled issues a computed jump. */
labels taken. */
int current_function_addresses_labels; int current_function_has_computed_jump;
/* Nonzero if the current function is a thunk (a lightweight function that /* Nonzero if the current function is a thunk (a lightweight function that
just adjusts one of its arguments and forwards to another function), so just adjusts one of its arguments and forwards to another function), so
...@@ -525,7 +524,7 @@ push_function_context_to (context) ...@@ -525,7 +524,7 @@ push_function_context_to (context)
p->has_nonlocal_label = current_function_has_nonlocal_label; p->has_nonlocal_label = current_function_has_nonlocal_label;
p->has_nonlocal_goto = current_function_has_nonlocal_goto; p->has_nonlocal_goto = current_function_has_nonlocal_goto;
p->contains_functions = current_function_contains_functions; p->contains_functions = current_function_contains_functions;
p->addresses_labels = current_function_addresses_labels; p->has_computed_jump = current_function_has_computed_jump;
p->is_thunk = current_function_is_thunk; p->is_thunk = current_function_is_thunk;
p->args_size = current_function_args_size; p->args_size = current_function_args_size;
p->pretend_args_size = current_function_pretend_args_size; p->pretend_args_size = current_function_pretend_args_size;
...@@ -598,7 +597,7 @@ pop_function_context_from (context) ...@@ -598,7 +597,7 @@ pop_function_context_from (context)
current_function_contains_functions current_function_contains_functions
= p->contains_functions || p->inline_obstacks = p->contains_functions || p->inline_obstacks
|| context == current_function_decl; || context == current_function_decl;
current_function_addresses_labels = p->addresses_labels; current_function_has_computed_jump = p->has_computed_jump;
current_function_name = p->name; current_function_name = p->name;
current_function_decl = p->decl; current_function_decl = p->decl;
current_function_pops_args = p->pops_args; current_function_pops_args = p->pops_args;
...@@ -5582,7 +5581,7 @@ init_function_start (subr, filename, line) ...@@ -5582,7 +5581,7 @@ init_function_start (subr, filename, line)
current_function_has_nonlocal_goto = 0; current_function_has_nonlocal_goto = 0;
current_function_contains_functions = 0; current_function_contains_functions = 0;
current_function_sp_is_unchanging = 0; current_function_sp_is_unchanging = 0;
current_function_addresses_labels = 0; current_function_has_computed_jump = 0;
current_function_is_thunk = 0; current_function_is_thunk = 0;
current_function_returns_pcc_struct = 0; current_function_returns_pcc_struct = 0;
......
...@@ -80,7 +80,7 @@ struct function ...@@ -80,7 +80,7 @@ struct function
int has_nonlocal_label; int has_nonlocal_label;
int has_nonlocal_goto; int has_nonlocal_goto;
int contains_functions; int contains_functions;
int addresses_labels; int has_computed_jump;
int is_thunk; int is_thunk;
rtx nonlocal_goto_handler_slots; rtx nonlocal_goto_handler_slots;
rtx nonlocal_goto_stack_level; rtx nonlocal_goto_stack_level;
......
...@@ -182,16 +182,11 @@ function_cannot_inline_p (fndecl) ...@@ -182,16 +182,11 @@ function_cannot_inline_p (fndecl)
return N_("function too large to be inline"); return N_("function too large to be inline");
} }
/* We cannot inline this function it has the addresses of its labels /* We will not inline a function which uses computed goto. The addresses of
taken. This can mean that a label in this function was used as an its local labels, which may be tucked into global storage, are of course
initializer either statically or dynamically or stored outside the not constant across instantiations, which causes unexpected behaviour. */
function. Because labels can not be duplicated, all labels in the if (current_function_has_computed_jump)
function will be renamed when it is inlined. However, there is no way return N_("function with computed jump cannot inline");
to find and fix all variables initialized with addresses of labels in this
function, hence inlining is impossible. */
if (current_function_addresses_labels)
return N_("function with label addresses taken cannot inline");
/* We cannot inline a nested function that jumps to a nonlocal label. */ /* We cannot inline a nested function that jumps to a nonlocal label. */
if (current_function_has_nonlocal_goto) if (current_function_has_nonlocal_goto)
...@@ -303,7 +298,7 @@ initialize_for_inline (fndecl, min_labelno, max_labelno, max_reg, copy) ...@@ -303,7 +298,7 @@ initialize_for_inline (fndecl, min_labelno, max_labelno, max_reg, copy)
+ current_function_uses_const_pool * FUNCTION_FLAGS_USES_CONST_POOL + current_function_uses_const_pool * FUNCTION_FLAGS_USES_CONST_POOL
+ (current_function_uses_pic_offset_table + (current_function_uses_pic_offset_table
* FUNCTION_FLAGS_USES_PIC_OFFSET_TABLE) * FUNCTION_FLAGS_USES_PIC_OFFSET_TABLE)
+ current_function_addresses_labels * FUNCTION_FLAGS_ADDRESSES_LABELS); + current_function_has_computed_jump * FUNCTION_FLAGS_HAS_COMPUTED_JUMP);
/* Clear out PARMDECL_MAP. It was allocated in the caller's frame. */ /* Clear out PARMDECL_MAP. It was allocated in the caller's frame. */
bzero ((char *) parmdecl_map, max_parm_reg * sizeof (tree)); bzero ((char *) parmdecl_map, max_parm_reg * sizeof (tree));
...@@ -3388,8 +3383,8 @@ output_inline_function (fndecl) ...@@ -3388,8 +3383,8 @@ output_inline_function (fndecl)
stack_slot_list = STACK_SLOT_LIST (head); stack_slot_list = STACK_SLOT_LIST (head);
forced_labels = FORCED_LABELS (head); forced_labels = FORCED_LABELS (head);
if (FUNCTION_FLAGS (head) & FUNCTION_FLAGS_ADDRESSES_LABELS) if (FUNCTION_FLAGS (head) & FUNCTION_FLAGS_HAS_COMPUTED_JUMP)
current_function_addresses_labels = 1; current_function_has_computed_jump = 1;
if (FUNCTION_FLAGS (head) & FUNCTION_FLAGS_CALLS_ALLOCA) if (FUNCTION_FLAGS (head) & FUNCTION_FLAGS_CALLS_ALLOCA)
current_function_calls_alloca = 1; current_function_calls_alloca = 1;
......
...@@ -389,10 +389,9 @@ extern int current_function_contains_functions; ...@@ -389,10 +389,9 @@ extern int current_function_contains_functions;
extern int current_function_sp_is_unchanging; extern int current_function_sp_is_unchanging;
/* Nonzero if the function being compiled has the address of its /* Nonzero if the function being compiled issues a computed jump. */
labels taken. */
extern int current_function_addresses_labels; extern int current_function_has_computed_jump;
/* Nonzero if the current function returns a pointer type */ /* Nonzero if the current function returns a pointer type */
......
...@@ -715,7 +715,7 @@ extern char *note_insn_name[]; ...@@ -715,7 +715,7 @@ extern char *note_insn_name[];
#define FUNCTION_FLAGS_USES_CONST_POOL 0200 #define FUNCTION_FLAGS_USES_CONST_POOL 0200
#define FUNCTION_FLAGS_CALLS_LONGJMP 0400 #define FUNCTION_FLAGS_CALLS_LONGJMP 0400
#define FUNCTION_FLAGS_USES_PIC_OFFSET_TABLE 01000 #define FUNCTION_FLAGS_USES_PIC_OFFSET_TABLE 01000
#define FUNCTION_FLAGS_ADDRESSES_LABELS 02000 #define FUNCTION_FLAGS_HAS_COMPUTED_JUMP 02000
/* Define a macro to look for REG_INC notes, /* Define a macro to look for REG_INC notes,
but save time on machines where they never exist. */ but save time on machines where they never exist. */
......
...@@ -593,6 +593,8 @@ expand_computed_goto (exp) ...@@ -593,6 +593,8 @@ expand_computed_goto (exp)
do_pending_stack_adjust (); do_pending_stack_adjust ();
emit_indirect_jump (x); emit_indirect_jump (x);
current_function_has_computed_jump = 1;
} }
/* Handle goto statements and the labels that they can go to. */ /* Handle goto statements and the labels that they can go to. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment