Skip to content

Commit

Permalink
Remove redundant code
Browse files Browse the repository at this point in the history
  • Loading branch information
vacantron committed Nov 21, 2023
1 parent edde5a8 commit 4b823b3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
5 changes: 1 addition & 4 deletions src/arm-codegen.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,13 @@ void cfg_flatten()
flatten_ir = add_ph2_ir(OP_define);
flatten_ir->src0 = fn->func->stack_size;

int flag = 0;
basic_block_t *bb;
for (bb = fn->bbs; bb; bb = bb->rpo_next) {
bb->elf_offset = elf_offset;

if (!flag) {
if (bb == fn->bbs)
/* save ra, sp */
elf_offset += 16;
flag = 1;
}

ph2_ir_t *inst;
for (inst = bb->ph2_ir_list.head; inst; inst = inst->next) {
Expand Down
5 changes: 1 addition & 4 deletions src/riscv-codegen.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,13 @@ void cfg_flatten()
flatten_ir = add_ph2_ir(OP_define);
flatten_ir->src0 = fn->func->stack_size;

int flag = 0;
basic_block_t *bb;
for (bb = fn->bbs; bb; bb = bb->rpo_next) {
bb->elf_offset = elf_offset;

if (!flag) {
if (bb == fn->bbs)
/* save ra, sp */
elf_offset += 8;
flag = 1;
}

ph2_ir_t *inst;
for (inst = bb->ph2_ir_list.head; inst; inst = inst->next) {
Expand Down

0 comments on commit 4b823b3

Please sign in to comment.