Skip to content

cmd/compile: merge order/walk/instrument into buildssa #17728

Open
@mdempsky

Description

@mdempsky

Currently the compiler backend performs several stages of Node AST rewrites before generating SSA. We should investigate generating SSA directly from the AST produced by the frontend. Rationale:

  1. order.go exists as a separate pass primarily to simplify maintaining order-of-evaluation in walk.go, but we can probably just as easily handle this when directly producing SSA.
  2. order.go and walk.go iterate across the entire function AST a couple times, reading and writing to every pointer slot. Usually the values written are also identical to the values already in memory too.
  3. AST rewrites requires the intermediary format to be representable in the AST too, which may complicate transitioning to package syntax. There are currently several gc.Ops generated and used only within the backend (e.g., OSQRT, OINDREGSP, OEFACE, ...).
  4. The AST invariants between these phases are poorly documented or at least poorly understood.

/cc @randall77 @josharian

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions