-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
internal: prepare for code generator improvements (#852)
## Summary Introduce the `Body` data type, meant for storing a self-contained procedure body, and integrate it into each code generator. While only the procedure's code is stored in `Body` so far, the idea is to have it store all other body-related input data once moving to a data-oriented design for the IR. ## Details #### Architectural changes * the code generators now require a `Body` instead of a free-standing `CgNode` as input, of which they take ownership * `generateIR` returns a `Body` instance instead of a free-standing `CgNode` Each code generator stores the `Body` in its internal procedure context type. #### Additional C and JS code generator changes * merge each partial body into the procedure's total body. While not necessary at the moment, it will be, once `Body` starts storing more than just the `CgNode` #### Additional VM code generator changes * `PProc` is turned into a non-`ref` object type, made private, and renamed to `BProc` (the name also used by the C code generator) * `bestEffort` is turned from a procedure into a field of `BProc`, allowing the register allocation procedures to take a `BProc` as input, instead of the broader `TCtx` * the setup of `BProc` plus initial address-taken analysis is moved into a common procedure, making procedure and expression/statement code generation more uniform * both `genExpr` and `genStmt` now return the required amount of registers, instead of the callsite having to manually query the value Instead of incrementally generating the code for partial procedures, `vmbackend` accumulates the `CgNode` code and only invokes the code generator once the procedures are complete, which greatly simplifies the partial-procedure-related logic
- Loading branch information
Showing
13 changed files
with
154 additions
and
148 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.