OSDN Git Service

* config/xtensa/xtensa.h (REGISTER_MOVE_COST, MEMORY_MOVE_COST):
authoraesok <aesok@138bc75d-0d04-0410-961f-82ee72b054a4>
Sat, 12 Feb 2011 12:21:54 +0000 (12:21 +0000)
committeraesok <aesok@138bc75d-0d04-0410-961f-82ee72b054a4>
Sat, 12 Feb 2011 12:21:54 +0000 (12:21 +0000)
Remove macros.
* config/xtensa/xtensa.c (xtensa_register_move_cost,
xtensa_memory_move_cost): New functions.
(TARGET_REGISTER_MOVE_COST, TARGET_REGISTER_MOVE_COST): Define.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@170071 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/config/xtensa/xtensa.c
gcc/config/xtensa/xtensa.h

index 143264b..ec8f19c 100644 (file)
@@ -1,3 +1,11 @@
+2011-02-12  Anatoly Sokolov  <aesok@post.ru>
+
+       * config/xtensa/xtensa.h (REGISTER_MOVE_COST, MEMORY_MOVE_COST):
+       Remove macros.
+       * config/xtensa/xtensa.c (xtensa_register_move_cost,
+       xtensa_memory_move_cost): New functions.
+       (TARGET_REGISTER_MOVE_COST, TARGET_REGISTER_MOVE_COST): Define.
+
 2011-02-12  Alexandre Oliva  <aoliva@redhat.com>
 
        PR lto/47225
index b1ea5bd..e7c395b 100644 (file)
@@ -137,6 +137,9 @@ static unsigned int xtensa_multibss_section_type_flags (tree, const char *,
 static section *xtensa_select_rtx_section (enum machine_mode, rtx,
                                           unsigned HOST_WIDE_INT);
 static bool xtensa_rtx_costs (rtx, int, int, int *, bool);
+static int xtensa_register_move_cost (enum machine_mode, reg_class_t,
+                                     reg_class_t);
+static int xtensa_memory_move_cost (enum machine_mode, reg_class_t, bool);
 static tree xtensa_build_builtin_va_list (void);
 static bool xtensa_return_in_memory (const_tree, const_tree);
 static tree xtensa_gimplify_va_arg_expr (tree, tree, gimple_seq *,
@@ -213,6 +216,10 @@ static const struct default_options xtensa_option_optimization_table[] =
 #undef TARGET_MODE_DEPENDENT_ADDRESS_P
 #define TARGET_MODE_DEPENDENT_ADDRESS_P xtensa_mode_dependent_address_p
 
+#undef TARGET_REGISTER_MOVE_COST
+#define TARGET_REGISTER_MOVE_COST xtensa_register_move_cost
+#undef TARGET_MEMORY_MOVE_COST
+#define TARGET_MEMORY_MOVE_COST xtensa_memory_move_cost
 #undef TARGET_RTX_COSTS
 #define TARGET_RTX_COSTS xtensa_rtx_costs
 #undef TARGET_ADDRESS_COST
@@ -3307,6 +3314,34 @@ xtensa_select_rtx_section (enum machine_mode mode ATTRIBUTE_UNUSED,
   return function_section (current_function_decl);
 }
 
+/* Worker function for TARGET_REGISTER_MOVE_COST.  */
+
+static int
+xtensa_register_move_cost (enum machine_mode mode ATTRIBUTE_UNUSED,
+                          reg_class_t from, reg_class_t to)
+{
+  if (from == to && from != BR_REGS && to != BR_REGS)
+    return 2;
+  else if (reg_class_subset_p (from, AR_REGS)
+          && reg_class_subset_p (to, AR_REGS))
+    return 2;
+  else if (reg_class_subset_p (from, AR_REGS) && to == ACC_REG)
+    return 3;
+  else if (from == ACC_REG && reg_class_subset_p (to, AR_REGS))
+    return 3;
+  else
+    return 10;
+}
+
+/* Worker function for TARGET_MEMORY_MOVE_COST.  */
+
+static int
+xtensa_memory_move_cost (enum machine_mode mode ATTRIBUTE_UNUSED,
+                        reg_class_t rclass ATTRIBUTE_UNUSED,
+                        bool in ATTRIBUTE_UNUSED)
+{
+  return 4;
+}
 
 /* Compute a (partial) cost for rtx X.  Return true if the complete
    cost has been computed, and false if subexpressions should be
index 098855b..0a096cd 100644 (file)
@@ -723,26 +723,6 @@ typedef struct xtensa_args
    indexing purposes) so give the MEM rtx a words's mode.  */
 #define FUNCTION_MODE SImode
 
-/* A C expression for the cost of moving data from a register in
-   class FROM to one in class TO.  The classes are expressed using
-   the enumeration values such as 'GENERAL_REGS'.  A value of 2 is
-   the default; other values are interpreted relative to that.  */
-#define REGISTER_MOVE_COST(MODE, FROM, TO)                             \
-  (((FROM) == (TO) && (FROM) != BR_REGS && (TO) != BR_REGS)            \
-   ? 2                                                                 \
-   : (reg_class_subset_p ((FROM), AR_REGS)                             \
-      && reg_class_subset_p ((TO), AR_REGS)                            \
-      ? 2                                                              \
-      : (reg_class_subset_p ((FROM), AR_REGS)                          \
-        && (TO) == ACC_REG                                             \
-        ? 3                                                            \
-        : ((FROM) == ACC_REG                                           \
-           && reg_class_subset_p ((TO), AR_REGS)                       \
-           ? 3                                                         \
-           : 10))))
-
-#define MEMORY_MOVE_COST(MODE, CLASS, IN) 4
-
 #define BRANCH_COST(speed_p, predictable_p) 3
 
 /* How to refer to registers in assembler output.