use is_$KIND(n) instead of get_irn_op(n) == op_$KIND.
[libfirm] / ir / be / arm / arm_transform.c
index ba6fc92..c2413d9 100644 (file)
@@ -35,6 +35,7 @@
 #include "iropt_t.h"
 #include "debug.h"
 #include "error.h"
+#include "util.h"
 
 #include "benode.h"
 #include "beirg.h"
@@ -737,7 +738,7 @@ static ir_node *make_shift(ir_node *node, match_flags_t flags,
        ir_node  *new_op2;
 
        if (get_mode_modulo_shift(mode) != 32)
-               panic("modulo shift!=32 not supported by arm backend");
+               panic("modulo shift!=32 not supported");
 
        if (flags & MATCH_SIZE_NEUTRAL) {
                op1 = arm_skip_downconv(op1);
@@ -941,7 +942,7 @@ static ir_node *gen_Load(ir_node *node)
        ir_node  *new_load = NULL;
 
        if (get_Load_unaligned(node) == align_non_aligned)
-               panic("arm: unaligned Loads not supported yet");
+               panic("unaligned Loads not supported yet");
 
        if (mode_is_float(mode)) {
                if (USE_FPA(isa)) {
@@ -983,7 +984,7 @@ static ir_node *gen_Store(ir_node *node)
        ir_node *new_store = NULL;
 
        if (get_Store_unaligned(node) == align_non_aligned)
-               panic("arm: unaligned Stores not supported yet");
+               panic("unaligned Stores not supported yet");
 
        if (mode_is_float(mode)) {
                if (USE_FPA(isa)) {
@@ -1292,7 +1293,7 @@ static ir_node *gen_Builtin(ir_node *node)
        case ir_bk_inner_trampoline:
                break;
        }
-       panic("Builtin %s not implemented in ARM", get_builtin_kind_name(kind));
+       panic("Builtin %s not implemented", get_builtin_kind_name(kind));
 }
 
 /**
@@ -1325,7 +1326,7 @@ static ir_node *gen_Proj_Builtin(ir_node *proj)
        case ir_bk_inner_trampoline:
                break;
        }
-       panic("Builtin %s not implemented in ARM", get_builtin_kind_name(kind));
+       panic("Builtin %s not implemented", get_builtin_kind_name(kind));
 }
 
 static ir_node *gen_Proj_Load(ir_node *node)
@@ -1397,16 +1398,6 @@ static ir_node *gen_Proj_Div(ir_node *node)
        panic("Unsupported Proj from Div");
 }
 
-/**
- * Transform the Projs from a Cmp.
- */
-static ir_node *gen_Proj_Cmp(ir_node *node)
-{
-       (void) node;
-       /* we should only be here in case of a Mux node */
-       panic("Mux NYI");
-}
-
 static ir_node *gen_Proj_Start(ir_node *node)
 {
        ir_node *block     = get_nodes_block(node);
@@ -1579,8 +1570,6 @@ static ir_node *gen_Proj(ir_node *node)
                return gen_Proj_CopyB(node);
        case iro_Div:
                return gen_Proj_Div(node);
-       case iro_Cmp:
-               return gen_Proj_Cmp(node);
        case iro_Start:
                return gen_Proj_Start(node);
        case iro_Cond:
@@ -1694,7 +1683,6 @@ static void create_stacklayout(ir_graph *irg)
        layout->frame_type     = get_irg_frame_type(irg);
        layout->between_type   = arm_get_between_type();
        layout->arg_type       = arg_type;
-       layout->param_map      = NULL; /* TODO */
        layout->initial_offset = 0;
        layout->initial_bias   = 0;
        layout->sp_relative    = true;
@@ -1731,7 +1719,7 @@ static ir_node *gen_Start(ir_node *node)
                        be_prolog_add_reg(abihelper, param->reg1, arch_register_req_type_none);
        }
        /* announce that we need the values of the callee save regs */
-       for (i = 0; i < (sizeof(callee_saves)/sizeof(callee_saves[0])); ++i) {
+       for (i = 0; i != ARRAY_SIZE(callee_saves); ++i) {
                be_prolog_add_reg(abihelper, callee_saves[i], arch_register_req_type_none);
        }
 
@@ -1753,7 +1741,7 @@ static ir_node *get_stack_pointer_for(ir_node *node)
        }
 
        be_transform_node(stack_pred);
-       stack = (ir_node*)pmap_get(node_to_stack, stack_pred);
+       stack = pmap_get(ir_node, node_to_stack, stack_pred);
        if (stack == NULL) {
                return get_stack_pointer_for(stack_pred);
        }
@@ -1771,11 +1759,11 @@ static ir_node *gen_Return(ir_node *node)
        dbg_info  *dbgi           = get_irn_dbg_info(node);
        ir_node   *mem            = get_Return_mem(node);
        ir_node   *new_mem        = be_transform_node(mem);
-       int        n_callee_saves = sizeof(callee_saves)/sizeof(callee_saves[0]);
+       size_t     n_callee_saves = ARRAY_SIZE(callee_saves);
        ir_node   *sp_proj        = get_stack_pointer_for(node);
-       int        n_res          = get_Return_n_ress(node);
+       size_t     n_res          = get_Return_n_ress(node);
        ir_node   *bereturn;
-       int        i;
+       size_t     i;
 
        be_epilog_begin(abihelper);
        be_epilog_set_memory(abihelper, new_mem);
@@ -1820,25 +1808,24 @@ static ir_node *gen_Call(ir_node *node)
        ir_type              *type         = get_Call_type(node);
        calling_convention_t *cconv        = arm_decide_calling_convention(NULL, type);
        size_t                n_params     = get_Call_n_params(node);
-       size_t                n_param_regs = cconv->n_reg_params;
+       size_t const          n_param_regs = cconv->n_reg_params;
        /* max inputs: memory, callee, register arguments */
-       int                   max_inputs   = 2 + n_param_regs;
+       size_t const          max_inputs   = 2 + n_param_regs;
        ir_node             **in           = ALLOCAN(ir_node*, max_inputs);
        ir_node             **sync_ins     = ALLOCAN(ir_node*, max_inputs);
        struct obstack       *obst         = be_get_be_obst(irg);
        const arch_register_req_t **in_req
                = OALLOCNZ(obst, const arch_register_req_t*, max_inputs);
-       int                   in_arity     = 0;
-       int                   sync_arity   = 0;
-       int                   n_caller_saves
-               = sizeof(caller_saves)/sizeof(caller_saves[0]);
-       ir_entity            *entity       = NULL;
-       ir_node              *incsp        = NULL;
+       size_t                in_arity       = 0;
+       size_t                sync_arity     = 0;
+       size_t const          n_caller_saves = ARRAY_SIZE(caller_saves);
+       ir_entity            *entity         = NULL;
+       ir_node              *incsp          = NULL;
        int                   mem_pos;
        ir_node              *res;
        size_t                p;
-       int                   o;
-       int                   out_arity;
+       size_t                o;
+       size_t                out_arity;
 
        assert(n_params == get_method_n_params(type));