Skip to content

Should load/store be typed and have sext/zext/trunc? #82

@jfbastien

Description

@jfbastien

Filing this issue to capture a discussion that occurred in PR #79.

load/store are often spec'd as having an explicit type, and as being able to implicitly sext/zext/trunc their inputs.

I'm wondering if instead load/store should:

  • Be sized to N bytes, and require explicit type cast for load outputs and store input.
  • Require implicit trunc for stores, and sext/zext for loads.

This is different from some compiler IRs, including LLVM's. However, the current stated goal for this format is to keep it simple, and expect the macro layer to capture redundancy. It seems like separating conversion, extension and truncation out of load/store fits the goal.

Keeping this simple doesn't prevent optimization. It's pretty easy to detect this pattern when doing instruction selection, if such an instruction even exists on the target architecture. It does mean the IR has lees magic, and is even easier to spec and implement in a dump interpreter.

Metadata

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