diff options
author | Quentin Carbonneaux <quentin.carbonneaux@yale.edu> | 2015-08-22 16:02:12 -0400 |
---|---|---|
committer | Quentin Carbonneaux <quentin.carbonneaux@yale.edu> | 2015-09-15 23:01:32 -0400 |
commit | 390c5addd6c59075066138547285c17a9d3f49d9 (patch) | |
tree | f10d184b41cb97347eeb811918061f76e819d015 | |
parent | 1eb875882480c83787507f2668fae6e58094444c (diff) | |
download | roux-390c5addd6c59075066138547285c17a9d3f49d9.tar.gz |
output labels only when necessary
-rw-r--r-- | lisc/emit.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/lisc/emit.c b/lisc/emit.c index 278f579..140edab 100644 --- a/lisc/emit.c +++ b/lisc/emit.c @@ -319,8 +319,17 @@ emitfn(Fn *fn, FILE *f) fs = framesz(fn); if (fs) fprintf(f, "\tsub $%d, %%rsp\n", fs); + for (b=fn->start; b; b=b->link) + b->visit = 0; for (b=fn->start; b; b=b->link) { - fprintf(f, ".L%s:\n", b->name); + if (b->s1 && b->link != b->s1) + b->s1->visit++; + if (b->s2 && b->link != b->s2) + b->s2->visit++; + } + for (b=fn->start; b; b=b->link) { + if (b->visit != 0) + fprintf(f, ".L%s:\n", b->name); for (i=b->ins; i-b->ins < b->nins; i++) eins(*i, fn, f); switch (b->jmp.type) { |