hard-reg-set.h (regs_invalidated_by_call): Declare.
authorRichard Henderson <rth@gcc.gnu.org>
Mon, 16 Jul 2001 17:54:34 +0000 (10:54 -0700)
committerRichard Henderson <rth@gcc.gnu.org>
Mon, 16 Jul 2001 17:54:34 +0000 (10:54 -0700)
        * 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

gcc/ChangeLog
gcc/cse.c
gcc/df.c
gcc/flow.c
gcc/gcse.c
gcc/hard-reg-set.h
gcc/regclass.c
gcc/sched-deps.c

index 48838d17b22b14e25fabdd7d02e2cc15077fc7a8..8fea87e4b8796d321a7da4829aeea3ad372cfa41 100644 (file)
@@ -1,3 +1,16 @@
+2001-07-16  Richard Henderson  <rth@redhat.com>
+
+       * 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 <amylaar@redhat.com>
 
        * 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  <jh@suse.cz>
 
 2001-07-11  Timothy Wall  <twall@redhat.com>
 
-        * 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  <kazu@hxi.com>
 
@@ -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  <wilson@redhat.com>
 
@@ -1482,7 +1495,7 @@ Fri Jul  6 11:47:59 2001  Jeffrey A Law  (law@cygnus.com)
 2001-07-04  Nathan Sidwell  <nathan@codesourcery.com>
 
        * 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  <kenner@vlsi1.ultra.nyu.edu>
 
 2001-07-02  Steve Ellcey  <sje@cup.hp.com>
 
-        * 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  <zackw@stanford.edu>
 
index bc86cdc954c1ed0e63103c8d7b3b6f9dc32f45b1..266f258d7580ffe9eb1674346a5cb0b7b2f760fb 100644 (file)
--- 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.
index 36ae66f783fe39c9151e9ee635397e2bae74d412..4548a313ceb7f663da5c812ccbbfb305a1de7fa4 100644 (file)
--- 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);
index 56b40f0e625a8806fbadf3a361817b81a78137fa..6d25582cebc646f0cac5660fa9de85516337e83b 100644 (file)
@@ -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),
index eecd0d84247b671890fa7e266fd006bcb5c78a0e..9834a6b6aa6405c9a208e05b58bddcc1c9858a90 100644 (file)
@@ -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);
index 10435beec34a7a4d81fc8fd91f0f7cbfc8502be9..c3a2305711f87a2c6cb6efa58a7b6220b95d97ec 100644 (file)
@@ -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.  */
 
index 0af5328effef7f5bb90796e15ba966e0e5be214e..e3eca7f35d1985c119e7c2ed6e98e27fc718a574 100644 (file)
@@ -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++)
index eee26baf75bf56d8de3f44c05500562907f04f38..422b39485d36f8bbe65e70eed9de9850a5983146 100644 (file)
@@ -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);
            }