From: Richard Henderson Date: Mon, 16 Jul 2001 17:54:34 +0000 (-0700) Subject: hard-reg-set.h (regs_invalidated_by_call): Declare. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=4e2db58460e396ff0a66e3c87f94665c2a7c1ffc;p=gcc.git hard-reg-set.h (regs_invalidated_by_call): Declare. * hard-reg-set.h (regs_invalidated_by_call): Declare. * regclass.c (regs_invalidated_by_call): Move from cse.c. (init_reg_sets_1): Move initialization from cse_main. * cse.c (regs_invalidated_by_call): Move to regclass.c. (cse_main): Move its initialization also. * df.c (df_insn_refs_record): Use regs_invalidated_by_call. * flow.c (propagate_one_insn): Likewise. * gcse.c (compute_hash_table): Likewise. (compute_kill_rd, compute_store_table): Likewise. * sched-deps.c (sched_analyze_1): Likewise. From-SVN: r44053 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 48838d17b22..8fea87e4b87 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,16 @@ +2001-07-16 Richard Henderson + + * hard-reg-set.h (regs_invalidated_by_call): Declare. + * regclass.c (regs_invalidated_by_call): Move from cse.c. + (init_reg_sets_1): Move initialization from cse_main. + * cse.c (regs_invalidated_by_call): Move to regclass.c. + (cse_main): Move its initialization also. + * df.c (df_insn_refs_record): Use regs_invalidated_by_call. + * flow.c (propagate_one_insn): Likewise. + * gcse.c (compute_hash_table): Likewise. + (compute_kill_rd, compute_store_table): Likewise. + * sched-deps.c (sched_analyze_1): Likewise. + Mon Jul 16 18:07:07 2001 J"orn Rennecke * gcse.c (pre_insert_copy_insn): Use gen_move_insn instead of @@ -385,12 +398,12 @@ Thu Jul 12 16:48:54 CEST 2001 Jan Hubicka 2001-07-11 Timothy Wall - * config.gcc: Add configuration for AIX5/IA64. - * config/ia64/aix.h: New. AIX5/IA64-specific configuration. - * config/ia64/crt[in].asm: New. Generic static ctor/dtor + * config.gcc: Add configuration for AIX5/IA64. + * config/ia64/aix.h: New. AIX5/IA64-specific configuration. + * config/ia64/crt[in].asm: New. Generic static ctor/dtor support prefix/suffix code. - * config/ia64/t-aix: New. Makefile fragment. - * config/ia64/unwind-aix.c: New. Unwind table entry lookup. + * config/ia64/t-aix: New. Makefile fragment. + * config/ia64/unwind-aix.c: New. Unwind table entry lookup. 2001-07-11 Kazu Hirata @@ -1395,8 +1408,8 @@ Fri Jul 6 11:47:59 2001 Jeffrey A Law (law@cygnus.com) 2001-07-05 H.J. Lu (hjl@gnu.org) - * config/mips/mips.c (mips_parse_cpu): New function to parse - -march=*/-mcpu=*. + * config/mips/mips.c (mips_parse_cpu): New function to parse + -march=*/-mcpu=*. 2001-07-05 Jim Wilson @@ -1482,7 +1495,7 @@ Fri Jul 6 11:47:59 2001 Jeffrey A Law (law@cygnus.com) 2001-07-04 Nathan Sidwell * cppinit.c (remove_dup_dirs): Inform if a system include - directory is being reordered. + directory is being reordered. * doc/invoke.texi (Directory Options): GCC warns if you hide a system include. * doc/cpp.texi (Search Paths): Likewise. @@ -1756,8 +1769,8 @@ Mon Jul 2 15:33:31 2001 Richard Kenner 2001-07-02 Steve Ellcey - * config/ia64/t-ia64: Change LIB1ASMFUNCS to use single underscore. - * config/ia64/lib1funcs.asm: Change macro names to match t-ia64. + * config/ia64/t-ia64: Change LIB1ASMFUNCS to use single underscore. + * config/ia64/lib1funcs.asm: Change macro names to match t-ia64. 2001-07-02 Zack Weinberg diff --git a/gcc/cse.c b/gcc/cse.c index bc86cdc954c..266f258d758 100644 --- a/gcc/cse.c +++ b/gcc/cse.c @@ -346,11 +346,6 @@ static struct cse_reg_info *cached_cse_reg_info; static HARD_REG_SET hard_regs_in_table; -/* A HARD_REG_SET containing all the hard registers that are invalidated - by a CALL_INSN. */ - -static HARD_REG_SET regs_invalidated_by_call; - /* CUID of insn that starts the basic block currently being cse-processed. */ static int cse_basic_block_start; @@ -7072,37 +7067,6 @@ cse_main (f, nregs, after_loop, file) INSN_CUID (insn) = i; } - /* Initialize which registers are clobbered by calls. */ - - CLEAR_HARD_REG_SET (regs_invalidated_by_call); - - for (i = 0; i < FIRST_PSEUDO_REGISTER; i++) - if ((call_used_regs[i] - /* Used to check !fixed_regs[i] here, but that isn't safe; - fixed regs are still call-clobbered, and sched can get - confused if they can "live across calls". - - The frame pointer is always preserved across calls. The arg - pointer is if it is fixed. The stack pointer usually is, unless - RETURN_POPS_ARGS, in which case an explicit CLOBBER - will be present. If we are generating PIC code, the PIC offset - table register is preserved across calls. */ - - && i != STACK_POINTER_REGNUM - && i != FRAME_POINTER_REGNUM -#if HARD_FRAME_POINTER_REGNUM != FRAME_POINTER_REGNUM - && i != HARD_FRAME_POINTER_REGNUM -#endif -#if ARG_POINTER_REGNUM != FRAME_POINTER_REGNUM - && ! (i == ARG_POINTER_REGNUM && fixed_regs[i]) -#endif -#if !defined (PIC_OFFSET_TABLE_REG_CALL_CLOBBERED) - && ! (i == PIC_OFFSET_TABLE_REGNUM && flag_pic) -#endif - ) - || global_regs[i]) - SET_HARD_REG_BIT (regs_invalidated_by_call, i); - ggc_push_context (); /* Loop over basic blocks. diff --git a/gcc/df.c b/gcc/df.c index 36ae66f783f..4548a313ceb 100644 --- a/gcc/df.c +++ b/gcc/df.c @@ -1268,14 +1268,9 @@ df_insn_refs_record (df, bb, insn) if (df->flags & DF_HARD_REGS) { - /* Each call clobbers all call-clobbered regs that are not - global or fixed and have not been explicitly defined - in the call pattern. */ + /* Kill all registers invalidated by a call. */ for (i = 0; i < FIRST_PSEUDO_REGISTER; i++) - if (call_used_regs[i] - && ! global_regs[i] - && ! fixed_regs[i] - && ! df_insn_regno_def_p (df, bb, insn, i)) + if (TEST_HARD_REG_BIT (regs_invalidated_by_call, i)) { rtx reg_clob = df_reg_clobber_gen (i); df_defs_record (df, reg_clob, bb, insn); diff --git a/gcc/flow.c b/gcc/flow.c index 56b40f0e625..6d25582cebc 100644 --- a/gcc/flow.c +++ b/gcc/flow.c @@ -4948,8 +4948,7 @@ propagate_one_insn (pbi, insn) /* Calls change all call-used and global registers. */ for (i = 0; i < FIRST_PSEUDO_REGISTER; i++) - if (call_used_regs[i] && ! global_regs[i] - && ! fixed_regs[i]) + if (TEST_HARD_REG_BIT (regs_invalidated_by_call, i)) { /* We do not want REG_UNUSED notes for these registers. */ mark_set_1 (pbi, CLOBBER, gen_rtx_REG (reg_raw_mode[i], i), diff --git a/gcc/gcse.c b/gcc/gcse.c index eecd0d84247..9834a6b6aa6 100644 --- a/gcc/gcse.c +++ b/gcc/gcse.c @@ -2548,20 +2548,7 @@ compute_hash_table (set_p) if (GET_CODE (insn) == CALL_INSN) { for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++) - if ((call_used_regs[regno] - && regno != STACK_POINTER_REGNUM -#if HARD_FRAME_POINTER_REGNUM != FRAME_POINTER_REGNUM - && regno != HARD_FRAME_POINTER_REGNUM -#endif -#if ARG_POINTER_REGNUM != FRAME_POINTER_REGNUM - && ! (regno == ARG_POINTER_REGNUM && fixed_regs[regno]) -#endif -#if !defined (PIC_OFFSET_TABLE_REG_CALL_CLOBBERED) - && ! (regno == PIC_OFFSET_TABLE_REGNUM && flag_pic) -#endif - - && regno != FRAME_POINTER_REGNUM) - || global_regs[regno]) + if (TEST_HARD_REG_BIT (regs_invalidated_by_call, regno)) record_last_reg_set_info (insn, regno); if (! CONST_CALL_P (insn)) @@ -3007,23 +2994,8 @@ compute_kill_rd () if (GET_CODE (insn) == CALL_INSN) { for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++) - { - if ((call_used_regs[regno] - && regno != STACK_POINTER_REGNUM -#if HARD_FRAME_POINTER_REGNUM != FRAME_POINTER_REGNUM - && regno != HARD_FRAME_POINTER_REGNUM -#endif -#if ARG_POINTER_REGNUM != FRAME_POINTER_REGNUM - && ! (regno == ARG_POINTER_REGNUM - && fixed_regs[regno]) -#endif -#if !defined (PIC_OFFSET_TABLE_REG_CALL_CLOBBERED) - && ! (regno == PIC_OFFSET_TABLE_REGNUM && flag_pic) -#endif - && regno != FRAME_POINTER_REGNUM) - || global_regs[regno]) - handle_rd_kill_set (insn, regno, BASIC_BLOCK (bb)); - } + if (TEST_HARD_REG_BIT (regs_invalidated_by_call, regno)) + handle_rd_kill_set (insn, regno, BASIC_BLOCK (bb)); } if (GET_CODE (pat) == PARALLEL) @@ -6553,21 +6525,8 @@ compute_store_table () if (GET_CODE (insn) == CALL_INSN) { for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++) - if ((call_used_regs[regno] - && regno != STACK_POINTER_REGNUM -#if HARD_FRAME_POINTER_REGNUM != FRAME_POINTER_REGNUM - && regno != HARD_FRAME_POINTER_REGNUM -#endif -#if ARG_POINTER_REGNUM != FRAME_POINTER_REGNUM - && ! (regno == ARG_POINTER_REGNUM && fixed_regs[regno]) -#endif -#if defined (PIC_OFFSET_TABLE_REGNUM) && !defined (PIC_OFFSET_TABLE_REG_CALL_CLOBBERED) - && ! (regno == PIC_OFFSET_TABLE_REGNUM && flag_pic) -#endif - - && regno != FRAME_POINTER_REGNUM) - || global_regs[regno]) - SET_BIT (reg_set_in_block[bb], regno); + if (TEST_HARD_REG_BIT (regs_invalidated_by_call, regno)) + SET_BIT (reg_set_in_block[bb], regno); } pat = PATTERN (insn); diff --git a/gcc/hard-reg-set.h b/gcc/hard-reg-set.h index 10435beec34..c3a2305711f 100644 --- a/gcc/hard-reg-set.h +++ b/gcc/hard-reg-set.h @@ -431,6 +431,15 @@ extern HARD_REG_SET call_fixed_reg_set; extern char global_regs[FIRST_PSEUDO_REGISTER]; +/* Contains 1 for registers that are set or clobbered by calls. */ +/* ??? Ideally, this would be just call_used_regs plus global_regs, but + for someone's bright idea to have call_used_regs strictly include + fixed_regs. Which leaves us guessing as to the set of fixed_regs + that are actually preserved. We know for sure that those associated + with the local stack frame are safe, but scant others. */ + +extern HARD_REG_SET regs_invalidated_by_call; + #ifdef REG_ALLOC_ORDER /* Table of register numbers in the order in which to try to use them. */ diff --git a/gcc/regclass.c b/gcc/regclass.c index 0af5328effe..e3eca7f35d1 100644 --- a/gcc/regclass.c +++ b/gcc/regclass.c @@ -116,7 +116,16 @@ int n_non_fixed_regs; and are also considered fixed. */ char global_regs[FIRST_PSEUDO_REGISTER]; - + +/* Contains 1 for registers that are set or clobbered by calls. */ +/* ??? Ideally, this would be just call_used_regs plus global_regs, but + for someone's bright idea to have call_used_regs strictly include + fixed_regs. Which leaves us guessing as to the set of fixed_regs + that are actually preserved. We know for sure that those associated + with the local stack frame are safe, but scant others. */ + +HARD_REG_SET regs_invalidated_by_call; + /* Table of register numbers in the order in which to try to use them. */ #ifdef REG_ALLOC_ORDER int reg_alloc_order[FIRST_PSEUDO_REGISTER] = REG_ALLOC_ORDER; @@ -410,6 +419,7 @@ init_reg_sets_1 () CLEAR_HARD_REG_SET (fixed_reg_set); CLEAR_HARD_REG_SET (call_used_reg_set); CLEAR_HARD_REG_SET (call_fixed_reg_set); + CLEAR_HARD_REG_SET (regs_invalidated_by_call); memcpy (call_fixed_regs, fixed_regs, sizeof call_fixed_regs); @@ -428,7 +438,34 @@ init_reg_sets_1 () SET_HARD_REG_BIT (call_fixed_reg_set, i); if (CLASS_LIKELY_SPILLED_P (REGNO_REG_CLASS (i))) SET_HARD_REG_BIT (losing_caller_save_reg_set, i); + + /* There are a couple of fixed registers that we know are safe to + exclude from being clobbered by calls: + + The frame pointer is always preserved across calls. The arg pointer + is if it is fixed. The stack pointer usually is, unless + RETURN_POPS_ARGS, in which case an explicit CLOBBER will be present. + If we are generating PIC code, the PIC offset table register is + preserved across calls, though the target can override that. */ + + if (i == STACK_POINTER_REGNUM || i == FRAME_POINTER_REGNUM) + ; +#if HARD_FRAME_POINTER_REGNUM != FRAME_POINTER_REGNUM + else if (i == HARD_FRAME_POINTER_REGNUM) + ; +#endif +#if ARG_POINTER_REGNUM != FRAME_POINTER_REGNUM + else if (i == ARG_POINTER_REGNUM && fixed_regs[i]) + ; +#endif +#ifndef PIC_OFFSET_TABLE_REG_CALL_CLOBBERED + else if (i == PIC_OFFSET_TABLE_REGNUM && flag_pic) + ; +#endif + else if (call_used_regs[i] || global_regs[i]) + SET_HARD_REG_BIT (regs_invalidated_by_call, i); } + memset (contains_reg_of_mode, 0, sizeof (contains_reg_of_mode)); memset (allocatable_regs_of_mode, 0, sizeof (allocatable_regs_of_mode)); for (m = 0; m < (unsigned int) MAX_MACHINE_MODE; m++) diff --git a/gcc/sched-deps.c b/gcc/sched-deps.c index eee26baf75b..422b39485d3 100644 --- a/gcc/sched-deps.c +++ b/gcc/sched-deps.c @@ -618,7 +618,9 @@ sched_analyze_1 (deps, x, insn) SET_REGNO_REG_SET (reg_pending_clobbers, r); /* Function calls clobber all call_used regs. */ - if (global_regs[r] || (code == SET && call_used_regs[r])) + if (global_regs[r] + || (code == SET + && TEST_HARD_REG_BIT (regs_invalidated_by_call, r))) for (u = deps->last_function_call; u; u = XEXP (u, 1)) add_dependence (insn, XEXP (u, 0), REG_DEP_ANTI); }