if(be_is_Spill(node))
{
- ir_node *store, *proj;
- dbg_info *dbg = get_irn_dbg_info(node);
- ir_node *block = get_nodes_block(node);
- ir_mode *mode = get_irn_mode(node);
+ ir_node *store, *proj;
+ dbg_info *dbg = get_irn_dbg_info(node);
+ ir_node *block = get_nodes_block(node);
const arch_register_class_t *regclass = arch_get_irn_reg_class(cgenv->arch_env, node, 1);
{
ir_node *load, *proj;
const arch_register_t *reg;
- dbg_info *dbg = get_irn_dbg_info(node);
- ir_node *block = get_nodes_block(node);
- ir_mode *mode = get_irn_mode(node);
+ dbg_info *dbg = get_irn_dbg_info(node);
+ ir_node *block = get_nodes_block(node);
+ ir_mode *mode = get_irn_mode(node);
const arch_register_class_t *regclass = arch_get_irn_reg_class(cgenv->arch_env, node, -1);
* @param env the debug module
*/
void ppc32_collect_symconsts_walk(ir_node *node, void *env) {
- ppc32_code_gen_t *cg = env;
- if(get_irn_op(node)==op_SymConst)
+ if(get_irn_op(node) == op_SymConst)
{
entity *ent = get_SymConst_entity(node);
if(!is_direct_entity(ent))
int fpregi = REG_F1;
const arch_register_t *reg;
- be_abi_call_flags_t call_flags = { 0, 0, 1, 0, 0, 0, 1 };
+ be_abi_call_flags_t call_flags = { { 0, 0, 1, 0, 0, 0, 1 } };
if(get_type_visibility(method_type)!=visibility_external_allocated)
call_flags.bits.call_has_imm = 1;
* Emits code for function start.
*/
void ppc32_emit_start(FILE *F, ir_graph *irg, ppc32_emit_env_t *env) {
- const char *irg_name = get_entity_ld_name(get_irg_entity(irg));
- int framesize = get_type_size_bytes(get_irg_frame_type(env->cg->irg));
+ const char *irg_name = get_entity_ld_name(get_irg_entity(irg));
+ int framesize = get_type_size_bytes(get_irg_frame_type(env->cg->irg));
- if(!strcmp(irg_name, "main")) // XXX: underscore hack
+ if(! strcmp(irg_name, "main")) // XXX: underscore hack
{
fprintf(F, "\t.text\n");
- fprintf(F, "\t.globl _main\n", irg_name);
+ fprintf(F, "\t.globl _main\n");
fprintf(F, "\t.align 4\n");
- fprintf(F, "_main:\n", irg_name);
+ fprintf(F, "_main:\n");
}
else
{
fprintf(F, "%s:\n", irg_name);
}
- if(framesize>24)
+ if(framesize > 24)
{
fprintf(F, "\tmflr r0\n");
fprintf(F, "\tstw r0, 8(r1)\n");
}
else
{
- fprintf(F, "\t\t\t\t\t/* set new frame omitted */\n", framesize);
+ fprintf(F, "\t\t\t\t\t/* set new frame (%d) omitted */\n", framesize);
}
* Emits code for function end
*/
void ppc32_emit_end(FILE *F, ir_graph *irg, ppc32_emit_env_t *env) {
- const char *irg_name = get_entity_ld_name(get_irg_entity(irg));
int framesize = get_type_size_bytes(get_irg_frame_type(env->cg->irg));
/* if(!isleaf)
fprintf(F, "\taddi r1, r1, 4\n");
fprintf(F, "\tmtlr r0\n");
}*/
- if(framesize>24)
+ if(framesize > 24)
{
fprintf(F, "\tlwz r1, 0(r1)\n");
fprintf(F, "\tlwz r0, 8(r1)\n");
void set_ppc32_constant_tarval(const ir_node *node, tarval *const_tarval) {
ppc32_attr_t *attr = get_ppc32_attr(node);
attr->content_type = ppc32_ac_Const;
- attr->constant_tarval = const_tarval;
+ attr->data.constant_tarval = const_tarval;
}
/**
*/
tarval *get_ppc32_constant_tarval(const ir_node *node) {
ppc32_attr_t *attr = get_ppc32_attr(node);
- return attr->constant_tarval;
+ return attr->data.constant_tarval;
}
/**
void set_ppc32_symconst_ident(const ir_node *node, ident *symconst_ident) {
ppc32_attr_t *attr = get_ppc32_attr(node);
attr->content_type = ppc32_ac_SymConst;
- attr->symconst_ident = symconst_ident;
+ attr->data.symconst_ident = symconst_ident;
}
/**
*/
ident *get_ppc32_symconst_ident(const ir_node *node) {
ppc32_attr_t *attr = get_ppc32_attr(node);
- return attr->symconst_ident;
+ return attr->data.symconst_ident;
}
void set_ppc32_frame_entity(const ir_node *node, entity *ent) {
ppc32_attr_t *attr = get_ppc32_attr(node);
attr->content_type = ppc32_ac_FrameEntity;
- attr->frame_entity = ent;
+ attr->data.frame_entity = ent;
}
/**
*/
entity *get_ppc32_frame_entity(const ir_node *node) {
ppc32_attr_t *attr = get_ppc32_attr(node);
- return attr->frame_entity;
+ return attr->data.frame_entity;
}
/**
void set_ppc32_rlwimi_const(const ir_node *node, unsigned shift, unsigned maskA, unsigned maskB) {
ppc32_attr_t *attr = get_ppc32_attr(node);
attr->content_type = ppc32_ac_RlwimiConst;
- attr->rlwimi_const.shift = shift;
- attr->rlwimi_const.maskA = maskA;
- attr->rlwimi_const.maskB = maskB;
+ attr->data.rlwimi_const.shift = shift;
+ attr->data.rlwimi_const.maskA = maskA;
+ attr->data.rlwimi_const.maskB = maskB;
}
/**
*/
rlwimi_const_t *get_ppc32_rlwimi_const(const ir_node *node) {
ppc32_attr_t *attr = get_ppc32_attr(node);
- return &attr->rlwimi_const;
+ return &attr->data.rlwimi_const;
}
/**
void set_ppc32_proj_nr(const ir_node *node, int proj_nr) {
ppc32_attr_t *attr = get_ppc32_attr(node);
attr->content_type = ppc32_ac_BranchProj;
- attr->proj_nr = proj_nr;
+ attr->data.proj_nr = proj_nr;
}
/**
*/
int get_ppc32_proj_nr(const ir_node *node) {
ppc32_attr_t *attr = get_ppc32_attr(node);
- return attr->proj_nr;
+ return attr->data.proj_nr;
}
/**
void set_ppc32_offset(const ir_node *node, int offset) {
ppc32_attr_t *attr = get_ppc32_attr(node);
attr->content_type = ppc32_ac_Offset;
- attr->proj_nr = offset;
+ attr->data.offset = offset;
}
/**
*/
int get_ppc32_offset(const ir_node *node) {
ppc32_attr_t *attr = get_ppc32_attr(node);
- return attr->offset;
+ return attr->data.offset;
}
/**
const ppc32_register_req_t **in_reqs, const ppc32_register_req_t **out_reqs, int n_res) {
ppc32_attr_t *attr = get_ppc32_attr(node);
- attr->flags = flags;
- attr->in_req = in_reqs;
+ attr->flags = flags;
+ attr->in_req = in_reqs;
attr->out_req = out_reqs;
- attr->n_res = n_res;
-
- attr->slots = NULL;
+ attr->n_res = n_res;
+ attr->slots = NULL;
if (n_res) {
attr->slots = xcalloc(n_res, sizeof(attr->slots[0]));
}
attr->content_type = ppc32_ac_None;
- attr->offset_mode = ppc32_ao_Illegal;
- attr->empty = NULL;
+ attr->offset_mode = ppc32_ao_Illegal;
+ attr->data.empty = NULL;
}
/**
int proj_nr;
int offset;
void* empty;
- };
+ } data;
} ppc32_attr_t;
"emit" => '. addi %D1, %S1, %C\t\t\t/* Addi(%S1, %C) -> %D1, (%A1, const) */',
"cmp_attr" =>
'
- return (attr_a->constant_tarval!=attr_b->constant_tarval);
+ return (attr_a->data.constant_tarval != attr_b->data.constant_tarval);
'
},
"emit" => '. sraw %D1, %S1, %C\t\t\t/* Sraw(%S1, %C) -> %D1, (%A1, const) */',
"cmp_attr" =>
'
- return (attr_a->constant_tarval!=attr_b->constant_tarval);
+ return (attr_a->data.constant_tarval != attr_b->data.constant_tarval);
'
},
"emit" => '. rlwinm %D1, %S1, %ppc32_rlwimi_emit_helper\t\t\t/* Rlwinm(%S1, %ppc32_rlwimi_emit_helper) -> %D1, (%A1) */',
"cmp_attr" =>
'
- return (attr_a->constant_tarval!=attr_b->constant_tarval);
+ return (attr_a->data.constant_tarval != attr_b->data.constant_tarval);
'
},
"reg_req" => { "out" => [ "general_purpose" ] },
"cmp_attr" =>
'
- return attr_a->constant_tarval!=attr_b->constant_tarval;
+ return attr_a->data.constant_tarval != attr_b->data.constant_tarval;
'
},
"reg_req" => { "out" => [ "floating_point" ] },
"cmp_attr" =>
'
- return attr_a->constant_tarval!=attr_b->constant_tarval;
+ return attr_a->data.constant_tarval != attr_b->data.constant_tarval;
'
},
"reg_req" => { "out" => [ "general_purpose" ] },
"cmp_attr" =>
'
- return attr_a->constant_tarval!=attr_b->constant_tarval;
+ return attr_a->data.constant_tarval != attr_b->data.constant_tarval;
'
},
"emit" => '. addi %D1, 0, %C\t\t\t/* lower 16 bit of %C (sign extended) -> %D1 */',
"cmp_attr" =>
'
- return (attr_a->constant_tarval!=attr_b->constant_tarval);
+ return (attr_a->data.constant_tarval != attr_b->data.constant_tarval);
'
},
"reg_req" => { "in" => [ "condition" ], "out" => [ "none", "none" ] },
"cmp_attr" =>
'
- return (attr_a->constant_tarval!=attr_b->constant_tarval);
+ return (attr_a->data.constant_tarval != attr_b->data.constant_tarval);
'
},
"reg_req" => { "in" => [ "general_purpose", "general_purpose", "condition" ], "out" => [ "none" ] },
"cmp_attr" =>
'
- return (attr_a->constant_tarval!=attr_b->constant_tarval);
+ return (attr_a->data.constant_tarval != attr_b->data.constant_tarval);
'
},
attr->offset_mode = om;
if (tv) {
attr->content_type = ppc32_ac_Const;
- attr->constant_tarval = tv;
+ attr->data.constant_tarval = tv;
}
else if (id) {
attr->content_type = ppc32_ac_SymConst;
- attr->symconst_ident = id;
+ attr->data.symconst_ident = id;
}
',
"cmp_attr" =>
'
- return (attr_a->constant_tarval!=attr_b->constant_tarval);
+ return (attr_a->data.constant_tarval != attr_b->data.constant_tarval);
'
},
"emit" => '. ori %D1, %S1, %C\t\t\t/* Ori(%S1,%C) -> %D1 */',
"cmp_attr" =>
'
- return (attr_a->constant_tarval!=attr_b->constant_tarval);
+ return (attr_a->data.constant_tarval != attr_b->data.constant_tarval);
'
},
"emit" => '. andi. %D1, %S1,%C\t\t\t/* Andi(%S1,%C) -> %D1 (%D2 changed) */',
"cmp_attr" =>
'
- return (attr_a->constant_tarval!=attr_b->constant_tarval);
+ return (attr_a->data.constant_tarval != attr_b->data.constant_tarval);
'
},
"emit" => '. cmpi %D1, 0, %S1, %C\t\t\t/* Cmpi(%S1, %C) -> %D1, (%A1) */',
"cmp_attr" =>
'
- return (attr_a->constant_tarval!=attr_b->constant_tarval);
+ return (attr_a->data.constant_tarval != attr_b->data.constant_tarval);
'
},
"emit" => '. cmpli %D1, 0, %S1, %C\t\t\t/* Cmpli(%S1, %C) -> %D1, (%A1) */',
"cmp_attr" =>
'
- return (attr_a->constant_tarval!=attr_b->constant_tarval);
+ return (attr_a->data.constant_tarval != attr_b->data.constant_tarval);
'
},
"emit" => '. lbz %D1, %O(%S1)\t\t\t/* Load(%O(%S1)) -> %D1, (%A1) */',
"cmp_attr" =>
'
- return (attr_a->constant_tarval!=attr_b->constant_tarval);
+ return (attr_a->data.constant_tarval != attr_b->data.constant_tarval);
'
},
"emit" => '. lhz %D1, %O(%S1)\t\t\t/* Load(%O(%S1)) -> %D1, (%A1) */',
"cmp_attr" =>
'
- return (attr_a->constant_tarval!=attr_b->constant_tarval);
+ return (attr_a->data.constant_tarval != attr_b->data.constant_tarval);
'
},
"emit" => '. lha %D1, %O(%S1)\t\t\t/* Load(%O(%S1)) -> %D1, (%A1) */',
"cmp_attr" =>
'
- return (attr_a->constant_tarval!=attr_b->constant_tarval);
+ return (attr_a->data.constant_tarval != attr_b->data.constant_tarval);
'
},
"emit" => '. lwz %D1, %O(%S1)\t\t\t/* Load(%O(%S1)) -> %D1, (%A1) */',
"cmp_attr" =>
'
- return (attr_a->constant_tarval!=attr_b->constant_tarval);
+ return (attr_a->data.constant_tarval != attr_b->data.constant_tarval);
'
},
"emit" => '. lwzu %D1, %O(%S1)\t\t\t/* Load(%O(%S1)) -> %D1, %S1 += %O, (%A1) */',
"cmp_attr" =>
'
- return (attr_a->constant_tarval!=attr_b->constant_tarval);
+ return (attr_a->data.constant_tarval != attr_b->data.constant_tarval);
'
},
"emit" => '. stb %S2, %O(%S1)\t\t\t/* Store(%S2) -> (%S1), (%A1, %A2) */',
"cmp_attr" =>
'
- return (attr_a->constant_tarval!=attr_b->constant_tarval);
+ return (attr_a->data.constant_tarval != attr_b->data.constant_tarval);
'
},
"emit" => '. sth %S2, %O(%S1)\t\t\t/* Store(%S2) -> (%S1), (%A1, %A2) */',
"cmp_attr" =>
'
- return (attr_a->constant_tarval!=attr_b->constant_tarval);
+ return (attr_a->data.constant_tarval != attr_b->data.constant_tarval);
'
},
"emit" => '. stw %S2, %O(%S1)\t\t\t/* Store(%S2) -> (%S1), (%A1, %A2) */',
"cmp_attr" =>
'
- return (attr_a->constant_tarval!=attr_b->constant_tarval);
+ return (attr_a->data.constant_tarval != attr_b->data.constant_tarval);
'
},
"emit" => '. lfd %D1, %O(%S1)\t\t\t/* Load(%O(%S1)) -> %D1 */',
"cmp_attr" =>
'
- return (attr_a->constant_tarval!=attr_b->constant_tarval);
+ return (attr_a->data.constant_tarval != attr_b->data.constant_tarval);
'
},
"emit" => '. lfs %D1, %O(%S1)\t\t\t/* Load(%O(%S1)) -> %D1 */',
"cmp_attr" =>
'
- return (attr_a->constant_tarval!=attr_b->constant_tarval);
+ return (attr_a->data.constant_tarval != attr_b->data.constant_tarval);
'
},
"emit" => '. stfd %S2, %O(%S1)\t\t\t/* Store(%S2) -> (%S1), (%A1, %A2) */',
"cmp_attr" =>
'
- return (attr_a->constant_tarval!=attr_b->constant_tarval);
+ return (attr_a->data.constant_tarval != attr_b->data.constant_tarval);
'
},
"emit" => '. stfs %S2, %O(%S1)\t\t\t/* Store(%S2) -> (%S1), (%A1, %A2) */',
"cmp_attr" =>
'
- return (attr_a->constant_tarval!=attr_b->constant_tarval);
+ return (attr_a->data.constant_tarval != attr_b->data.constant_tarval);
'
},
switch(to_mode)
{
case irm_D: SKIP;
+ default:
+ break;
}
break;
{
case irm_F:
return new_rd_ppc32_fRsp(env->dbg, env->irg, env->block, op, env->mode);
+ default:
+ break;
}
break;
case irm_Is:
case irm_Iu:
SKIP;
+ default:
+ break;
}
break;
return own_gen_Andi_dot_lo16(env, op, 0xff);
case irm_Hs:
return new_rd_ppc32_Extsh(env->dbg, env->irg, env->block, op, env->mode);
+ default:
+ break;
}
break;
SKIP;
case irm_Bs:
return new_rd_ppc32_Extsb(env->dbg, env->irg, env->block, op, env->mode);
+ default:
+ break;
}
break;
case irm_P:
if(to_mode==irm_Is || to_mode==irm_Iu) SKIP;
break;
+ default:
+ break;
}
fprintf(stderr, "Mode for Conv not supported: %s -> %s\n",
*/
static ir_node *gen_Abs(ppc32_transform_env_t *env, ir_node *op) {
int shift = 7;
+ ir_node *n1,*n2;
+
switch(get_nice_modecode(env->mode))
{
case irm_F:
case irm_D:
return new_rd_ppc32_fAbs(env->dbg, env->irg, env->block, op, env->mode);
-
- {
- ir_node *n1,*n2;
case irm_Is:
shift += 16;
case irm_Hs:
set_ppc32_offset_mode(n1, ppc32_ao_None);
n2 = new_rd_ppc32_Add(env->dbg, env->irg, env->block, op, n1, env->mode);
return new_rd_ppc32_Xor(env->dbg, env->irg, env->block, n2, n1, env->mode);
- }
+ default:
+ break;
}
fprintf(stderr, "Mode for Abs not supported: %s\n", get_mode_name(env->mode));
assert(0);
if(!entry->ent) {
char buf[80];
- sprintf(buf, "const_%i", get_irn_node_nr(env->irn));
+ sprintf(buf, "const_%ld", get_irn_node_nr(env->irn));
ent = new_entity(get_glob_type(), new_id_from_str(buf), tp);
set_entity_ld_ident(ent, get_entity_ident(ent));
/* set the entry for hashmap */
entry->ent = ent;
- } // TODO: Wird nicht richtig in global type gesteckt, ppc32_gen_decls.c findet ihn nicht
+ } // TODO: Wird nicht richtig in global type gesteckt, ppc32_gen_decls.c findet ihn nicht
symcnst = new_rd_ppc32_SymConst(env->dbg, env->irg, env->block, env->mode);
set_ppc32_frame_entity(symcnst, ent);
* @param env the debug module
*/
void ppc32_transform_const(ir_node *node, void *env) {
- ppc32_code_gen_t *cgenv = (ppc32_code_gen_t *)env;
- opcode code = get_irn_opcode(node);
- ir_node *asm_node = NULL;
+ ppc32_code_gen_t *cgenv = (ppc32_code_gen_t *)env;
+ ir_node *asm_node = NULL;
ppc32_transform_env_t tenv;
if (is_Block(node))
return;
- tenv.block = get_nodes_block(node);
- tenv.dbg = get_irn_dbg_info(node);
- tenv.irg = current_ir_graph;
- tenv.irn = node;
- tenv.mod = cgenv->mod;
- tenv.mode = get_irn_mode(node);
+ tenv.block = get_nodes_block(node);
+ tenv.dbg = get_irn_dbg_info(node);
+ tenv.irg = current_ir_graph;
+ tenv.irn = node;
+ tenv.mod = cgenv->mod;
+ tenv.mode = get_irn_mode(node);
-#define OTHER_GEN(a) \
- if (get_irn_op(node) == get_op_##a()) { \
- asm_node = gen_##a(&tenv); \
+#define OTHER_GEN(a) \
+ if (get_irn_op(node) == get_op_##a()) { \
+ asm_node = gen_##a(&tenv); \
}
DBG((tenv.mod, LEVEL_1, "check %+F ... ", node));
else {
DB((tenv.mod, LEVEL_1, "ignored\n"));
}
+#undef OTHER_GEN
}