start register allocator again, fix typo
[libfirm] / ir / be / TEMPLATE / bearch_TEMPLATE.c
index c75080f..08f77cb 100644 (file)
@@ -21,6 +21,7 @@
 #include "../besched_t.h"
 #include "../be.h"
 #include "../beabi.h"
+#include "../bemodule.h"
 
 #include "bearch_TEMPLATE_t.h"
 
@@ -210,14 +211,22 @@ static entity *TEMPLATE_get_frame_entity(const void *self, const ir_node *irn) {
        return NULL;
 }
 
+static void TEMPLATE_set_frame_entity(const void *self, const ir_node *irn, entity *ent) {
+       /* TODO: set the entity assigned to the frame */
+}
+
 /**
  * This function is called by the generic backend to correct offsets for
  * nodes accessing the stack.
  */
-static void TEMPLATE_set_stack_bias(const void *self, ir_node *irn, int bias) {
+static void TEMPLATE_set_frame_offset(const void *self, ir_node *irn, int offset) {
        /* TODO: correct offset if irn accesses the stack */
 }
 
+static int TEMPLATE_get_sp_bias(const void *self, const ir_node *irn) {
+       return 0;
+}
+
 /* fill register allocator interface */
 
 static const arch_irn_ops_if_t TEMPLATE_irn_ops_if = {
@@ -227,7 +236,13 @@ static const arch_irn_ops_if_t TEMPLATE_irn_ops_if = {
        TEMPLATE_classify,
        TEMPLATE_get_flags,
        TEMPLATE_get_frame_entity,
-       TEMPLATE_set_stack_bias
+       TEMPLATE_set_frame_entity,
+       TEMPLATE_set_frame_offset,
+       TEMPLATE_get_sp_bias,
+       NULL,    /* get_inverse             */
+       NULL,    /* get_op_estimated_cost   */
+       NULL,    /* possible_memory_operand */
+       NULL,    /* perform_memory_operand  */
 };
 
 TEMPLATE_irn_ops_t TEMPLATE_irn_ops = {
@@ -263,10 +278,11 @@ static void TEMPLATE_prepare_graph(void *self) {
 /**
  * Called immediatly before emit phase.
  */
-static void TEMPLATE_finish_irg(ir_graph *irg, TEMPLATE_code_gen_t *cg) {
-       /* TODO: - fix offsets for nodes accessing stack
-                        - ...
-       */
+static void TEMPLATE_finish_irg(void *self) {
+       TEMPLATE_code_gen_t *cg = self;
+       ir_graph            *irg = cg->irg;
+
+       dump_ir_block_graph_sched(irg, "-TEMPLATE-finished");
 }
 
 
@@ -301,8 +317,6 @@ static void TEMPLATE_emit_and_done(void *self) {
                cg->emit_decls = 0;
        }
 
-       TEMPLATE_finish_irg(irg, cg);
-       dump_ir_block_graph_sched(irg, "-TEMPLATE-finished");
        TEMPLATE_gen_routine(out, irg, cg);
 
        cur_reg_set = NULL;
@@ -320,6 +334,7 @@ static const arch_code_generator_if_t TEMPLATE_code_gen_if = {
        TEMPLATE_before_sched,   /* before scheduling hook */
        TEMPLATE_before_ra,      /* before register allocation hook */
        TEMPLATE_after_ra,       /* after register allocation hook */
+       TEMPLATE_finish_irg,
        TEMPLATE_emit_and_done
 };
 
@@ -571,11 +586,10 @@ static const backend_params *TEMPLATE_get_libfirm_params(void) {
        return &p;
 }
 
-#ifdef WITH_LIBCORE
-static void TEMPLATE_register_options(lc_opt_entry_t *ent)
+void be_init_arch_TEMPLATE()
 {
 }
-#endif /* WITH_LIBCORE */
+BE_REGISTER_MODULE_CONSTRUCTOR(be_init_arch_TEMPLATE);
 
 const arch_isa_if_t TEMPLATE_isa_if = {
        TEMPLATE_init,
@@ -588,8 +602,5 @@ const arch_isa_if_t TEMPLATE_isa_if = {
        TEMPLATE_get_code_generator_if,
        TEMPLATE_get_list_sched_selector,
        TEMPLATE_get_reg_class_alignment,
-        TEMPLETE_get_libfirm_params,
-#ifdef WITH_LIBCORE
-       TEMPLATE_register_options
-#endif
+    TEMPLATE_get_libfirm_params,
 };