aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKazu Hirata <kazu@cs.umass.edu>2003-06-16 13:03:42 +0000
committerKazu Hirata <kazu@gcc.gnu.org>2003-06-16 13:03:42 +0000
commit08dca707dac5ecd13eb4c3db47907b39c940cba9 (patch)
treeab39358bb34a42c0b238f5314ada7e40b82c8595
parent82d397c79441ac025ab58fb8a5163f45dbcf4523 (diff)
downloadgcc-08dca707dac5ecd13eb4c3db47907b39c940cba9.zip
gcc-08dca707dac5ecd13eb4c3db47907b39c940cba9.tar.gz
gcc-08dca707dac5ecd13eb4c3db47907b39c940cba9.tar.bz2
h8300.c (const_costs): Move this to ...
* config/h8300/h8300.c (const_costs): Move this to ... (h8300_rtx_costs): ... here. From-SVN: r68014
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/config/h8300/h8300.c92
2 files changed, 46 insertions, 51 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 0cd54a0..bd5a998 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2003-06-16 Kazu Hirata <kazu@cs.umass.edu>
+
+ * config/h8300/h8300.c (const_costs): Move this to ...
+ (h8300_rtx_costs): ... here.
+
2003-06-16 Roger Sayle <roger@eyesopen.com>
* optabs.h (enum optab_index): Add new OTI_tan and OTI_atan.
diff --git a/gcc/config/h8300/h8300.c b/gcc/config/h8300/h8300.c
index 7e697f4..7c508f4 100644
--- a/gcc/config/h8300/h8300.c
+++ b/gcc/config/h8300/h8300.c
@@ -68,7 +68,6 @@ static void h8300_file_end PARAMS ((void));
static void h8300_asm_named_section PARAMS ((const char *, unsigned int));
#endif
static void h8300_encode_section_info PARAMS ((tree, rtx, int));
-static int const_costs PARAMS ((rtx, enum rtx_code, enum rtx_code));
static int h8300_and_costs PARAMS ((rtx));
static int h8300_shift_costs PARAMS ((rtx));
static bool h8300_rtx_costs PARAMS ((rtx, int, int, int *));
@@ -1090,55 +1089,6 @@ function_arg (cum, mode, type, named)
return result;
}
-/* Return the cost of the rtx R with code CODE. */
-
-static int
-const_costs (r, c, outer_code)
- rtx r;
- enum rtx_code c;
- enum rtx_code outer_code;
-{
- switch (c)
- {
- case CONST_INT:
- {
- HOST_WIDE_INT n = INTVAL (r);
-
- if (-4 <= n || n <= 4)
- {
- switch ((int) n)
- {
- case 0:
- return 0;
- case 1:
- case 2:
- case -1:
- case -2:
- return 0 + (outer_code == SET);
- case 4:
- case -4:
- if (TARGET_H8300H || TARGET_H8300S)
- return 0 + (outer_code == SET);
- else
- return 1;
- }
- }
- return 1;
- }
-
- case CONST:
- case LABEL_REF:
- case SYMBOL_REF:
- return 3;
-
- case CONST_DOUBLE:
- return 20;
-
- default:
- return 4;
- }
-}
-
static int
h8300_and_costs (x)
rtx x;
@@ -1185,6 +1135,46 @@ h8300_rtx_costs (x, code, outer_code, total)
{
switch (code)
{
+ case CONST_INT:
+ {
+ HOST_WIDE_INT n = INTVAL (x);
+
+ if (-4 <= n || n <= 4)
+ {
+ switch ((int) n)
+ {
+ case 0:
+ *total = 0;
+ return true;
+ case 1:
+ case 2:
+ case -1:
+ case -2:
+ *total = 0 + (outer_code == SET);
+ return true;
+ case 4:
+ case -4:
+ if (TARGET_H8300H || TARGET_H8300S)
+ *total = 0 + (outer_code == SET);
+ else
+ *total = 1;
+ return true;
+ }
+ }
+ *total = 1;
+ return true;
+ }
+
+ case CONST:
+ case LABEL_REF:
+ case SYMBOL_REF:
+ *total = 3;
+ return true;
+
+ case CONST_DOUBLE:
+ *total = 20;
+ return true;
+
case AND:
*total = COSTS_N_INSNS (h8300_and_costs (x));
return true;
@@ -1215,7 +1205,7 @@ h8300_rtx_costs (x, code, outer_code, total)
return true;
default:
- *total = const_costs (x, code, outer_code);
+ *total = 4;
return true;
}
}