Hi,
The rtx_costs implementation in the ARM backend dumps the partial
or total computed cost of an insn as it goes along. This
functionality proves useful when debugging aarch64_rtx_costs,
so we should port it across.
Tested on aarch64-none-elf in series with no issues.
OK for stage 1?
Thanks,
James
---
2014-03-27 James Greenhalgh <[email protected]>
* config/aarch64/aarch64.c (aarch64_rtx_costs_wrapper): New.
(TARGET_RTX_COSTS): Call it.
diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
index 8c261ca..1d19ed3 100644
--- a/gcc/config/aarch64/aarch64.c
+++ b/gcc/config/aarch64/aarch64.c
@@ -63,6 +63,7 @@
#include "cfgloop.h"
#include "tree-vectorizer.h"
#include "config/arm/aarch-cost-tables.h"
+#include "dumpfile.h"
/* Defined for convenience. */
#define POINTER_BYTES (POINTER_SIZE / BITS_PER_UNIT)
@@ -4978,6 +4979,26 @@ aarch64_rtx_costs (rtx x, int code, int outer ATTRIBUTE_UNUSED,
return false;
}
+/* Wrapper around aarch64_rtx_costs, dumps the partial, or total cost
+ calculated for X. This cost is stored in *COST. Returns true
+ if the total cost of X was calculated. */
+static bool
+aarch64_rtx_costs_wrapper (rtx x, int code, int outer,
+ int param, int *cost, bool speed)
+{
+ bool result = aarch64_rtx_costs (x, code, outer, param, cost, speed);
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ print_rtl_single (dump_file, x);
+ fprintf (dump_file, "\n%s cost: %d (%s)\n",
+ speed ? "Hot" : "Cold",
+ *cost, result ? "final" : "partial");
+ }
+
+ return result;
+}
+
static int
aarch64_register_move_cost (enum machine_mode mode ATTRIBUTE_UNUSED,
reg_class_t from, reg_class_t to)