const ia32_register_req_t *irn_req;
long node_pos = pos == -1 ? 0 : pos;
ir_mode *mode = is_Block(irn) ? NULL : get_irn_mode(irn);
- firm_dbg_module_t *mod = firm_dbg_register(DEBUG_MODULE);
+ FIRM_DBG_REGISTER(firm_dbg_module_t *mod, DEBUG_MODULE);
if (is_Block(irn) || mode == mode_M || mode == mode_X) {
DBG((mod, LEVEL_1, "ignoring Block, mode_M, mode_X node %+F\n", irn));
ia32_code_gen_t *cg = self;
firm_dbg_module_t *old_mod = cg->mod;
- cg->mod = firm_dbg_register("firm.be.ia32.transform");
+ FIRM_DBG_REGISTER(cg->mod, "firm.be.ia32.transform");
irg_walk_blkwise_graph(cg->irg, ia32_place_consts_set_modes, ia32_transform_node, cg);
be_dump(cg->irg, "-transformed", dump_ir_block_graph_sched);
}
}
+ /* If we have a CondJmp with immediate, we need to */
+ /* check if it's the right operand, otherwise we have */
+ /* to change it, as CMP doesn't support immediate as */
+ /* left operands. */
+ if (is_ia32_CondJmp(irn) && (is_ia32_ImmConst(irn) || is_ia32_ImmSymConst(irn)) && op_tp == ia32_AddrModeS) {
+ long pnc = get_negated_pnc(get_ia32_pncode(irn), get_ia32_res_mode(irn));
+ set_ia32_op_type(irn, ia32_AddrModeD);
+ set_ia32_pncode(irn, pnc);
+ }
+
/* check if there is a sub which need to be transformed */
ia32_transform_sub_to_neg_add(irn, cg);
reg = arch_get_irn_register(env->cg->arch_env, irn);
arch_set_irn_register(env->cg->arch_env, new_op, reg);
- exchange(irn, proj);
+ SET_IA32_ORIG_NODE(new_op, ia32_get_old_node_name(env));
+ exchange(irn, proj);
}
/**
set_ia32_am_support(new_op, ia32_am_Dest);
set_ia32_op_type(new_op, ia32_AddrModeD);
set_ia32_am_flavour(new_op, ia32_B);
- set_ia32_ls_mode(new_op, get_irn_mode(val));
+ set_ia32_ls_mode(new_op, mode);
set_ia32_frame_ent(new_op, ent);
set_ia32_use_frame(new_op);
sched_remove(irn);
}
- exchange(irn, proj);
+ SET_IA32_ORIG_NODE(new_op, ia32_get_old_node_name(env));
+ exchange(irn, proj);
}
/**
transform_to_Load(&tenv);
}
else if (be_is_Spill(node)) {
- tenv.mode = get_irn_mode(be_get_Spill_context(node));
+ /* we always spill the whole register */
+ tenv.mode = mode_is_float(get_irn_mode(be_get_Spill_context(node))) ? mode_D : mode_Is;
transform_to_Store(&tenv);
}
}
irg_walk_blkwise_graph(cg->irg, NULL, ia32_after_ra_walker, self);
/* if we do x87 code generation, rewrite all the virtual instructions and registers */
- if (USE_x87(cg)) {
+ if (cg->used_x87) {
x87_simulate_graph(cg->arch_env, cg->irg, cg->blk_sched);
be_dump(cg->irg, "-x87", dump_ir_extblock_graph_sched);
}
cg->impl = &ia32_code_gen_if;
cg->irg = birg->irg;
cg->reg_set = new_set(ia32_cmp_irn_reg_assoc, 1024);
- cg->mod = firm_dbg_register("firm.be.ia32.cg");
cg->out = F;
cg->arch_env = birg->main_env->arch_env;
cg->types = pmap_create();
cg->birg = birg;
cg->blk_sched = NULL;
cg->fp_kind = isa->fp_kind;
+ cg->used_x87 = 0;
+
+ FIRM_DBG_REGISTER(cg->mod, "firm.be.ia32.cg");
/* set optimizations */
cg->opt.incdec = 0;