- placed phi_handler into the be_main environment, removing unnecessary allocations
[libfirm] / ir / be / TEMPLATE / bearch_TEMPLATE.c
index 84d9c69..7aa0ace 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 1995-2007 University of Karlsruhe.  All right reserved.
+ * Copyright (C) 1995-2008 University of Karlsruhe.  All right reserved.
  *
  * This file is part of libFirm.
  *
@@ -321,6 +321,7 @@ static void *TEMPLATE_cg_init(be_irg_t *birg);
 
 static const arch_code_generator_if_t TEMPLATE_code_gen_if = {
        TEMPLATE_cg_init,
+       NULL,                    /* get_pic_base hook */
        NULL,                    /* before abi introduce hook */
        TEMPLATE_prepare_graph,
        NULL,                    /* spill hook */
@@ -372,11 +373,11 @@ static TEMPLATE_isa_t TEMPLATE_isa_template = {
                &TEMPLATE_general_purpose_regs[REG_SP],  /* stack pointer register */
                &TEMPLATE_general_purpose_regs[REG_BP],  /* base pointer register */
                -1,                          /* stack direction */
+               1,                           /* stack alignment for calls */
                NULL,                        /* main environment */
                7,                           /* costs for a spill instruction */
                5,                           /* costs for a reload instruction */
        },
-       NULL_EMITTER,                    /* emitter environment */
 };
 
 /**
@@ -393,7 +394,7 @@ static void *TEMPLATE_init(FILE *outfile) {
        isa = xcalloc(1, sizeof(*isa));
        memcpy(isa, &TEMPLATE_isa_template, sizeof(*isa));
 
-       be_emit_init_env(&isa->emit, outfile);
+       be_emit_init(outfile);
 
        TEMPLATE_register_init();
        TEMPLATE_create_opcodes();
@@ -410,25 +411,25 @@ static void TEMPLATE_done(void *self) {
        TEMPLATE_isa_t *isa = self;
 
        /* emit now all global declarations */
-       be_gas_emit_decls(&isa->emit, isa->arch_isa.main_env, 0);
+       be_gas_emit_decls(isa->arch_isa.main_env, 0);
 
-       be_emit_destroy_env(&isa->emit);
+       be_emit_exit();
        free(self);
 }
 
 
 
-static int TEMPLATE_get_n_reg_class(const void *self)
+static unsigned TEMPLATE_get_n_reg_class(const void *self)
 {
        (void) self;
        return N_CLASSES;
 }
 
 static const arch_register_class_t *TEMPLATE_get_reg_class(const void *self,
-                                                           int i)
+                                                           unsigned i)
 {
        (void) self;
-       assert(i >= 0 && i < N_CLASSES && "Invalid TEMPLATE register class requested.");
+       assert(i < N_CLASSES);
        return &TEMPLATE_reg_classes[i];
 }
 
@@ -572,7 +573,9 @@ void TEMPLATE_get_call_abi(const void *self, ir_type *method_type,
                /* be_abi_call_param_reg(abi, i, reg); */
 
                /* default: all parameters on stack */
-               be_abi_call_param_stack(abi, i, 4, 0, 0);
+               tp   = get_method_param_type(method_type, i);
+               mode = get_type_mode(tp);
+               be_abi_call_param_stack(abi, i, mode, 4, 0, 0);
        }
 
        /* TODO: set correct return register */
@@ -635,7 +638,7 @@ static const list_sched_selector_t *TEMPLATE_get_list_sched_selector(
        (void) self;
        (void) selector;
 
-       memcpy(&TEMPLATE_sched_selector, trivial_selector, sizeof(list_sched_selector_t));
+       TEMPLATE_sched_selector = trivial_selector;
        TEMPLATE_sched_selector.to_appear_in_schedule = TEMPLATE_to_appear_in_schedule;
        return &TEMPLATE_sched_selector;
 }
@@ -661,14 +664,6 @@ static int TEMPLATE_get_reg_class_alignment(const void *self,
  * Returns the libFirm configuration parameter for this backend.
  */
 static const backend_params *TEMPLATE_get_backend_params(void) {
-       static arch_dep_params_t ad = {
-               1,  /* allow subs */
-               0,  /* Muls are fast enough on Firm */
-               31, /* shift would be ok */
-               0,  /* no Mulhs */
-               0,  /* no Mulhu */
-               0,  /* no Mulh */
-       };
        static backend_params p = {
                0,     /* no dword lowering */
                0,     /* no inline assembly */
@@ -678,8 +673,6 @@ static const backend_params *TEMPLATE_get_backend_params(void) {
                NULL,  /* context for create_intrinsic_fkt */
                NULL,  /* parameter for if conversion */
        };
-
-       p.dep_param = &ad;
        return &p;
 }