Skip to content

Commit 16266e1

Browse files
committed
X86: Stop overriding getRegClass
This function should not be virtual; making this virtual was an AMDGPU hack that should be removed not spread to other backends. This does not need to be overridden to reserve registers. The register reservation mechanism is orthogonal to to the register class constraints of the instruction, this should be reporting the underlying instruction constraint. The registers are separately reserved, so they will be removed from the allocation order anyway. If the actual class needs to change based on the subtarget, it should probably generalize the LookupPtrRegClass mechanism. This was added by #70958. The new tests there for the class are probably not useful anymore. These instead should compile to the end and try to stress the allocation behavior.
1 parent 4538818 commit 16266e1

File tree

2 files changed

+0
-24
lines changed

2 files changed

+0
-24
lines changed

llvm/lib/Target/X86/X86InstrInfo.cpp

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -93,21 +93,6 @@ X86InstrInfo::X86InstrInfo(const X86Subtarget &STI)
9393
X86::CATCHRET, (STI.is64Bit() ? X86::RET64 : X86::RET32)),
9494
Subtarget(STI), RI(STI.getTargetTriple()) {}
9595

96-
const TargetRegisterClass *X86InstrInfo::getRegClass(const MCInstrDesc &MCID,
97-
unsigned OpNum) const {
98-
auto *RC = TargetInstrInfo::getRegClass(MCID, OpNum);
99-
// If the target does not have egpr, then r16-r31 will be resereved for all
100-
// instructions.
101-
if (!RC || !Subtarget.hasEGPR())
102-
return RC;
103-
104-
if (X86II::canUseApxExtendedReg(MCID))
105-
return RC;
106-
107-
const X86RegisterInfo *RI = Subtarget.getRegisterInfo();
108-
return RI->constrainRegClassToNonRex2(RC);
109-
}
110-
11196
bool X86InstrInfo::isCoalescableExtInstr(const MachineInstr &MI,
11297
Register &SrcReg, Register &DstReg,
11398
unsigned &SubIdx) const {

llvm/lib/Target/X86/X86InstrInfo.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -240,15 +240,6 @@ class X86InstrInfo final : public X86GenInstrInfo {
240240
public:
241241
explicit X86InstrInfo(const X86Subtarget &STI);
242242

243-
/// Given a machine instruction descriptor, returns the register
244-
/// class constraint for OpNum, or NULL. Returned register class
245-
/// may be different from the definition in the TD file, e.g.
246-
/// GR*RegClass (definition in TD file)
247-
/// ->
248-
/// GR*_NOREX2RegClass (Returned register class)
249-
const TargetRegisterClass *getRegClass(const MCInstrDesc &MCID,
250-
unsigned OpNum) const override;
251-
252243
/// getRegisterInfo - TargetInstrInfo is a superset of MRegister info. As
253244
/// such, whenever a client has an instance of instruction info, it should
254245
/// always be able to get register info as well (through this method).

0 commit comments

Comments
 (0)