Skip to content

x64 New Assembler Ideas/Pain points #10238

@alexcrichton

Description

@alexcrichton

I've been poking at the new x64 assembler and I'm starting to accumulate a number of various things here and there so I wanted to write these down before I forgot. I had a rough high-level goal of "I'd like to implement mul (and imul) instructions" and it led to most of these issues:

  • Fixed registers don't show up in ISLE right now. We need to represent them as Gpr in Cranelift but something like Rax during fuzzing.
  • The first argument of many ISLE constructors is AssemblerReadWriteGpr but this technically isn't correct, they should all take AssemblerReadGpr (note the lack of "Write"). (x64: Refactor assembler ISLE constructors #10276)
  • Return values from ISLE are AssemblerReadWriteGpr, but like above they should probably be AssemblerReadGpr instead. Basically the "write" part should mostly just be an internal detail that the ISLE bindings don't expose. (x64: Refactor assembler ISLE constructors #10276)
  • Instructions that modify memory, such as x64_addb_mi, should probably have two constructors in ISLE: one for the version that modifies a register and one that modifies memory. The former would return AssemblerReadGpr and the latter would return SideEffectNoResult. (x64: Refactor assembler ISLE constructors #10276)
  • Instructions that return multiple results, such as mul, should return ValueRegs instead of a single GPR.
  • ISLE constructors for new instructions can overlap in priorities when the types are disjoint (e.g. no need to do 1-12, only 1-3 for within one type) (x64: rework new assembler rule priorities, remove old emission rules #10260)
  • Previous ISLE constructors/emit.rs should be removed instead of acting as a catch-all (to help catch mistakes and additionally gradually clean things up) (x64: rework new assembler rule priorities, remove old emission rules #10260)
  • If Assembler*Write* is removed from ISLE bindings (above bullets) then auto-conversions and various methods to/from other ISLE types should be removed as they shouldn't be necessary. (x64: Refactor assembler ISLE constructors #10276)

cc @abrown

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