Skip to content

Improve IR support for structs #19

Description

@dubiousconst282

Structs are currently almost always keept in exposed local variable slots, making it difficult for transforms to check for legality since there's almost no data-flow info.

TODOs:

  • Consider making Variables always "semi-exposed", so that they always provide a symbolic byref/pointer.
    • Removes the need for Var Load/Store/Addr instructions
    • Problem: would require the instantiation of a ByrefType for every type instance in a local var.
  • Implement some kind of analysis like Memory SSA
    • Maintaining a parallel IR may be a bit inconvenient given the current infra. We may want instead to consider some hybrid with scalar SSA and the exposed flag to match heap objects, so that we can make assumptions like "Span<T> instances being always read-only".
      A problem with this hybrid is that we'd still need some way to take the SSA address when calling instance methods/field accesses, and if we're not careful this could bring more issues than it'd solve (consider inlining something like void M() { this = default; }).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions