Skip to content

Commit

Permalink
Simplify.
Browse files Browse the repository at this point in the history
  • Loading branch information
rui314 committed Sep 1, 2018
1 parent 04df768 commit d8cc52f
Showing 1 changed file with 1 addition and 10 deletions.
11 changes: 1 addition & 10 deletions regalloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,32 +99,23 @@ void alloc_regs(Program *prog) {

for (int i = 0; i < prog->funcs->len; i++) {
Function *fn = prog->funcs->data[i];

for (int i = 0; i < fn->bbs->len; i++) {
BB *bb = fn->bbs->data[i];
three_to_two(bb);
}
}

for (int i = prog->funcs->len - 1; i >= 0; i--) {
Function *fn = prog->funcs->data[i];

for (int i = fn->bbs->len - 1; i >= 0; i--) {
BB *bb = fn->bbs->data[i];

for (int i = bb->ir->len - 1; i >= 0; i--) {
IR *ir = bb->ir->data[i];
mark_last_use(ir);
}
}
}

for (int i = 0; i < prog->funcs->len; i++) {
Function *fn = prog->funcs->data[i];

for (int i = 0; i < fn->bbs->len; i++) {
BB *bb = fn->bbs->data[i];
alloc(bb->param);

for (int i = 0; i < bb->ir->len; i++) {
IR *ir = bb->ir->data[i];
regalloc(ir);
Expand Down

0 comments on commit d8cc52f

Please sign in to comment.