DEBUG_ONLY(static firm_dbg_module_t *dbg = NULL;)
-static const arch_register_t *sp_reg = &arm_gp_regs[REG_SP];
+static const arch_register_t *sp_reg = &arm_registers[REG_SP];
static ir_mode *mode_gp;
static ir_mode *mode_fp;
static beabi_helper_env_t *abihelper;
if (vn.ops < v.ops) {
/* remove bits */
result = new_bd_arm_Mvn_imm(dbgi, block, vn.values[0], vn.rors[0]);
- be_dep_on_frame(result);
for (cnt = 1; cnt < vn.ops; ++cnt) {
result = new_bd_arm_Bic_imm(dbgi, block, result,
} else {
/* add bits */
result = new_bd_arm_Mov_imm(dbgi, block, v.values[0], v.rors[0]);
- be_dep_on_frame(result);
for (cnt = 1; cnt < v.ops; ++cnt) {
result = new_bd_arm_Or_imm(dbgi, block, result,
*/
static ir_node *create_const_graph(ir_node *irn, ir_node *block)
{
- tarval *tv = get_Const_tarval(irn);
- ir_mode *mode = get_tarval_mode(tv);
- unsigned value;
+ ir_tarval *tv = get_Const_tarval(irn);
+ ir_mode *mode = get_tarval_mode(tv);
+ unsigned value;
if (mode_is_reference(mode)) {
/* ARM is 32bit, so we can safely convert a reference tarval into Iu */
MATCH_SIZE_NEUTRAL = 1 << 2,
MATCH_SKIP_NOT = 1 << 3, /**< skip Not on ONE input */
} match_flags_t;
+ENUM_BITSET(match_flags_t)
/**
* possible binop constructors.
return new_bd_arm_Mul(dbg, block, new_op1, new_op2);
}
-static ir_node *gen_Quot(ir_node *node)
+static ir_node *gen_Div(ir_node *node)
{
ir_node *block = be_transform_node(get_nodes_block(node));
- ir_node *op1 = get_Quot_left(node);
+ ir_node *op1 = get_Div_left(node);
ir_node *new_op1 = be_transform_node(op1);
- ir_node *op2 = get_Quot_right(node);
+ ir_node *op2 = get_Div_right(node);
ir_node *new_op2 = be_transform_node(op2);
- ir_mode *mode = get_irn_mode(node);
+ ir_mode *mode = get_Div_resmode(node);
dbg_info *dbg = get_irn_dbg_info(node);
assert(mode != mode_E && "IEEE Extended FP not supported");
+ /* integer division should be replaced by builtin call */
+ assert(mode_is_float(mode));
if (USE_FPA(isa)) {
return new_bd_arm_Dvf(dbg, block, new_op1, new_op2, mode);
new_op1 = be_transform_node(op1);
if (is_Const(op2)) {
- tarval *tv = get_Const_tarval(op2);
+ ir_tarval *tv = get_Const_tarval(op2);
unsigned int val = get_tarval_long(tv);
assert(tarval_is_long(tv));
if (can_use_shift_constant(val, shift_modifier)) {
if (is_Add(op2)) {
ir_node *right = get_Add_right(op2);
if (is_Const(right)) {
- tarval *tv = get_Const_tarval(right);
- ir_mode *mode = get_irn_mode(node);
- long bits = get_mode_size_bits(mode);
- ir_node *left = get_Add_left(op2);
+ ir_tarval *tv = get_Const_tarval(right);
+ ir_mode *mode = get_irn_mode(node);
+ long bits = get_mode_size_bits(mode);
+ ir_node *left = get_Add_left(op2);
if (is_Minus(left) &&
tarval_is_long(tv) &&
} else if (is_Sub(op2)) {
ir_node *left = get_Sub_left(op2);
if (is_Const(left)) {
- tarval *tv = get_Const_tarval(left);
- ir_mode *mode = get_irn_mode(node);
- long bits = get_mode_size_bits(mode);
- ir_node *right = get_Sub_right(op2);
+ ir_tarval *tv = get_Const_tarval(left);
+ ir_mode *mode = get_irn_mode(node);
+ long bits = get_mode_size_bits(mode);
+ ir_node *right = get_Sub_right(op2);
if (tarval_is_long(tv) &&
get_tarval_long(tv) == bits &&
rotate = gen_Ror(node, op1, right);
}
} else if (is_Const(op2)) {
- tarval *tv = get_Const_tarval(op2);
- ir_mode *mode = get_irn_mode(node);
- long bits = get_mode_size_bits(mode);
+ ir_tarval *tv = get_Const_tarval(op2);
+ ir_mode *mode = get_irn_mode(node);
+ long bits = get_mode_size_bits(mode);
if (tarval_is_long(tv) && bits == 32) {
ir_node *block = be_transform_node(get_nodes_block(node));
dbg_info *dbgi = get_irn_dbg_info(node);
ir_node *new_load = NULL;
+ if (get_Load_unaligned(node) == align_non_aligned)
+ panic("arm: unaligned Loads not supported yet");
+
if (mode_is_float(mode)) {
if (USE_FPA(isa)) {
new_load = new_bd_arm_Ldf(dbgi, block, new_ptr, new_mem, mode,
dbg_info *dbgi = get_irn_dbg_info(node);
ir_node *new_store = NULL;
+ if (get_Store_unaligned(node) == align_non_aligned)
+ panic("arm: unaligned Stores not supported yet");
+
if (mode_is_float(mode)) {
if (USE_FPA(isa)) {
new_store = new_bd_arm_Stf(dbgi, block, new_ptr, new_val,
static ir_node *gen_Cond(ir_node *node)
{
- ir_node *selector = get_Cond_selector(node);
- ir_mode *mode = get_irn_mode(selector);
- ir_node *block;
- ir_node *flag_node;
- dbg_info *dbgi;
+ ir_node *selector = get_Cond_selector(node);
+ ir_mode *mode = get_irn_mode(selector);
+ ir_relation relation;
+ ir_node *block;
+ ir_node *flag_node;
+ dbg_info *dbgi;
if (mode != mode_b) {
return gen_SwitchJmp(node);
}
- assert(is_Proj(selector));
+ assert(is_Cmp(selector));
block = be_transform_node(get_nodes_block(node));
dbgi = get_irn_dbg_info(node);
- flag_node = be_transform_node(get_Proj_pred(selector));
+ flag_node = be_transform_node(selector);
+ relation = get_Cmp_relation(selector);
- return new_bd_arm_B(dbgi, block, flag_node, get_Proj_proj(selector));
+ return new_bd_arm_B(dbgi, block, flag_node, relation);
}
-static tarval *fpa_imm[3][fpa_max];
+enum fpa_imm_mode {
+ FPA_IMM_FLOAT = 0,
+ FPA_IMM_DOUBLE = 1,
+ FPA_IMM_EXTENDED = 2,
+ FPA_IMM_MAX = FPA_IMM_EXTENDED
+};
+
+static ir_tarval *fpa_imm[FPA_IMM_MAX + 1][fpa_max];
#if 0
/**
switch (get_mode_size_bits(mode)) {
case 32:
- i = 0;
+ i = FPA_IMM_FLOAT;
break;
case 64:
- i = 1;
+ i = FPA_IMM_DOUBLE;
break;
default:
- i = 2;
+ i = FPA_IMM_EXTENDED;
}
if (tarval_is_negative(tv)) {
if (mode_is_float(mode)) {
if (USE_FPA(isa)) {
- tarval *tv = get_Const_tarval(node);
- node = new_bd_arm_fConst(dbg, block, tv);
- be_dep_on_frame(node);
+ ir_tarval *tv = get_Const_tarval(node);
+ node = new_bd_arm_fConst(dbg, block, tv);
return node;
} else if (USE_VFP(isa)) {
assert(mode != mode_E && "IEEE Extended FP not supported");
ir_node *new_node;
new_node = new_bd_arm_SymConst(dbgi, block, entity, 0);
- be_dep_on_frame(new_node);
return new_node;
}
* registers... */
ir_graph *irg = current_ir_graph;
ir_node *stack = get_irg_frame(irg);
- ir_node *nomem = new_r_NoMem(irg);
+ ir_node *nomem = get_irg_no_mem(irg);
ir_node *str0 = new_bd_arm_Str(dbgi, block, stack, node0, nomem, mode_gp,
NULL, 0, 0, true);
ir_node *str1 = new_bd_arm_Str(dbgi, block, stack, node1, nomem, mode_gp,
{
ir_graph *irg = current_ir_graph;
ir_node *stack = get_irg_frame(irg);
- ir_node *nomem = new_r_NoMem(irg);
+ ir_node *nomem = get_irg_no_mem(irg);
ir_node *str = new_bd_arm_Str(dbgi, block, stack, node, nomem, mode_gp,
NULL, 0, 0, true);
ir_node *ldf;
{
ir_graph *irg = current_ir_graph;
ir_node *stack = get_irg_frame(irg);
- ir_node *nomem = new_r_NoMem(irg);
+ ir_node *nomem = get_irg_no_mem(irg);
ir_node *stf = new_bd_arm_Stf(dbgi, block, stack, node, nomem, mode_F,
NULL, 0, 0, true);
ir_node *ldr;
{
ir_graph *irg = current_ir_graph;
ir_node *stack = get_irg_frame(irg);
- ir_node *nomem = new_r_NoMem(irg);
+ ir_node *nomem = get_irg_no_mem(irg);
ir_node *stf = new_bd_arm_Stf(dbgi, block, stack, node, nomem, mode_D,
NULL, 0, 0, true);
ir_node *ldr0, *ldr1;
panic("Unsupported Proj from CopyB");
}
-static ir_node *gen_Proj_Quot(ir_node *node)
+static ir_node *gen_Proj_Div(ir_node *node)
{
ir_node *pred = get_Proj_pred(node);
ir_node *new_pred = be_transform_node(pred);
long proj = get_Proj_proj(node);
switch (proj) {
- case pn_Quot_M:
- if (is_arm_Dvf(new_pred)) {
- return new_rd_Proj(dbgi, new_pred, mode_M, pn_arm_Dvf_M);
- }
- break;
- case pn_Quot_res:
- if (is_arm_Dvf(new_pred)) {
- return new_rd_Proj(dbgi, new_pred, mode, pn_arm_Dvf_res);
- }
- break;
+ case pn_Div_M:
+ return new_rd_Proj(dbgi, new_pred, mode_M, pn_arm_Dvf_M);
+ case pn_Div_res:
+ return new_rd_Proj(dbgi, new_pred, mode, pn_arm_Dvf_res);
default:
break;
}
- panic("Unsupported Proj from Quot");
+ panic("Unsupported Proj from Div");
}
/**
{
ir_node *block = get_nodes_block(node);
ir_node *new_block = be_transform_node(block);
- ir_node *barrier = be_transform_node(get_Proj_pred(node));
long proj = get_Proj_proj(node);
switch ((pn_Start) proj) {
return new_bd_arm_Jmp(NULL, new_block);
case pn_Start_M:
- return new_r_Proj(barrier, mode_M, 0);
+ return be_prolog_get_memory(abihelper);
case pn_Start_T_args:
- return barrier;
+ return new_r_Bad(get_irn_irg(block), mode_T);
case pn_Start_P_frame_base:
return be_prolog_get_reg_value(abihelper, sp_reg);
- case pn_Start_P_tls:
- return new_r_Bad(get_irn_irg(node));
-
case pn_Start_max:
break;
}
ir_node *call = get_Proj_pred(get_Proj_pred(node));
ir_node *new_call = be_transform_node(call);
ir_type *function_type = get_Call_type(call);
- calling_convention_t *cconv = arm_decide_calling_convention(function_type);
+ calling_convention_t *cconv
+ = arm_decide_calling_convention(NULL, function_type);
const reg_or_stackslot_t *res = &cconv->results[pn];
ir_mode *mode;
int regn;
case pn_Call_X_regular:
case pn_Call_X_except:
case pn_Call_T_result:
- case pn_Call_P_value_res_base:
case pn_Call_max:
break;
}
return gen_Proj_Call(node);
case iro_CopyB:
return gen_Proj_CopyB(node);
- case iro_Quot:
- return gen_Proj_Quot(node);
+ case iro_Div:
+ return gen_Proj_Div(node);
case iro_Cmp:
return gen_Proj_Cmp(node);
case iro_Start:
/* just produce a 0 */
ir_mode *mode = get_irn_mode(node);
if (mode_is_float(mode)) {
- tarval *tv = get_mode_null(mode);
- ir_node *node = new_bd_arm_fConst(dbgi, new_block, tv);
- be_dep_on_frame(node);
+ ir_tarval *tv = get_mode_null(mode);
+ ir_node *node = new_bd_arm_fConst(dbgi, new_block, tv);
return node;
} else if (mode_needs_gp_reg(mode)) {
return create_const_graph_value(dbgi, new_block, 0);
layout->param_map = NULL; /* TODO */
layout->initial_offset = 0;
layout->initial_bias = 0;
- layout->stack_dir = -1;
layout->sp_relative = true;
assert(N_FRAME_TYPES == 3);
}
/**
- * transform the start node to the prolog code + initial barrier
+ * transform the start node to the prolog code
*/
static ir_node *gen_Start(ir_node *node)
{
ir_node *new_block = be_transform_node(block);
dbg_info *dbgi = get_irn_dbg_info(node);
ir_node *start;
- ir_node *incsp;
- ir_node *sp;
- ir_node *barrier;
- int i;
+ size_t i;
/* stackpointer is important at function prolog */
be_prolog_add_reg(abihelper, sp_reg,
for (i = 0; i < get_method_n_params(function_type); ++i) {
const reg_or_stackslot_t *param = &cconv->parameters[i];
if (param->reg0 != NULL)
- be_prolog_add_reg(abihelper, param->reg0, 0);
+ be_prolog_add_reg(abihelper, param->reg0, arch_register_req_type_none);
if (param->reg1 != NULL)
- be_prolog_add_reg(abihelper, param->reg1, 0);
+ 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 < (int) (sizeof(callee_saves)/sizeof(callee_saves[0])); ++i) {
- be_prolog_add_reg(abihelper, callee_saves[i], 0);
+ for (i = 0; i < (sizeof(callee_saves)/sizeof(callee_saves[0])); ++i) {
+ be_prolog_add_reg(abihelper, callee_saves[i], arch_register_req_type_none);
}
start = be_prolog_create_start(abihelper, dbgi, new_block);
- sp = be_prolog_get_reg_value(abihelper, sp_reg);
- incsp = be_new_IncSP(sp_reg, new_block, sp, BE_STACK_FRAME_SIZE_EXPAND, 0);
- be_prolog_set_reg_value(abihelper, sp_reg, incsp);
- barrier = be_prolog_create_barrier(abihelper, new_block);
-
- return barrier;
+ return start;
}
static ir_node *get_stack_pointer_for(ir_node *node)
}
stack_pred_transformed = be_transform_node(stack_pred);
- stack = pmap_get(node_to_stack, stack_pred);
+ stack = (ir_node*)pmap_get(node_to_stack, stack_pred);
if (stack == NULL) {
return get_stack_pointer_for(stack_pred);
}
ir_node *sp_proj = get_stack_pointer_for(node);
int n_res = get_Return_n_ress(node);
ir_node *bereturn;
- ir_node *incsp;
int i;
be_epilog_begin(abihelper);
const reg_or_stackslot_t *slot = &cconv->results[i];
const arch_register_t *reg = slot->reg0;
assert(slot->reg1 == NULL);
- be_epilog_add_reg(abihelper, reg, 0, new_res_value);
+ be_epilog_add_reg(abihelper, reg, arch_register_req_type_none, new_res_value);
}
/* connect callee saves with their values at the function begin */
for (i = 0; i < n_callee_saves; ++i) {
const arch_register_t *reg = callee_saves[i];
ir_node *value = be_prolog_get_reg_value(abihelper, reg);
- be_epilog_add_reg(abihelper, reg, 0, value);
+ be_epilog_add_reg(abihelper, reg, arch_register_req_type_none, value);
}
- /* create the barrier before the epilog code */
- be_epilog_create_barrier(abihelper, new_block);
-
/* epilog code: an incsp */
- sp_proj = be_epilog_get_reg_value(abihelper, sp_reg);
- incsp = be_new_IncSP(sp_reg, new_block, sp_proj,
- BE_STACK_FRAME_SIZE_SHRINK, 0);
- be_epilog_set_reg_value(abihelper, sp_reg, incsp);
-
bereturn = be_epilog_create_return(abihelper, dbgi, new_block);
-
return bereturn;
}
ir_node *new_mem = be_transform_node(mem);
dbg_info *dbgi = get_irn_dbg_info(node);
ir_type *type = get_Call_type(node);
- calling_convention_t *cconv = arm_decide_calling_convention(type);
- int n_params = get_Call_n_params(node);
- int n_param_regs = sizeof(param_regs)/sizeof(param_regs[0]);
+ calling_convention_t *cconv = arm_decide_calling_convention(NULL, type);
+ size_t n_params = get_Call_n_params(node);
+ size_t n_param_regs = sizeof(param_regs)/sizeof(param_regs[0]);
/* max inputs: memory, callee, register arguments */
int max_inputs = 2 + n_param_regs;
ir_node **in = ALLOCAN(ir_node*, max_inputs);
ir_node *incsp = NULL;
int mem_pos;
ir_node *res;
- int p;
+ size_t p;
int o;
int out_arity;
be_set_transform_function(op_Const, gen_Const);
be_set_transform_function(op_Conv, gen_Conv);
be_set_transform_function(op_CopyB, gen_CopyB);
+ be_set_transform_function(op_Div, gen_Div);
be_set_transform_function(op_Eor, gen_Eor);
be_set_transform_function(op_Jmp, gen_Jmp);
be_set_transform_function(op_Load, gen_Load);
be_set_transform_function(op_Or, gen_Or);
be_set_transform_function(op_Phi, gen_Phi);
be_set_transform_function(op_Proj, gen_Proj);
- be_set_transform_function(op_Quot, gen_Quot);
be_set_transform_function(op_Return, gen_Return);
be_set_transform_function(op_Rotl, gen_Rotl);
be_set_transform_function(op_Sel, gen_Sel);
static void arm_init_fpa_immediate(void)
{
/* 0, 1, 2, 3, 4, 5, 10, or 0.5. */
- fpa_imm[0][fpa_null] = get_mode_null(mode_F);
- fpa_imm[0][fpa_one] = get_mode_one(mode_F);
- fpa_imm[0][fpa_two] = new_tarval_from_str("2", 1, mode_F);
- fpa_imm[0][fpa_three] = new_tarval_from_str("3", 1, mode_F);
- fpa_imm[0][fpa_four] = new_tarval_from_str("4", 1, mode_F);
- fpa_imm[0][fpa_five] = new_tarval_from_str("5", 1, mode_F);
- fpa_imm[0][fpa_ten] = new_tarval_from_str("10", 2, mode_F);
- fpa_imm[0][fpa_half] = new_tarval_from_str("0.5", 3, mode_F);
-
- fpa_imm[1][fpa_null] = get_mode_null(mode_D);
- fpa_imm[1][fpa_one] = get_mode_one(mode_D);
- fpa_imm[1][fpa_two] = new_tarval_from_str("2", 1, mode_D);
- fpa_imm[1][fpa_three] = new_tarval_from_str("3", 1, mode_D);
- fpa_imm[1][fpa_four] = new_tarval_from_str("4", 1, mode_D);
- fpa_imm[1][fpa_five] = new_tarval_from_str("5", 1, mode_D);
- fpa_imm[1][fpa_ten] = new_tarval_from_str("10", 2, mode_D);
- fpa_imm[1][fpa_half] = new_tarval_from_str("0.5", 3, mode_D);
-
- fpa_imm[2][fpa_null] = get_mode_null(mode_E);
- fpa_imm[2][fpa_one] = get_mode_one(mode_E);
- fpa_imm[2][fpa_two] = new_tarval_from_str("2", 1, mode_E);
- fpa_imm[2][fpa_three] = new_tarval_from_str("3", 1, mode_E);
- fpa_imm[2][fpa_four] = new_tarval_from_str("4", 1, mode_E);
- fpa_imm[2][fpa_five] = new_tarval_from_str("5", 1, mode_E);
- fpa_imm[2][fpa_ten] = new_tarval_from_str("10", 2, mode_E);
- fpa_imm[2][fpa_half] = new_tarval_from_str("0.5", 3, mode_E);
+ fpa_imm[FPA_IMM_FLOAT][fpa_null] = get_mode_null(mode_F);
+ fpa_imm[FPA_IMM_FLOAT][fpa_one] = get_mode_one(mode_F);
+ fpa_imm[FPA_IMM_FLOAT][fpa_two] = new_tarval_from_str("2", 1, mode_F);
+ fpa_imm[FPA_IMM_FLOAT][fpa_three] = new_tarval_from_str("3", 1, mode_F);
+ fpa_imm[FPA_IMM_FLOAT][fpa_four] = new_tarval_from_str("4", 1, mode_F);
+ fpa_imm[FPA_IMM_FLOAT][fpa_five] = new_tarval_from_str("5", 1, mode_F);
+ fpa_imm[FPA_IMM_FLOAT][fpa_ten] = new_tarval_from_str("10", 2, mode_F);
+ fpa_imm[FPA_IMM_FLOAT][fpa_half] = new_tarval_from_str("0.5", 3, mode_F);
+
+ fpa_imm[FPA_IMM_DOUBLE][fpa_null] = get_mode_null(mode_D);
+ fpa_imm[FPA_IMM_DOUBLE][fpa_one] = get_mode_one(mode_D);
+ fpa_imm[FPA_IMM_DOUBLE][fpa_two] = new_tarval_from_str("2", 1, mode_D);
+ fpa_imm[FPA_IMM_DOUBLE][fpa_three] = new_tarval_from_str("3", 1, mode_D);
+ fpa_imm[FPA_IMM_DOUBLE][fpa_four] = new_tarval_from_str("4", 1, mode_D);
+ fpa_imm[FPA_IMM_DOUBLE][fpa_five] = new_tarval_from_str("5", 1, mode_D);
+ fpa_imm[FPA_IMM_DOUBLE][fpa_ten] = new_tarval_from_str("10", 2, mode_D);
+ fpa_imm[FPA_IMM_DOUBLE][fpa_half] = new_tarval_from_str("0.5", 3, mode_D);
+
+ fpa_imm[FPA_IMM_EXTENDED][fpa_null] = get_mode_null(mode_E);
+ fpa_imm[FPA_IMM_EXTENDED][fpa_one] = get_mode_one(mode_E);
+ fpa_imm[FPA_IMM_EXTENDED][fpa_two] = new_tarval_from_str("2", 1, mode_E);
+ fpa_imm[FPA_IMM_EXTENDED][fpa_three] = new_tarval_from_str("3", 1, mode_E);
+ fpa_imm[FPA_IMM_EXTENDED][fpa_four] = new_tarval_from_str("4", 1, mode_E);
+ fpa_imm[FPA_IMM_EXTENDED][fpa_five] = new_tarval_from_str("5", 1, mode_E);
+ fpa_imm[FPA_IMM_EXTENDED][fpa_ten] = new_tarval_from_str("10", 2, mode_E);
+ fpa_imm[FPA_IMM_EXTENDED][fpa_half] = new_tarval_from_str("0.5", 3, mode_E);
}
/**
abihelper = be_abihelper_prepare(irg);
be_collect_stacknodes(abihelper);
assert(cconv == NULL);
- cconv = arm_decide_calling_convention(get_entity_type(entity));
+ cconv = arm_decide_calling_convention(irg, get_entity_type(entity));
create_stacklayout(irg);
be_transform_graph(irg, NULL);