diff --git a/gcc/ChangeLog b/gcc/ChangeLog index fed88121ae4..6cec51c1c28 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +1999-11-22 Andrew Haley + + * varasm.c (function_defined): Remove. + (make_function_rtl): Don't set function_defined. + (make_decl_rtl): Remove global register warning. + * regclass.c (no_global_reg_vars): New variable. + (globalize_reg): Warn if function has already been defined. + (regclass_init): Set no_global_reg_vars. + Mon Nov 22 14:42:22 MET 1999 Jan Hubicka * regclass.c (reg_pref): New structure and static variable diff --git a/gcc/regclass.c b/gcc/regclass.c index 544159bc624..cba13c48033 100644 --- a/gcc/regclass.c +++ b/gcc/regclass.c @@ -218,6 +218,11 @@ struct reg_info_data { static struct reg_info_data *reg_info_head; +/* No more global register vairiables may be declared; true once + regclass has been initialized. */ + +static int no_global_reg_vars = 0; + /* Function called only once to initialize the above data on reg usage. Once this is done, various switches may override. */ @@ -625,6 +630,9 @@ void globalize_reg (i) int i; { + if (no_global_reg_vars) + error ("global register variable follows a function definition"); + if (global_regs[i]) { warning ("register used for two global register variables"); @@ -758,6 +766,9 @@ regclass_init () /* This prevents dump_flow_info from losing if called before regclass is run. */ reg_pref = NULL; + + /* No more global register vairiables may be declared. */ + no_global_reg_vars = 1; } /* Dump register costs. */ diff --git a/gcc/varasm.c b/gcc/varasm.c index d4da6983876..aca7a074d43 100644 --- a/gcc/varasm.c +++ b/gcc/varasm.c @@ -149,10 +149,6 @@ int size_directive_output; tree last_assemble_variable_decl; -/* Nonzero if at least one function definition has been seen. */ - -static int function_defined; - static const char *strip_reg_name PROTO((const char *)); static int contains_pointers_p PROTO((tree)); static void decode_addr_const PROTO((tree, struct addr_const *)); @@ -579,9 +575,6 @@ make_function_rtl (decl) ENCODE_SECTION_INFO (decl); #endif } - - /* Record at least one function has been defined. */ - function_defined = 1; } /* Given NAME, a putative register name, discard any customary prefixes. */ @@ -729,9 +722,6 @@ make_decl_rtl (decl, asmspec, top_level) DECL_INITIAL (decl) = 0; error ("global register variable has initial value"); } - if (fixed_regs[reg_number] == 0 - && function_defined && top_level) - error ("global register variable follows a function definition"); if (TREE_THIS_VOLATILE (decl)) warning ("volatile register variables don't work as you might wish");