------- Comment #1 from vmakarov at redhat dot com  2009-03-11 16:57 -------
Jakub, how is about the following patch.  Is it ok for you?  I mean correct
user variable identification.

2009-03-11  Vladimir Makarov  <vmaka...@redhat.com>

        PR debug/39432
        * ira-int.h (struct allocno): Fix comment for calls_crossed_num.
        * ira-conflicts.c (ira_build_conflicts): Prohibit call used
        registers for allocnos created from user-defined variables.

Index: ira-int.h
===================================================================
--- ira-int.h   (revision 144543)
+++ ira-int.h   (working copy)
@@ -333,7 +333,7 @@ struct ira_allocno
   /* Accumulated frequency of calls which given allocno
      intersects.  */
   int call_freq;
-  /* Length of the previous array (number of the intersected calls).  */
+  /* Accumulated number of the intersected calls.  */
   int calls_crossed_num;
   /* Non NULL if we remove restoring value from given allocno to
      MEM_OPTIMIZED_DEST at loop exit (see ira-emit.c) because the
Index: ira-conflicts.c
===================================================================
--- ira-conflicts.c     (revision 144543)
+++ ira-conflicts.c     (working copy)
@@ -800,29 +800,33 @@ ira_build_conflicts (void)
     }
   FOR_EACH_ALLOCNO (a, ai)
     {
-      if (ALLOCNO_CALLS_CROSSED_NUM (a) == 0)
-       continue;
-      if (! flag_caller_saves)
+      reg_attrs *attrs;
+      tree decl;
+
+      if ((! flag_caller_saves && ALLOCNO_CALLS_CROSSED_NUM (a) != 0)
+         /* For debugging purposes don't put user defined variables in
+            callee-clobbered registers.  */
+         || (optimize <= 1
+             && (attrs = REG_ATTRS (regno_reg_rtx [ALLOCNO_REGNO (a)])) !=
NULL
+             && (decl = attrs->decl) != NULL
+             && VAR_OR_FUNCTION_DECL_P (decl)
+             && DECL_NAME (decl) != NULL))
        {
          IOR_HARD_REG_SET (ALLOCNO_TOTAL_CONFLICT_HARD_REGS (a),
                            call_used_reg_set);
-         if (ALLOCNO_CALLS_CROSSED_NUM (a) != 0)
-           IOR_HARD_REG_SET (ALLOCNO_CONFLICT_HARD_REGS (a),
-                             call_used_reg_set);
+         IOR_HARD_REG_SET (ALLOCNO_CONFLICT_HARD_REGS (a),
+                           call_used_reg_set);
        }
-      else
+      else if (ALLOCNO_CALLS_CROSSED_NUM (a) != 0)
        {
          IOR_HARD_REG_SET (ALLOCNO_TOTAL_CONFLICT_HARD_REGS (a),
                            no_caller_save_reg_set);
          IOR_HARD_REG_SET (ALLOCNO_TOTAL_CONFLICT_HARD_REGS (a),
                            temp_hard_reg_set);
-         if (ALLOCNO_CALLS_CROSSED_NUM (a) != 0)
-           {
-             IOR_HARD_REG_SET (ALLOCNO_CONFLICT_HARD_REGS (a),
-                               no_caller_save_reg_set);
-             IOR_HARD_REG_SET (ALLOCNO_CONFLICT_HARD_REGS (a),
-                               temp_hard_reg_set);
-           }
+         IOR_HARD_REG_SET (ALLOCNO_CONFLICT_HARD_REGS (a),
+                           no_caller_save_reg_set);
+         IOR_HARD_REG_SET (ALLOCNO_CONFLICT_HARD_REGS (a),
+                           temp_hard_reg_set);
        }
     }
   if (optimize && ira_conflicts_p




-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39432

Reply via email to