Skip to content

Make LLVM code generation consume TypedProgram instead of the syntax view #407

Closed

Description

@LunaStev

Problem

The compiler now constructs parser::hir::TypedProgram, but src/runner.rs immediately calls hir.syntax() and the LLVM backend re-runs expression analysis over cloned AST nodes. This discards the typed HIR boundary and keeps LLVM coupled to legacy AST inference.

Scope

  • Change the LLVM codegen entry points to accept TypedProgram or a stable backend-neutral HIR view.
  • Read expression types and resolved semantic facts from HIR identities.
  • Remove the duplicate analyze_expression_types call in llvm/src/codegen/ir.rs.
  • Eliminate backend reliance on expression address identity and thread-local semantic maps.
  • Preserve current code generation for already supported language constructs.
  • Do not implement Whale migration in this issue; this is also preparation for Track LLVM backend retirement and migration to Whale #93.

Completion criteria

  • The CLI does not pass hir.syntax() as the codegen contract.
  • LLVM does not repeat frontend semantic analysis.
  • Existing codegen and C ABI regressions remain green.
  • Variant metadata can be queried by the backend even if full variant lowering is delivered separately.
  • The public frontend/backend boundary is documented.

Activity

  1. added
    enhancement
    help wanted
    refactor
    technical debt
    on Aug 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementhelp wantedrefactortechnical debt

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions