dbxout.c (dbxout_symbol_location): Update call of alter_subreg.
authorJan Hubicka <jh@suse.cz>
Wed, 14 Nov 2001 13:51:10 +0000 (14:51 +0100)
committerJan Hubicka <hubicka@gcc.gnu.org>
Wed, 14 Nov 2001 13:51:10 +0000 (13:51 +0000)
* dbxout.c (dbxout_symbol_location): Update call of alter_subreg.
* final.c (walk_alter_subreg): Take pointer; update call of alter_subreg.
(final_scan_insn): Update call of alter_subreg.
(cleanup_subreg_operands): Likewise.
(alter_subreg): Rewrite using simplify_subreg.
(output_address, output_operand): Update call of alter_subreg.
* output.h (alter_subreg): Update prototype.
* sdbout.c (sdbout_symbol): Update call of alter_subreg.
* simplify-rtx.c (simplify_subreg): Copy ORIGINAL_REGNO.
* Makefile.in (final.o): Add depdendancy on expr.h

From-SVN: r47013

gcc/ChangeLog
gcc/Makefile.in
gcc/dbxout.c
gcc/final.c
gcc/output.h
gcc/sdbout.c
gcc/simplify-rtx.c

index 16f781402e52a311308d34b6aa7cfdd5ed4f5999..d22a17a925709fc5e5ec8ddcf646526166cb4e28 100644 (file)
@@ -1,3 +1,16 @@
+Wed Nov 14 14:17:05 CET 2001  Jan Hubicka  <jh@suse.cz>
+
+       * dbxout.c (dbxout_symbol_location): Update call of alter_subreg.
+       * final.c (walk_alter_subreg): Take pointer; update call of alter_subreg.
+       (final_scan_insn): Update call of alter_subreg.
+       (cleanup_subreg_operands): Likewise.
+       (alter_subreg): Rewrite using simplify_subreg.
+       (output_address, output_operand): Update call of alter_subreg.
+       * output.h (alter_subreg): Update prototype.
+       * sdbout.c (sdbout_symbol): Update call of alter_subreg.
+       * simplify-rtx.c (simplify_subreg): Copy ORIGINAL_REGNO.
+       * Makefile.in (final.o): Add depdendancy on expr.h
+
 Wed Nov 14 06:37:54 2001  Richard Kenner  <kenner@vlsi1.ultra.nyu.edu>
 
        * c-lang.c (finish_file): Make I unsigned to eliminate warning.
index 57ae5a6c170da2548abcd40c7083dfa7e86a3298..6231c440c96c6be9a68811ba7f36dfd0ae868d4f 100644 (file)
@@ -1575,7 +1575,7 @@ sched-vis.o : sched-vis.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) sched-int.h \
 final.o : final.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) $(TREE_H) flags.h intl.h \
    $(REGS_H) $(RECOG_H) conditions.h insn-config.h $(INSN_ATTR_H) function.h \
    real.h output.h hard-reg-set.h except.h debug.h xcoffout.h \
-   toplev.h reload.h dwarf2out.h $(BASIC_BLOCK_H) $(TM_P_H) $(TARGET_H)
+   toplev.h reload.h dwarf2out.h $(BASIC_BLOCK_H) $(TM_P_H) $(TARGET_H) $(EXPR_H)
 recog.o : recog.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) function.h $(BASIC_BLOCK_H) \
    $(REGS_H) $(RECOG_H) $(EXPR_H) hard-reg-set.h flags.h insn-config.h \
    $(INSN_ATTR_H) real.h toplev.h output.h reload.h $(TM_P_H)
index 8528abfcaa9e551c90524331845caf0eb1c53dfd..344ebbefeae8ac4371e710d98adf49b0c24379dc 100644 (file)
@@ -2107,7 +2107,7 @@ dbxout_symbol_location (decl, type, suffix, home)
          if (REGNO (value) >= FIRST_PSEUDO_REGISTER)
            return 0;
        }
-      home = alter_subreg (home);
+      home = alter_subreg (&home);
     }
   if (GET_CODE (home) == REG)
     {
index 351fe017c492e195fc349edb49ce19eb3f5c9e25..733503e942480c9497887243f8b251cf447c8ec6 100644 (file)
@@ -67,6 +67,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 #include "basic-block.h"
 #include "target.h"
 #include "debug.h"
+#include "expr.h"
 
 #ifdef XCOFF_DEBUGGING_INFO
 #include "xcoffout.h"          /* Needed for external data
@@ -242,7 +243,7 @@ static void profile_after_prologue PARAMS ((FILE *));
 static void add_bb             PARAMS ((FILE *));
 static int add_bb_string       PARAMS ((const char *, int));
 static void notice_source_line PARAMS ((rtx));
-static rtx walk_alter_subreg   PARAMS ((rtx));
+static rtx walk_alter_subreg   PARAMS ((rtx *));
 static void output_asm_name    PARAMS ((void));
 static tree get_decl_from_op   PARAMS ((rtx, int *));
 static void output_asm_operand_names PARAMS ((rtx *, int *, int));
@@ -2634,15 +2635,15 @@ final_scan_insn (insn, file, optimize, prescan, nopeepholes)
                && insn != last_ignored_compare)
              {
                if (GET_CODE (SET_SRC (set)) == SUBREG)
-                 SET_SRC (set) = alter_subreg (SET_SRC (set));
+                 SET_SRC (set) = alter_subreg (&SET_SRC (set));
                else if (GET_CODE (SET_SRC (set)) == COMPARE)
                  {
                    if (GET_CODE (XEXP (SET_SRC (set), 0)) == SUBREG)
                      XEXP (SET_SRC (set), 0)
-                       = alter_subreg (XEXP (SET_SRC (set), 0));
+                       = alter_subreg (&XEXP (SET_SRC (set), 0));
                    if (GET_CODE (XEXP (SET_SRC (set), 1)) == SUBREG)
                      XEXP (SET_SRC (set), 1)
-                       = alter_subreg (XEXP (SET_SRC (set), 1));
+                       = alter_subreg (&XEXP (SET_SRC (set), 1));
                  }
                if ((cc_status.value1 != 0
                     && rtx_equal_p (SET_SRC (set), cc_status.value1))
@@ -3004,21 +3005,21 @@ cleanup_subreg_operands (insn)
   for (i = 0; i < recog_data.n_operands; i++)
     {
       if (GET_CODE (recog_data.operand[i]) == SUBREG)
-       recog_data.operand[i] = alter_subreg (recog_data.operand[i]);
+       recog_data.operand[i] = alter_subreg (recog_data.operand_loc[i]);
       else if (GET_CODE (recog_data.operand[i]) == PLUS
               || GET_CODE (recog_data.operand[i]) == MULT
               || GET_CODE (recog_data.operand[i]) == MEM)
-       recog_data.operand[i] = walk_alter_subreg (recog_data.operand[i]);
+       recog_data.operand[i] = walk_alter_subreg (recog_data.operand_loc[i]);
     }
 
   for (i = 0; i < recog_data.n_dups; i++)
     {
       if (GET_CODE (*recog_data.dup_loc[i]) == SUBREG)
-       *recog_data.dup_loc[i] = alter_subreg (*recog_data.dup_loc[i]);
+       *recog_data.dup_loc[i] = alter_subreg (recog_data.dup_loc[i]);
       else if (GET_CODE (*recog_data.dup_loc[i]) == PLUS
               || GET_CODE (*recog_data.dup_loc[i]) == MULT
               || GET_CODE (*recog_data.dup_loc[i]) == MEM)
-       *recog_data.dup_loc[i] = walk_alter_subreg (*recog_data.dup_loc[i]);
+       *recog_data.dup_loc[i] = walk_alter_subreg (recog_data.dup_loc[i]);
     }
 }
 
@@ -3026,66 +3027,42 @@ cleanup_subreg_operands (insn)
    based on the thing it is a subreg of.  */
 
 rtx
-alter_subreg (x)
-     rtx x;
+alter_subreg (xp)
+     rtx *xp;
 {
+  rtx x = *xp;
   rtx y = SUBREG_REG (x);
 
-  if (GET_CODE (y) == SUBREG)
-    y = alter_subreg (y);
-
-  /* If reload is operating, we may be replacing inside this SUBREG.
-     Check for that and make a new one if so.  */
-  if (reload_in_progress && find_replacement (&SUBREG_REG (x)) != 0)
-    x = copy_rtx (x);
-
-  if (GET_CODE (y) == REG)
-    {
-      int regno = subreg_hard_regno (x, 1);
-
-      PUT_CODE (x, REG);
-      REGNO (x) = regno;
-      ORIGINAL_REGNO (x) = ORIGINAL_REGNO (y);
-      /* This field has a different meaning for REGs and SUBREGs.  Make sure
-        to clear it!  */
-      x->used = 0;
-    }
-  else if (GET_CODE (y) == MEM)
-    {
-      HOST_WIDE_INT offset = SUBREG_BYTE (x);
-
-      /* Catch these instead of generating incorrect code.  */
-      if ((offset % GET_MODE_SIZE (GET_MODE (x))) != 0)
-       abort ();
-
-      PUT_CODE (x, MEM);
-      MEM_COPY_ATTRIBUTES (x, y);
-      XEXP (x, 0) = plus_constant (XEXP (y, 0), offset);
-    }
-
-  return x;
+  /* simplify_subreg does not remove subreg from volatile references.
+     We are required to.  */
+  if (GET_CODE (y) == MEM)
+    *xp = adjust_address (y, GET_MODE (x), SUBREG_BYTE (x));
+  else
+    *xp = simplify_subreg (GET_MODE (x), y, GET_MODE (y), SUBREG_BYTE (x));
+  return *xp;
 }
 
 /* Do alter_subreg on all the SUBREGs contained in X.  */
 
 static rtx
-walk_alter_subreg (x)
-     rtx x;
+walk_alter_subreg (xp)
+     rtx *xp;
 {
+  rtx x = *xp;
   switch (GET_CODE (x))
     {
     case PLUS:
     case MULT:
-      XEXP (x, 0) = walk_alter_subreg (XEXP (x, 0));
-      XEXP (x, 1) = walk_alter_subreg (XEXP (x, 1));
+      XEXP (x, 0) = walk_alter_subreg (&XEXP (x, 0));
+      XEXP (x, 1) = walk_alter_subreg (&XEXP (x, 1));
       break;
 
     case MEM:
-      XEXP (x, 0) = walk_alter_subreg (XEXP (x, 0));
+      XEXP (x, 0) = walk_alter_subreg (&XEXP (x, 0));
       break;
 
     case SUBREG:
-      return alter_subreg (x);
+      return alter_subreg (xp);
 
     default:
       break;
@@ -3624,7 +3601,7 @@ output_operand (x, code)
      int code ATTRIBUTE_UNUSED;
 {
   if (x && GET_CODE (x) == SUBREG)
-    x = alter_subreg (x);
+    x = alter_subreg (&x);
 
   /* If X is a pseudo-register, abort now rather than writing trash to the
      assembler file.  */
@@ -3643,7 +3620,7 @@ void
 output_address (x)
      rtx x;
 {
-  walk_alter_subreg (x);
+  walk_alter_subreg (&x);
   PRINT_OPERAND_ADDRESS (asm_out_file, x);
 }
 \f
index dc2a6983d35e0d9cdbf36b7b276e6429cb40fa1b..793798809ca8bcabf7c31331609b5411afa0295e 100644 (file)
@@ -77,7 +77,7 @@ extern rtx final_scan_insn    PARAMS ((rtx, FILE *, int, int, int));
 
 /* Replace a SUBREG with a REG or a MEM, based on the thing it is a
    subreg of.  */
-extern rtx alter_subreg PARAMS ((rtx));
+extern rtx alter_subreg PARAMS ((rtx *));
 
 /* Report inconsistency between the assembler template and the operands.
    In an `asm', it's the user's fault; otherwise, the compiler's fault.  */
index 8a6ea31ab79f8b317f61be39f367f14976c83792..ab0a0d89849c19a32251b7ad4fc9b27984011f3d 100644 (file)
@@ -809,7 +809,7 @@ sdbout_symbol (decl, local)
              if (REGNO (value) >= FIRST_PSEUDO_REGISTER)
                return;
            }
-         regno = REGNO (alter_subreg (DECL_RTL (decl)));
+         regno = REGNO (alter_subreg (&DECL_RTL (decl)));
          value = DECL_RTL (decl);
        }
       /* Don't output anything if an auto variable
index 9f50ed9459fbe8d3f5d5b14564fa7cfc60c76f17..0f11556251d3dd515b5946bda3850e73809e78a6 100644 (file)
@@ -2587,7 +2587,18 @@ simplify_subreg (outermode, op, innermode, byte)
         arguments are passed on 32-bit Sparc and should be fixed.  */
       if (HARD_REGNO_MODE_OK (final_regno, outermode)
          || ! HARD_REGNO_MODE_OK (REGNO (op), innermode))
-       return gen_rtx_REG (outermode, final_regno);
+       {
+         rtx x = gen_rtx_REG (outermode, final_regno);
+
+         /* Propagate original regno.  We don't have any way to specify
+            the offset inside orignal regno, so do so only for lowpart.
+            The information is used only by alias analysis that can not
+            grog partial register anyway.  */
+
+         if (subreg_lowpart_offset (outermode, innermode) == byte)
+           ORIGINAL_REGNO (x) = ORIGINAL_REGNO (op);
+         return x;
+       }
     }
 
   /* If we have a SUBREG of a register that we are replacing and we are