Skip to content

[CodeGen] Refactor MachineInstr findRegisterDefOperandIdx/findRegisterDefOperand etc. to stop missing TRI args #82659

@RKSimon

Description

@RKSimon

As noticed by @AtariDreams on #82411, by having the TargetRegisterInfo argument at the end of a long line of optional args, we are often missing it in our function calls and not correctly testing for super reg kill state etc.

  int findRegisterUseOperandIdx(Register Reg, bool isKill = false, const TargetRegisterInfo *TRI = nullptr) const;
  MachineOperand *findRegisterUseOperand(Register Reg, bool isKill = false, const TargetRegisterInfo *TRI = nullptr);
  ... etc ...

ideally we need to refactor the calls so the TRI is no longer optional, so when we don't care about super-registers we explicitly have to set it nullptr.

  int findRegisterUseOperandIdx(Register Reg, const TargetRegisterInfo *TRI, bool isKill = false) const;
  MachineOperand *findRegisterUseOperand(Register Reg, const TargetRegisterInfo *TRI, bool isKill = false);
  ... etc ...

Metadata

Metadata

Assignees

Labels

good first issuehttps://github.com/llvm/llvm-project/contributellvm:codegen

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions