Skip to content

Commit

Permalink
free more unused regs
Browse files Browse the repository at this point in the history
  • Loading branch information
Jimmy Zhuo committed Jul 9, 2012
1 parent eddba64 commit c36f3e8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/gencode.c
Original file line number Diff line number Diff line change
Expand Up @@ -2010,6 +2010,7 @@ gencode_var(M1_compiler *comp, m1_var *v) {
INS (M0_ADD_I, "%I, %I, %I", index.no, index.no, one.no);

iter = iter->next;
free_reg(comp, res);
}
free_reg(comp, index);
free_reg(comp, one);
Expand Down Expand Up @@ -2152,6 +2153,7 @@ gencode_expr(M1_compiler *comp, m1_expression *e) {

INS (M0_DEREF, "%R, %R, %R", target, parent, index);

free_reg(comp, index);
pushreg(comp->regstack, target);
--num_regs; /* popped 2, pushed 1. */
}
Expand Down
2 changes: 1 addition & 1 deletion src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ main(int argc, char *argv[]) {
yyscan_t yyscanner;
M1_compiler comp;
int turnoff_reg_opt = 0;
char *outputfile = "a.m1";
char *outputfile = "a.m0";

if (argc <= 1) {
fprintf(stderr, "Usage: m1 <file>\n");
Expand Down

0 comments on commit c36f3e8

Please sign in to comment.