Commit 48071aea authored by Matthias Braun's avatar Matthias Braun
Browse files

- at blockstart emit list of predblocks in comment

- when turning adressmode nodes back to normal nodes, set base and index input
  to NoReg
parent f4359333
......@@ -1967,7 +1967,7 @@ static void ia32_emit_align_label(FILE *F, cpu_support cpu) {
unsigned align; unsigned maximum_skip;
/* gcc doesn't emit alignment for p4 ?*/
if (cpu == arch_pentium_4)
if (cpu == arch_pentium_4)
return;
switch (cpu) {
......@@ -1993,7 +1993,10 @@ static void ia32_emit_align_label(FILE *F, cpu_support cpu) {
static void ia32_gen_block(ir_node *block, void *env) {
ia32_emit_env_t *emit_env = env;
const ir_node *irn;
char cmd_buf[SNPRINTF_BUF_LEN];
char cmnt_buf[SNPRINTF_BUF_LEN];
int need_label = block != get_irg_start_block(get_irn_irg(block));
FILE *F = emit_env->out;
if (! is_Block(block))
return;
......@@ -2005,10 +2008,40 @@ static void ia32_gen_block(ir_node *block, void *env) {
}
if (need_label) {
int i, arity;
char* predstring = cmnt_buf;
size_t cmntsize;
int res;
ia32_emit_align_label(emit_env->out, emit_env->isa->opt_arch);
fprintf(emit_env->out, BLOCK_PREFIX("%ld:\n"), get_irn_node_nr(block));
ir_snprintf(cmd_buf, sizeof(cmd_buf), BLOCK_PREFIX("%d:"),
get_irn_node_nr(block));
/* emit list of pred blocks in comment */
cmntsize = sizeof(cmnt_buf);
res = snprintf(predstring, cmntsize, "/* preds: ");
cmntsize -= res;
predstring += res;
arity = get_irn_arity(block);
for(i = 0; i < arity; ++i) {
ir_node *predblock = get_Block_cfgpred_block(block, i);
res = snprintf(predstring, cmntsize, " %ld", get_irn_node_nr(predblock));
cmntsize -= res;
predstring += res;
if(cmntsize <= 3)
break;
}
if(cmntsize < 3) {
predstring = cmnt_buf + sizeof(cmnt_buf) - 3;
cmntsize = 3;
}
snprintf(predstring, cmntsize, "*/");
fprintf(F, "%-43s %-60s\n", cmd_buf, cmnt_buf);
}
/* emit the contents of the block */
sched_foreach(block, irn) {
ia32_emit_node(irn, env);
}
......
......@@ -350,7 +350,7 @@ end: ;
*/
static void fix_am_source(ir_node *irn, void *env) {
ia32_code_gen_t *cg = env;
ir_node *base, *index;
ir_node *base, *index, *noreg;
const arch_register_t *reg_base, *reg_index;
const ia32_register_req_t **reqs;
int n_res, i;
......@@ -366,6 +366,8 @@ static void fix_am_source(ir_node *irn, void *env) {
reg_index = arch_get_irn_register(cg->arch_env, index);
reqs = get_ia32_out_req_all(irn);
noreg = ia32_new_NoReg_gp(cg);
n_res = get_ia32_n_res(irn);
for (i = 0; i < n_res; i++) {
......@@ -428,6 +430,8 @@ static void fix_am_source(ir_node *irn, void *env) {
set_irn_n(irn, 3, load);
/* this is a normal node now */
set_irn_n(irn, 0, noreg);
set_irn_n(irn, 1, noreg);
set_ia32_op_type(irn, ia32_Normal);
break;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment