]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - gcc/config/i386/i386.c
Merge dataflow branch into mainline
[thirdparty/gcc.git] / gcc / config / i386 / i386.c
index f8019bde0f907dfd211ae15df7fe2f476fa210eb..61a24eedadee57fa467a32cd29e1f09932930793 100644 (file)
@@ -49,6 +49,7 @@ Boston, MA 02110-1301, USA.  */
 #include "cgraph.h"
 #include "tree-gimple.h"
 #include "dwarf2.h"
+#include "df.h"
 #include "tm-constrs.h"
 #include "params.h"
 
@@ -3014,7 +3015,7 @@ ix86_eax_live_at_start_p (void)
      to correct at this point.  This gives false positives for broken
      functions that might use uninitialized data that happens to be
      allocated in eax, but who cares?  */
-  return REGNO_REG_SET_P (ENTRY_BLOCK_PTR->il.rtl->global_live_at_end, 0);
+  return REGNO_REG_SET_P (DF_LIVE_OUT (ENTRY_BLOCK_PTR), 0);
 }
 
 /* Return true if TYPE has a variable argument list.  */
@@ -5580,7 +5581,7 @@ ix86_select_alt_pic_regnum (void)
     {
       int i;
       for (i = 2; i >= 0; --i)
-        if (!regs_ever_live[i])
+        if (!df_regs_ever_live_p (i))
          return i;
     }
 
@@ -5593,7 +5594,7 @@ ix86_save_reg (unsigned int regno, int maybe_eh_return)
 {
   if (pic_offset_table_rtx
       && regno == REAL_PIC_OFFSET_TABLE_REGNUM
-      && (regs_ever_live[REAL_PIC_OFFSET_TABLE_REGNUM]
+      && (df_regs_ever_live_p (REAL_PIC_OFFSET_TABLE_REGNUM)
          || current_function_profile
          || current_function_calls_eh_return
          || current_function_uses_const_pool))
@@ -5620,7 +5621,7 @@ ix86_save_reg (unsigned int regno, int maybe_eh_return)
       && regno == REGNO (cfun->machine->force_align_arg_pointer))
     return 1;
 
-  return (regs_ever_live[regno]
+  return (df_regs_ever_live_p (regno)
          && !call_used_regs[regno]
          && !fixed_regs[regno]
          && (regno != HARD_FRAME_POINTER_REGNUM || !frame_pointer_needed));
@@ -6106,13 +6107,13 @@ ix86_expand_prologue (void)
 
   pic_reg_used = false;
   if (pic_offset_table_rtx
-      && (regs_ever_live[REAL_PIC_OFFSET_TABLE_REGNUM]
+      && (df_regs_ever_live_p (REAL_PIC_OFFSET_TABLE_REGNUM)
          || current_function_profile))
     {
       unsigned int alt_pic_reg_used = ix86_select_alt_pic_regnum ();
 
       if (alt_pic_reg_used != INVALID_REGNUM)
-       REGNO (pic_offset_table_rtx) = alt_pic_reg_used;
+       SET_REGNO (pic_offset_table_rtx, alt_pic_reg_used);
 
       pic_reg_used = true;
     }
@@ -6130,9 +6131,7 @@ ix86_expand_prologue (void)
              LABEL_PRESERVE_P (label) = 1;
              gcc_assert (REGNO (pic_offset_table_rtx) != REGNO (tmp_reg));
              insn = emit_insn (gen_set_rip_rex64 (pic_offset_table_rtx, label));
-              REG_NOTES (insn) = gen_rtx_EXPR_LIST (REG_MAYBE_DEAD, const0_rtx, NULL);
              insn = emit_insn (gen_set_got_offset_rex64 (tmp_reg, label));
-              REG_NOTES (insn) = gen_rtx_EXPR_LIST (REG_MAYBE_DEAD, const0_rtx, NULL);
              insn = emit_insn (gen_adddi3 (pic_offset_table_rtx,
                                            pic_offset_table_rtx, tmp_reg));
            }
@@ -6141,20 +6140,16 @@ ix86_expand_prologue (void)
        }
       else
         insn = emit_insn (gen_set_got (pic_offset_table_rtx));
-
-      /* Even with accurate pre-reload life analysis, we can wind up
-        deleting all references to the pic register after reload.
-        Consider if cross-jumping unifies two sides of a branch
-        controlled by a comparison vs the only read from a global.
-        In which case, allow the set_got to be deleted, though we're
-        too late to do anything about the ebx save in the prologue.  */
-      REG_NOTES (insn) = gen_rtx_EXPR_LIST (REG_MAYBE_DEAD, const0_rtx, NULL);
     }
 
   /* Prevent function calls from be scheduled before the call to mcount.
      In the pic_reg_used case, make sure that the got load isn't deleted.  */
   if (current_function_profile)
-    emit_insn (gen_blockage (pic_reg_used ? pic_offset_table_rtx : const0_rtx));
+    {
+      if (pic_reg_used)
+       emit_insn (gen_prologue_use (pic_offset_table_rtx));
+      emit_insn (gen_blockage ());
+    }
 }
 
 /* Emit code to restore saved registers using MOV insns.  First register
@@ -6366,7 +6361,7 @@ ix86_output_function_epilogue (FILE *file ATTRIBUTE_UNUSED,
                               HOST_WIDE_INT size ATTRIBUTE_UNUSED)
 {
   if (pic_offset_table_rtx)
-    REGNO (pic_offset_table_rtx) = REAL_PIC_OFFSET_TABLE_REGNUM;
+    SET_REGNO (pic_offset_table_rtx, REAL_PIC_OFFSET_TABLE_REGNUM);
 #if TARGET_MACHO
   /* Mach-O doesn't support labels at the end of objects, so if
      it looks like we might want one, insert a NOP.  */
@@ -7193,7 +7188,7 @@ legitimize_pic_address (rtx orig, rtx reg)
         base address (@GOTOFF).  */
 
       if (reload_in_progress)
-       regs_ever_live[PIC_OFFSET_TABLE_REGNUM] = 1;
+       df_set_regs_ever_live (PIC_OFFSET_TABLE_REGNUM, true);
       if (GET_CODE (addr) == CONST)
        addr = XEXP (addr, 0);
       if (GET_CODE (addr) == PLUS)
@@ -7225,7 +7220,7 @@ legitimize_pic_address (rtx orig, rtx reg)
         base address (@GOTOFF).  */
 
       if (reload_in_progress)
-       regs_ever_live[PIC_OFFSET_TABLE_REGNUM] = 1;
+       df_set_regs_ever_live (PIC_OFFSET_TABLE_REGNUM, true);
       if (GET_CODE (addr) == CONST)
        addr = XEXP (addr, 0);
       if (GET_CODE (addr) == PLUS)
@@ -7276,7 +7271,7 @@ legitimize_pic_address (rtx orig, rtx reg)
             Global Offset Table (@GOT).  */
 
          if (reload_in_progress)
-           regs_ever_live[PIC_OFFSET_TABLE_REGNUM] = 1;
+           df_set_regs_ever_live (PIC_OFFSET_TABLE_REGNUM, true);
          new_rtx = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, addr), UNSPEC_GOT);
          new_rtx = gen_rtx_CONST (Pmode, new_rtx);
          if (TARGET_64BIT)
@@ -7329,7 +7324,7 @@ legitimize_pic_address (rtx orig, rtx reg)
              if (!TARGET_64BIT)
                {
                  if (reload_in_progress)
-                   regs_ever_live[PIC_OFFSET_TABLE_REGNUM] = 1;
+                   df_set_regs_ever_live (PIC_OFFSET_TABLE_REGNUM, true);
                  new_rtx = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, op0),
                                            UNSPEC_GOTOFF);
                  new_rtx = gen_rtx_PLUS (Pmode, new_rtx, op1);
@@ -7489,7 +7484,7 @@ legitimize_tls_address (rtx x, enum tls_model model, int for_mov)
       else if (flag_pic)
        {
          if (reload_in_progress)
-           regs_ever_live[PIC_OFFSET_TABLE_REGNUM] = 1;
+           df_set_regs_ever_live (PIC_OFFSET_TABLE_REGNUM, true);
          pic = pic_offset_table_rtx;
          type = TARGET_ANY_GNU_TLS ? UNSPEC_GOTNTPOFF : UNSPEC_GOTTPOFF;
        }