Skip to content

Merge Address Mode emit helpers to a single method #9534

Description

@tannergooding

Currently, we have several emitIns methods to support the various address modes we emit.

These include:

  • emitIns_R_AR(instruction ins, emitAttr attr, regNumber ireg, regNumber base, int disp)
  • emitIns_R_AI(instruction ins, emitAttr attr, regNumber ireg, ssize_t disp)
  • emitIns_R_ARR(instruction ins, emitAttr attr, regNumber ireg, regNumber base, regNumber index, int disp)
  • emitIns_R_ARX(instruction ins, emitAttr attr, regNumber ireg, regNumber base, regNumber index, unsigned mul, int disp)
  • emitIns_R_AX(instruction ins, emitAttr attr, regNumber ireg, regNumber reg, unsigned mul, int disp)

In most cases, these are all doing the same thing and the difference is the parameters that are passed in (baseReg/base, indxReg/index, scale/mul, and offs/disp).

These values are general pulled from an Indir node which correctly sets the defaults on these when unused (reg = REG_NA, scale = 1, offs = 0).

It may be useful (and would allow us to simplify some other code) if we combined these into a single emitIns_R_A method and relied on the correct defaults being set when they are unused (adding in asserts to ensure that they are correct, of course)

  • emitIns_R_A(instruction ins, emitAttr attr, regNumber reg1, regNumber baseReg, regNumber indxReg, size_t scale, ssize_t offs)

There are some others (in the form of emitIns_A*_R) that could probably also be combined into a single emitIns_A_R method

category:implementation
theme:emitter
skill-level:intermediate
cost:medium
impact:medium

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMIenhancementProduct code improvement that does NOT require public API changes/additionshelp wanted[up-for-grabs] Good issue for external contributors

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions