remove (broken+unused) support for right_to_left parameter passing
[libfirm] / ir / be / TEMPLATE / bearch_TEMPLATE.c
index 385f468..c0e7f56 100644 (file)
@@ -162,7 +162,7 @@ static TEMPLATE_isa_t TEMPLATE_isa_template = {
 static arch_env_t *TEMPLATE_init(FILE *outfile)
 {
        TEMPLATE_isa_t *isa = XMALLOC(TEMPLATE_isa_t);
-       memcpy(isa, &TEMPLATE_isa_template, sizeof(*isa));
+       *isa = TEMPLATE_isa_template;
 
        be_emit_init(outfile);
 
@@ -248,7 +248,6 @@ static void TEMPLATE_get_call_abi(const void *self, ir_type *method_type,
        (void) self;
 
        /* set abi flags for calls */
-       call_flags.bits.left_to_right         = 0;
        call_flags.bits.store_args_sequential = 1;
        call_flags.bits.try_omit_fp           = 1;
        call_flags.bits.fp_free               = 0;
@@ -322,7 +321,9 @@ static const backend_params *TEMPLATE_get_backend_params(void)
                0,     /* 0: little-endian, 1: big-endian */
                NULL,  /* architecture dependent settings, will be set later */
                TEMPLATE_is_mux_allowed,  /* parameter for if conversion */
+               32,    /* machine size - a 32bit CPU */
                NULL,  /* float arithmetic mode */
+               0,     /* size of long double */
                0,     /* no trampoline support: size 0 */
                0,     /* no trampoline support: align 0 */
                NULL,  /* no trampoline support: no trampoline builder */
@@ -351,6 +352,50 @@ static int TEMPLATE_is_valid_clobber(const char *clobber)
        return 0;
 }
 
+/**
+ * Check if the given register is callee or caller save.
+ */
+static int TEMPLATE_register_saved_by(const arch_register_t *reg, int callee)
+{
+       if (callee) {
+               /* check for callee saved */
+               if (reg->reg_class == &TEMPLATE_reg_classes[CLASS_TEMPLATE_gp]) {
+                       switch (reg->index) {
+                       case REG_GP_R7:
+                       case REG_GP_R8:
+                       case REG_GP_R9:
+                       case REG_GP_R10:
+                       case REG_GP_R11:
+                       case REG_GP_R12:
+                       case REG_GP_R13:
+                               return 1;
+                       default:
+                               return 0;
+                       }
+               }
+       } else {
+               /* check for caller saved */
+               if (reg->reg_class == &TEMPLATE_reg_classes[CLASS_TEMPLATE_gp]) {
+                       switch (reg->index) {
+                       case REG_GP_R0:
+                       case REG_GP_R1:
+                       case REG_GP_R2:
+                       case REG_GP_R3:
+                       case REG_GP_R4:
+                       case REG_GP_R5:
+                       case REG_GP_R6:
+                               return 1;
+                       default:
+                               return 0;
+                       }
+               } else if (reg->reg_class == &TEMPLATE_reg_classes[CLASS_TEMPLATE_fp]) {
+                       /* all FP registers are caller save */
+                       return 1;
+               }
+       }
+       return 0;
+}
+
 const arch_isa_if_t TEMPLATE_isa_if = {
        TEMPLATE_init,
        TEMPLATE_lower_for_target,
@@ -373,9 +418,10 @@ const arch_isa_if_t TEMPLATE_isa_if = {
        TEMPLATE_after_ra,
        TEMPLATE_finish_irg,
        TEMPLATE_emit_routine,
+       TEMPLATE_register_saved_by,
 };
 
-BE_REGISTER_MODULE_CONSTRUCTOR(be_init_arch_TEMPLATE);
+BE_REGISTER_MODULE_CONSTRUCTOR(be_init_arch_TEMPLATE)
 void be_init_arch_TEMPLATE(void)
 {
        be_register_isa_if("TEMPLATE", &TEMPLATE_isa_if);