Skip to content

Commit

Permalink
fix stupid cg bug
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander.nutz committed Oct 23, 2024
1 parent dc9be58 commit 82a324a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 14 deletions.
7 changes: 4 additions & 3 deletions cg/x86_stupid/cg.c
Original file line number Diff line number Diff line change
Expand Up @@ -1604,8 +1604,6 @@ void vx_cg_x86stupid_gen(vx_IrBlock* block, FILE* out) {
.argLoc = loc
};
}

id_f ++;
}
else {
Location* loc;
Expand All @@ -1627,9 +1625,12 @@ void vx_cg_x86stupid_gen(vx_IrBlock* block, FILE* out) {
.argLoc = loc
};
}
}

if (var.type->base.isfloat)
id_f ++;
else
id_i ++;
}
}

free(varsHotFirst);
Expand Down
13 changes: 2 additions & 11 deletions ir/ir.c
Original file line number Diff line number Diff line change
Expand Up @@ -365,31 +365,20 @@ int vx_CU_compile(vx_CU * cu,
if (cu->blocks[i].type == VX_CU_BLOCK_IR) { vx_IrBlock* block = cu->blocks[i].v.ir; code; } \
}

FOR_BLOCK({
if (optionalOptimizedSsaIr != NULL)
vx_IrBlock_dump(block, optionalOptimizedSsaIr, 0);
});

FOR_BLOCK({
vx_CIrBlock_fix(block); // TODO: why...
vx_CIrBlock_normalize(block);
vx_CIrBlock_mksa_states(block);
vx_CIrBlock_mksa_final(block);
vx_CIrBlock_fix(block); // TODO: why...

puts("post CIR lower:");
vx_IrBlock_dump(block, stdout, 0);

if (vx_ir_verify(block) != 0)
return 1;
});

FOR_BLOCK({
opt(block);

puts("post SSA IR opt:");
vx_IrBlock_dump(block, stdout, 0); // TODO remove

if (optionalOptimizedSsaIr != NULL)
vx_IrBlock_dump(block, optionalOptimizedSsaIr, 0);

Expand All @@ -413,6 +402,8 @@ int vx_CU_compile(vx_CU * cu,

llir_prep_lower(block);

vx_IrBlock_dump(block, stdout, 0);

if (optionalAsm)
vx_cg_x86stupid_gen(block, optionalAsm);
});
Expand Down

0 comments on commit 82a324a

Please sign in to comment.