Skip to content

Store all instructions in one Vec? #215

Open
@Rua

Description

In my code I'm looking to make a lookup table of all ids in the module, with the place in the module where it's defined. But because the data representation splits instructions by section, it's not as easy to identify a specific instruction. You'd have to store the section, function and block along with the instruction index, then there's some fiddly logic to look the instruction up again.

I propose an alternative representation instead. All instructions go in a single large Vec, and the sections, functions and blocks are stored as Range<usize> instead. An instruction is then uniquely identifiable by an index, while it's trivial to create slices to any of these smaller pieces if needed. I can try to implement this if you want, but because it's a breaking change I wanted to ask if you're ok with it first. It may be more awkward to implement Builder with this scheme.

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions