This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Fix PR44281 (bad RA with global regs)


On 04/27/2016 10:59 PM, Jeff Law wrote:
    PR rtl-optimization/44281
    * hard-reg-set.h (struct target_hard_regs): New field
    x_fixed_nonglobal_reg_set.
    (fixed_nonglobal_reg_set): New macro.
    * reginfo.c (init_reg_sets_1): Initialize it.
    * ira.c (setup_alloc_regs): Use fixed_nonglobal_reg_set instead
    of fixed_reg_set.

    PR rtl-optimization/44281
    * gcc.target/i386/pr44281.c: New test.
So  my recollection of where we left things was that we needed to
dataflow information fixed for implicit uses/sets in asms.  With that
infrastructure in place I think we'll be ready to resolve this old
issue.  Right?

Yeah. I had prepared the following, and I was planning on getting around to retesting it with current trunk on top of the other patch, but I haven't quite got there yet.


Bernd

Index: gcc/df-scan.c
===================================================================
--- gcc/df-scan.c       (revision 234341)
+++ gcc/df-scan.c       (working copy)
@@ -3223,11 +3223,22 @@ df_insn_refs_collect (struct df_collecti
         }
     }

+  int flags = (is_cond_exec) ? DF_REF_CONDITIONAL : 0;
   /* For CALL_INSNs, first record DF_REF_BASE register defs, as well as
      uses from CALL_INSN_FUNCTION_USAGE. */
   if (CALL_P (insn_info->insn))
-    df_get_call_refs (collection_rec, bb, insn_info,
-                     (is_cond_exec) ? DF_REF_CONDITIONAL : 0);
+    df_get_call_refs (collection_rec, bb, insn_info, flags);
+
+  if (asm_noperands (PATTERN (insn_info->insn)) >= 0)
+    for (unsigned i = 0; i < FIRST_PSEUDO_REGISTER; i++)
+      if (global_regs[i])
+       {
+         /* As with calls, asm statements reference all global regs. */
+         df_ref_record (DF_REF_BASE, collection_rec, regno_reg_rtx[i],
+                        NULL, bb, insn_info, DF_REF_REG_USE, flags);
+         df_ref_record (DF_REF_BASE, collection_rec, regno_reg_rtx[i],
+                        NULL, bb, insn_info, DF_REF_REG_DEF, flags);
+       }

   /* Record other defs.  These should be mostly for DF_REF_REGULAR, so
      that a qsort on the defs is unnecessary in most cases.  */


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]