Language Passes
The language passes are divided into three phases:
- Post Parse
- Expression Type Verification
- Miscellaneous
Phase 1, PostParse, works like this:
- All of the version statements are resolved for the entire module.
- Then, for each Module, Class, Struct, and Enum's TopLevelBlock:
- Apply all attributes in the current block or its direct children.
- Add symbols to scope in the current block or its direct children.
- Then do those steps for for each child TopLevelBlock that brings in a new scope (Classes, Enums, Structs).
- Resolve the imports.
- Go from top to bottom resolving static ifs (applying step 2 to the selected TopLevelBlock).
Phase 2, Semantic, is a complex step that resolves and typechecks any expressions. This pass is only run for modules that are passed directly to the LanguagePass.transform function, or functions that are invoked by static ifs.
Phase 3, Lowering, are various lowering and transformation passes, some can invoke Phase 1 and 2 on newly generated code.
Pages
Post Parsing Passes | Passes that are run after parsing. |
Semantic Passes | Semantic passes check for errors and resolves implicit types. |
Lowering Passes | Lowers ir before being passed off to the backend. |
Classes
LanguagePass | Centre point for all language passes. |
VoltLanguagePass | Default implementation of LanguagePass, replace this if you wish to any of the semantics of the language. |
ImageGatherer | Collects various things that needs to emitted per image. |
MissingDeps | Looks for missing dependancies via imports. |
MangleWriter | Apply mangle symbols to Types and Functions. |
CFGBuilder | Builds and checks CFGs on Functions. |
ExpFolder | Folds any expressions into Constants. |
ExTyper | If type casting were to be strict, type T could only go to type T without an explicit cast. Implicit casts are places where the language deems automatic conversion safe enough to insert casts for the user. |
IrVerifier | This verifier is design to catch faulty IR (from the view of the backends) that the LanguagePass generate. |
Gatherer | Populate the scopes with Variables, Aliases, Functions, and Types. Adds Scopes where needed as well. |
ConditionalRemoval | A pass that removes version and debug blocks, not static ifs. |
AttribRemoval | A pass that turns Attributes nodes into fields on to Functions, Classes and the like. |
ScopeReplacer | Module containing the ScopeReplacer class. |
ImportResolver | Resolves imports on a single module. |