]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
PR middle_end/34150
authorJohn David Anglin <dave.anglin@nrc-cnrc.gc.ca>
Sat, 9 Feb 2008 20:42:17 +0000 (20:42 +0000)
committerJohn David Anglin <danglin@gcc.gnu.org>
Sat, 9 Feb 2008 20:42:17 +0000 (20:42 +0000)
* pa.c (legitimize_pic_address): Add REG_EQUAL note on sets with a
pic_label_operand source.  Similarly, add a REG_LABEL note and
update LABEL_NUSES during and after reload.

From-SVN: r132204

gcc/ChangeLog
gcc/config/pa/pa.c

index 70cfb01f1681408f37e31ca539c29397278bfad5..c91473c67e62857107472dd75495b01b35db75c0 100644 (file)
@@ -1,3 +1,10 @@
+2008-02-09  John David Anglin  <dave.anglin@nrc-cnrc.gc.ca>
+
+       PR middle_end/34150
+       * pa.c (legitimize_pic_address): Add REG_EQUAL note on sets with a
+       pic_label_operand source.  Similarly, add a REG_LABEL note and
+       update LABEL_NUSES during and after reload.
+
 2008-02-08  Steven Bosscher  <stevenb.gcc@gmail.com>
 
        PR middle-end/34627
index ffe96145754fbafeb6d9e707560e4ee1cd7354ec..5d3689cad3cd84082de33f435e70c99a5d10b0b7 100644 (file)
@@ -626,6 +626,8 @@ legitimize_pic_address (rtx orig, enum machine_mode mode, rtx reg)
   /* Labels need special handling.  */
   if (pic_label_operand (orig, mode))
     {
+      rtx insn;
+
       /* We do not want to go through the movXX expanders here since that
         would create recursion.
 
@@ -636,7 +638,24 @@ legitimize_pic_address (rtx orig, enum machine_mode mode, rtx reg)
         So instead we just emit the raw set, which avoids the movXX
         expanders completely.  */
       mark_reg_pointer (reg, BITS_PER_UNIT);
-      emit_insn (gen_rtx_SET (VOIDmode, reg, orig));
+      insn = emit_insn (gen_rtx_SET (VOIDmode, reg, orig));
+
+      /* Put a REG_EQUAL note on this insn, so that it can be optimized.  */
+      REG_NOTES (insn) = gen_rtx_EXPR_LIST (REG_EQUAL, orig, REG_NOTES (insn));
+
+      /* During and after reload, we need to generate a REG_LABEL note and
+        update LABEL_NUSES because this is not done automatically.  */
+      if (reload_in_progress || reload_completed)
+       {
+         /* Extract LABEL_REF.  */
+         if (GET_CODE (orig) == CONST)
+           orig = XEXP (XEXP (orig, 0), 0);
+         /* Extract CODE_LABEL.  */
+         orig = XEXP (orig, 0);
+         REG_NOTES (insn) = gen_rtx_INSN_LIST (REG_LABEL, orig,
+                                               REG_NOTES (insn));
+         LABEL_NUSES (orig)++;
+       }
       current_function_uses_pic_offset_table = 1;
       return reg;
     }