OSDN Git Service

* src/x86/win32.S (_ffi_closure_STDCALL): New function.
[pf3gnuchains/gcc-fork.git] / gcc / ira-conflicts.c
index 244d3bc..bc0c0ac 100644 (file)
@@ -1,5 +1,5 @@
 /* IRA conflict builder.
-   Copyright (C) 2006, 2007, 2008
+   Copyright (C) 2006, 2007, 2008, 2009
    Free Software Foundation, Inc.
    Contributed by Vladimir Makarov <vmakarov@redhat.com>.
 
@@ -37,6 +37,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "df.h"
 #include "sparseset.h"
 #include "ira-int.h"
+#include "addresses.h"
 
 /* This file contains code responsible for allocno conflict creation,
    allocno copy creation and allocno info accumulation on upper level
@@ -247,12 +248,10 @@ get_dup_num (int op_num, bool use_commut_op_p)
            break;
 
          case 'p':
-           GO_IF_LEGITIMATE_ADDRESS (VOIDmode, op, win_p);
+           if (address_operand (op, VOIDmode))
+             return -1;
            break;
-           
-         win_p:
-           return -1;
-         
+
          case 'g':
            return -1;
            
@@ -410,9 +409,9 @@ process_regs_for_copy (rtx reg1, rtx reg2, bool constraint_p,
     /* Can not be tied.  It is not in the cover class.  */
     return false;
   if (HARD_REGISTER_P (reg1))
-    cost = ira_register_move_cost[mode][cover_class][rclass] * freq;
+    cost = ira_get_register_move_cost (mode, cover_class, rclass) * freq;
   else
-    cost = ira_register_move_cost[mode][rclass][cover_class] * freq;
+    cost = ira_get_register_move_cost (mode, rclass, cover_class) * freq;
   for (;;)
     {
       ira_allocate_and_set_costs
@@ -490,7 +489,7 @@ add_insn_allocno_copies (rtx insn)
                                ? operand : SUBREG_REG (operand)) != NULL_RTX)
            {
              str = recog_data.constraints[i];
-             while (*str == ' ' && *str == '\t')
+             while (*str == ' ' || *str == '\t')
                str++;
              bound_p = false;
              for (j = 0, commut_p = false; j < 2; j++, commut_p = true)
@@ -788,40 +787,44 @@ ira_build_conflicts (void)
          ira_free (conflicts);
        }
     }
-  if (! CLASS_LIKELY_SPILLED_P (BASE_REG_CLASS))
+  if (! CLASS_LIKELY_SPILLED_P (base_reg_class (VOIDmode, ADDRESS, SCRATCH)))
     CLEAR_HARD_REG_SET (temp_hard_reg_set);
   else
     {
       COPY_HARD_REG_SET (temp_hard_reg_set,
-                        reg_class_contents[BASE_REG_CLASS]);
+                        reg_class_contents[base_reg_class (VOIDmode, ADDRESS, SCRATCH)]);
       AND_COMPL_HARD_REG_SET (temp_hard_reg_set, ira_no_alloc_regs);
       AND_HARD_REG_SET (temp_hard_reg_set, call_used_reg_set);
     }
   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 == 0
+             && (attrs = REG_ATTRS (regno_reg_rtx [ALLOCNO_REGNO (a)])) != NULL
+             && (decl = attrs->decl) != NULL
+             && VAR_OR_FUNCTION_DECL_P (decl)
+             && ! DECL_ARTIFICIAL (decl)))
        {
          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