Skip to content

Commit

Permalink
Add note about the DUMP environemnt variable
Browse files Browse the repository at this point in the history
  • Loading branch information
vlasakm committed Aug 3, 2023
1 parent ea5a079 commit 93e5a3c
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 2 deletions.
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,3 +83,14 @@ Build and run time dependencies:
Run time dependencies:

- [`nasm`](https://www.nasm.us/), for assembling support (i.e. not `-S`)


## Insight

The compiler stays mostly silent. To get more insight into the passes that
constitute it, set the `DUMP` environment variable, which will print functions
after each pass. For example:

```
DUMP=1 build/tcg tests/in/critical_edge.tc
```
1 change: 0 additions & 1 deletion src/backend/inst.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ print_mfunction(FILE *f, MFunction *mfunction)
}
}


void
dump_mfunction_after_pass(MFunction *mfunction, const char *pass_name)
{
Expand Down
7 changes: 7 additions & 0 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,13 @@ parse_source(ErrorContext *ec, Arena *arena, Str source)
arena_restore(arena, arena_start);
longjmp(ec->loc, 1);
}

if (DUMP) {
fprintf(stderr, "After parsing:\n");
print_module(stderr, module);
fprintf(stderr, "\n\n");
}

return module;
}

Expand Down
1 change: 0 additions & 1 deletion src/middleend/ir.c
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,6 @@ print_function(FILE *f, Function *function)
}
}
validate_function(function);
fprintf(f, "\n\n");
}

bool
Expand Down

0 comments on commit 93e5a3c

Please sign in to comment.