Language Passes

Passes

The language passes are divided into three phases:

  1. Post Parse
  2. Expression Type Verification
  3. Miscellaneous

Phase 1, PostParse, works like this:

  1. All of the version statements are resolved for the entire module.
  2. Then, for each Module, Class, Struct, and Enum's TopLevelBlock:
    1. Apply all attributes in the current block or its direct children.
    2. Add symbols to scope in the current block or its direct children.
    3. Then do those steps for for each child TopLevelBlock that brings in a new scope (Classes, Enums, Structs).
  3. Resolve the imports.
  4. 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.