summaryrefslogtreecommitdiffhomepage
path: root/ir/be/bera.h
diff options
context:
space:
mode:
authorMatthias Braun <matze@braunis.de>2015-06-19 07:15:54 +0200
committerMatthias Braun <matze@braunis.de>2015-06-19 07:17:53 +0200
commitf1d0154c8a329e88394f24c39093f6566714d493 (patch)
tree50ba2c4f3a8adf629d8f0f6cde17d37c23915f99 /ir/be/bera.h
parent89a5cac65f5e45b405217c7dc167eb2b27ed2206 (diff)
break arch_isa_if_t furhter apart by moving spilling related callbacks into an own struct
Diffstat (limited to 'ir/be/bera.h')
-rw-r--r--ir/be/bera.h37
1 files changed, 32 insertions, 5 deletions
diff --git a/ir/be/bera.h b/ir/be/bera.h
index ee107fb..f1d0779 100644
--- a/ir/be/bera.h
+++ b/ir/be/bera.h
@@ -13,16 +13,43 @@
#define FIRM_BE_BERA_H
#include "firm_types.h"
+#include "be_types.h"
-typedef struct be_ra_t {
- void (*allocate)(ir_graph *irg); /**< allocate registers on a graph */
-} be_ra_t;
+struct regalloc_if_t {
+ unsigned spill_cost; /**< cost for a spill node */
+ unsigned reload_cost; /**< cost for a reload node */
-void be_register_allocator(const char *name, be_ra_t *allocator);
+ /** mark node as rematerialized */
+ void (*mark_remat)(ir_node *node);
+
+ /**
+ * Create a spill instruction. We assume that spill instructions do not need
+ * any additional registers and do not affect cpu-flags in any way.
+ * Construct a sequence of instructions after @p after (the resulting nodes
+ * are already scheduled).
+ * Returns a mode_M value which is used as input for a reload instruction.
+ */
+ ir_node *(*new_spill)(ir_node *value, ir_node *after);
+
+ /**
+ * Create a reload instruction. We assume that reload instructions do not
+ * need any additional registers and do not affect cpu-flags in any way.
+ * Constructs a sequence of instruction before @p before (the resulting
+ * nodes are already scheduled). A rewiring of users is not performed in
+ * this function.
+ * Returns a value representing the restored value.
+ */
+ ir_node *(*new_reload)(ir_node *value, ir_node *spilled_value,
+ ir_node *before);
+};
/**
* Do register allocation with currently selected register allocator
*/
-void be_allocate_registers(ir_graph *irg);
+void be_allocate_registers(ir_graph *irg, const regalloc_if_t *regif);
+
+typedef void (*allocate_func)(ir_graph *irg, const regalloc_if_t *regif);
+
+void be_register_allocator(const char *name, allocate_func allocator);
#endif