Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

compiler: introduce an IR for the code generators #551

Merged
merged 21 commits into from
Aug 6, 2023

Commits on Feb 20, 2023

  1. Configuration menu
    Copy the full SHA
    a8279ad View commit details
    Browse the repository at this point in the history
  2. vm: separate argument processing from opcExpandToAst

    The operation now expects its operands to be `NimNode`s already. A new
    instruction (`opcDataToAst`) is introduced for creating the AST
    representation of VM data.
    
    While also simplifying the VM a bit, the main reason behind the change is
    to not having to provide the full AST of the template call expression,
    as doing so is not possible when the code generator no longer operates
    on `PNode` AST.
    zerbina committed Feb 20, 2023
    Configuration menu
    Copy the full SHA
    5394c32 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    3059da1 View commit details
    Browse the repository at this point in the history

Commits on Aug 3, 2023

  1. Configuration menu
    Copy the full SHA
    90a7a08 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    792f2d3 View commit details
    Browse the repository at this point in the history
  3. ccgexprs: remove node flag usage

    The `nfAllFieldsSet` flag stopped reaching the code generator with the
    introduction of the MIR, meaning that the condition always evaluates to
    'true'.
    zerbina committed Aug 3, 2023
    Configuration menu
    Copy the full SHA
    007098d View commit details
    Browse the repository at this point in the history
  4. canonicalize the main procedure's body

    The C and JS code-gen orchestrators were passing the AST produced for
    the main procedure directly to the code generators. This is no longer
    going to work once the code generators don't work with `PNode` anymore,
    so `canonicalize` is now used on the AST.
    zerbina committed Aug 3, 2023
    Configuration menu
    Copy the full SHA
    e35e7f6 View commit details
    Browse the repository at this point in the history
  5. vmaux: decouple findMatchingBranch from PNode

    Instead of an integer-literal node, the procedure now accepts the value
    directly.
    zerbina committed Aug 3, 2023
    Configuration menu
    Copy the full SHA
    603b51e View commit details
    Browse the repository at this point in the history
  6. add the code-generator IR

    `astgen` is adjusted to produce `CgNode` instead of `PNode`. For this,
    multiple `PNode` -> `CgNode` translation procedures had to be
    introduced and `canUseView` + `flattenExpr` duplicated and adjusted for
    `CgNode`. The general processing logic stays the same.
    
    The module's document comment is also adjusted and an outdated mention
    of "sections" (they are called "regions" in the MIR) fixed.
    
    `astgen` as the name doesn't make much sense anymore and is going to be
    changed to something more fitting.
    zerbina committed Aug 3, 2023
    Configuration menu
    Copy the full SHA
    158b76e View commit details
    Browse the repository at this point in the history
  7. mirbridge/backend: use CgNode

    `canonicalize` and `generateAST` now return `CgNode` trees. For debug
    rendering, a `treeRepr` procedure for `CgNode` is added to the
    `cgirutils` module.
    zerbina committed Aug 3, 2023
    Configuration menu
    Copy the full SHA
    eb3099a View commit details
    Browse the repository at this point in the history
  8. vmgen: decouple the emit procedures from PNode

    The instruction-emission procedure now accept a `TLineInfo` as input
    directly, instead of, unnecessarily, requiring a `PNode`. Wrappers that
    still use `PNode` are added for convenience.
    zerbina committed Aug 3, 2023
    Configuration menu
    Copy the full SHA
    8e301b2 View commit details
    Browse the repository at this point in the history
  9. cgirutils: use CgNode

    zerbina committed Aug 3, 2023
    Configuration menu
    Copy the full SHA
    1d36474 View commit details
    Browse the repository at this point in the history
  10. update the code generators

    All three code generators now use the `CgNode` IR. The changes to the
    modules are kept minimal in order to make review easier.
    
    As an additional way to keep the amount of changes smaller, the `compat`
    module is introduced.
    zerbina committed Aug 3, 2023
    Configuration menu
    Copy the full SHA
    7f36d1a View commit details
    Browse the repository at this point in the history
  11. ast_types: remove the codegenExprNodeKinds set

    It's obsolete now.
    zerbina committed Aug 3, 2023
    Configuration menu
    Copy the full SHA
    756d2ab View commit details
    Browse the repository at this point in the history
  12. Configuration menu
    Copy the full SHA
    8499b48 View commit details
    Browse the repository at this point in the history
  13. Configuration menu
    Copy the full SHA
    941b3f7 View commit details
    Browse the repository at this point in the history
  14. rename astgen to cgirgen

    In addition, the module is moved to the `backend` directory.
    zerbina committed Aug 3, 2023
    Configuration menu
    Copy the full SHA
    4565463 View commit details
    Browse the repository at this point in the history

Commits on Aug 4, 2023

  1. Configuration menu
    Copy the full SHA
    1e950cd View commit details
    Browse the repository at this point in the history
  2. cgir: rename childs to kids

    zerbina committed Aug 4, 2023
    Configuration menu
    Copy the full SHA
    3b7139e View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    1092b3f View commit details
    Browse the repository at this point in the history
  4. docs: update mentions of astgen

    The module is named `cgirgen` now. `debug.rst` also contained outdated
    mentions of `PNode` being the IR the code generators -- this is fixed
    too.
    zerbina committed Aug 4, 2023
    Configuration menu
    Copy the full SHA
    6775403 View commit details
    Browse the repository at this point in the history