shouldn't be here anymore
[libfirm] / ir / be / arm / bearch_arm.c
index 832f64a..3501895 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.
  *
@@ -27,8 +27,8 @@
 #include "config.h"
 #endif
 
-#include <libcore/lc_opts.h>
-#include <libcore/lc_opts_enum.h>
+#include "lc_opts.h"
+#include "lc_opts_enum.h"
 
 #include "pseudo_irg.h"
 #include "irgwalk.h"
@@ -37,6 +37,7 @@
 #include "ircons.h"
 #include "irgmod.h"
 #include "irgopt.h"
+#include "iroptimize.h"
 #include "lowering.h"
 
 #include "bitset.h"
@@ -203,17 +204,26 @@ static arch_irn_class_t arm_classify(const void *self, const ir_node *irn)
 
 static arch_irn_flags_t arm_get_flags(const void *self, const ir_node *irn)
 {
+       arch_irn_flags_t flags = arch_irn_flags_none;
        (void) self;
-       irn = skip_Proj_const(irn);
 
-       if (is_arm_irn(irn)) {
-               return get_arm_flags(irn);
-       }
-       else if (is_Unknown(irn)) {
+       if(is_Unknown(irn)) {
                return arch_irn_flags_ignore;
        }
 
-       return 0;
+       if (is_Proj(irn) && mode_is_datab(get_irn_mode(irn))) {
+               ir_node *pred = get_Proj_pred(irn);
+               if (is_arm_irn(pred)) {
+                       flags = get_arm_out_flags(pred, get_Proj_proj(irn));
+               }
+               irn = pred;
+       }
+
+       if (is_arm_irn(irn)) {
+               flags |= get_arm_flags(irn);
+       }
+
+       return flags;
 }
 
 static ir_entity *arm_get_frame_entity(const void *self, const ir_node *irn)
@@ -937,8 +947,7 @@ static const arch_register_t *arm_abi_prologue(void *self, ir_node **mem, pmap *
        arch_set_irn_register(env->arch_env, keep, &arm_gp_regs[REG_R12]);
        be_set_constr_single_reg(keep, BE_OUT_POS(0), &arm_gp_regs[REG_R12] );
 
-       fp = new_rd_arm_Sub_i(NULL, irg, block, keep, get_irn_mode(fp),
-                             new_tarval_from_long(4, get_irn_mode(fp)));
+       fp = new_rd_arm_Sub_i(NULL, irg, block, keep, get_irn_mode(fp), 4);
        arch_set_irn_register(env->arch_env, fp, env->isa->bp);
 
        be_abi_reg_map_set(reg_map, env->isa->bp, fp);
@@ -977,8 +986,7 @@ static void arm_abi_epilogue(void *self, ir_node *bl, ir_node **mem, pmap *reg_m
        } else {
                ir_node *sub12_node;
                ir_node *load_node;
-               tarval *tv = new_tarval_from_long(12,mode_Iu);
-               sub12_node = new_rd_arm_Sub_i(NULL, env->irg, bl, curr_bp, mode_Iu, tv);
+               sub12_node = new_rd_arm_Sub_i(NULL, env->irg, bl, curr_bp, mode_Iu, 12);
                // FIXME
                //set_arm_req_out_all(sub12_node, sub12_req);
                arch_set_irn_register(env->arch_env, sub12_node, env->isa->sp);
@@ -1022,30 +1030,29 @@ void arm_get_call_abi(const void *self, ir_type *method_type, be_abi_call_t *abi
        ir_mode  *mode;
        int       i;
        int       n = get_method_n_params(method_type);
-       be_abi_call_flags_t flags = {
-               {
-                       0, /* store from left to right */
-                       0, /* store arguments sequential */
-                       1, /* try to omit the frame pointer */
-                       1, /* the function can use any register as frame pointer */
-                       1, /* a call can take the callee's address as an immediate */
-                       0, /* IRG is a leaf function */
-                       0  /* Set to one, if there is already enough room on the stack for call args. */
-               }
-       };
+       be_abi_call_flags_t call_flags = be_abi_call_get_flags(abi);
        (void) self;
 
+       /* set abi flags for calls */
+       call_flags.bits.left_to_right         = 0;
+       call_flags.bits.store_args_sequential = 0;
+       /* call_flags.bits.try_omit_fp     don't change this we can handle both */
+       call_flags.bits.fp_free               = 0;
+       call_flags.bits.call_has_imm          = 1;  /* IA32 calls can have immediate address */
+
        /* set stack parameter passing style */
-       be_abi_call_set_flags(abi, flags, &arm_abi_callbacks);
+       be_abi_call_set_flags(abi, call_flags, &arm_abi_callbacks);
 
        for (i = 0; i < n; i++) {
                /* reg = get reg for param i;          */
                /* be_abi_call_param_reg(abi, i, reg); */
-               if (i < 4)
-
+               if (i < 4) {
                        be_abi_call_param_reg(abi, i, arm_get_RegParam_reg(i));
-               else
-                       be_abi_call_param_stack(abi, i, 4, 0, 0);
+               } else {
+                       tp   = get_method_param_type(method_type, i);
+                       mode = get_type_mode(tp);
+                       be_abi_call_param_stack(abi, i, mode, 4, 0, 0);
+               }
        }
 
        /* set return registers */
@@ -1117,10 +1124,11 @@ list_sched_selector_t arm_sched_selector;
  */
 static const list_sched_selector_t *arm_get_list_sched_selector(const void *self, list_sched_selector_t *selector) {
        (void) self;
-       (void) selector;
-       arm_sched_selector = reg_pressure_selector;
+       memcpy(&arm_sched_selector, selector, sizeof(arm_sched_selector));
+       /* arm_sched_selector.exectime              = arm_sched_exectime; */
        arm_sched_selector.to_appear_in_schedule = arm_to_appear_in_schedule;
        return &arm_sched_selector;
+
 }
 
 static const ilp_sched_selector_t *arm_get_ilp_sched_selector(const void *self) {