Skip to content

Commit 808f13e

Browse files
committed
CodeGen: Remove TRI argument from getRegClass
TargetInstrInfo now directly holds a reference to TargetRegisterInfo and does not need TRI passed in anywhere.
1 parent 532af14 commit 808f13e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+95
-118
lines changed

llvm/include/llvm/CodeGen/TargetInstrInfo.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,9 +140,8 @@ class LLVM_ABI TargetInstrInfo : public MCInstrInfo {
140140

141141
/// Given a machine instruction descriptor, returns the register
142142
/// class constraint for OpNum, or NULL.
143-
virtual const TargetRegisterClass *
144-
getRegClass(const MCInstrDesc &MCID, unsigned OpNum,
145-
const TargetRegisterInfo *TRI) const;
143+
virtual const TargetRegisterClass *getRegClass(const MCInstrDesc &MCID,
144+
unsigned OpNum) const;
146145

147146
/// Returns true if MI is an instruction we are unable to reason about
148147
/// (like a call or something with unmodeled side effects).

llvm/lib/CodeGen/AggressiveAntiDepBreaker.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ void AggressiveAntiDepBreaker::PrescanInstruction(
395395
// Note register reference...
396396
const TargetRegisterClass *RC = nullptr;
397397
if (i < MI.getDesc().getNumOperands())
398-
RC = TII->getRegClass(MI.getDesc(), i, TRI);
398+
RC = TII->getRegClass(MI.getDesc(), i);
399399
AggressiveAntiDepState::RegisterReference RR = { &MO, RC };
400400
RegRefs.emplace(Reg.asMCReg(), RR);
401401
}
@@ -479,7 +479,7 @@ void AggressiveAntiDepBreaker::ScanInstruction(MachineInstr &MI,
479479
// Note register reference...
480480
const TargetRegisterClass *RC = nullptr;
481481
if (i < MI.getDesc().getNumOperands())
482-
RC = TII->getRegClass(MI.getDesc(), i, TRI);
482+
RC = TII->getRegClass(MI.getDesc(), i);
483483
AggressiveAntiDepState::RegisterReference RR = { &MO, RC };
484484
RegRefs.emplace(Reg.asMCReg(), RR);
485485
}

llvm/lib/CodeGen/BreakFalseDeps.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ bool BreakFalseDeps::pickBestRegisterForUndef(MachineInstr *MI, unsigned OpIdx,
133133
}
134134

135135
// Get the undef operand's register class
136-
const TargetRegisterClass *OpRC = TII->getRegClass(MI->getDesc(), OpIdx, TRI);
136+
const TargetRegisterClass *OpRC = TII->getRegClass(MI->getDesc(), OpIdx);
137137
assert(OpRC && "Not a valid register class");
138138

139139
// If the instruction has a true dependency, we can hide the false depdency

llvm/lib/CodeGen/CriticalAntiDepBreaker.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ void CriticalAntiDepBreaker::PrescanInstruction(MachineInstr &MI) {
187187
const TargetRegisterClass *NewRC = nullptr;
188188

189189
if (i < MI.getDesc().getNumOperands())
190-
NewRC = TII->getRegClass(MI.getDesc(), i, TRI);
190+
NewRC = TII->getRegClass(MI.getDesc(), i);
191191

192192
// For now, only allow the register to be changed if its register
193193
// class is consistent across all uses.
@@ -316,7 +316,7 @@ void CriticalAntiDepBreaker::ScanInstruction(MachineInstr &MI, unsigned Count) {
316316

317317
const TargetRegisterClass *NewRC = nullptr;
318318
if (i < MI.getDesc().getNumOperands())
319-
NewRC = TII->getRegClass(MI.getDesc(), i, TRI);
319+
NewRC = TII->getRegClass(MI.getDesc(), i);
320320

321321
// For now, only allow the register to be changed if its register
322322
// class is consistent across all uses.

llvm/lib/CodeGen/GlobalISel/Utils.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ Register llvm::constrainOperandRegClass(
114114
// Assume physical registers are properly constrained.
115115
assert(Reg.isVirtual() && "PhysReg not implemented");
116116

117-
const TargetRegisterClass *OpRC = TII.getRegClass(II, OpIdx, &TRI);
117+
const TargetRegisterClass *OpRC = TII.getRegClass(II, OpIdx);
118118
// Some of the target independent instructions, like COPY, may not impose any
119119
// register class constraints on some of their operands: If it's a use, we can
120120
// skip constraining as the instruction defining the register would constrain

llvm/lib/CodeGen/InitUndef.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ bool InitUndef::processBasicBlock(MachineFunction &MF, MachineBasicBlock &MBB,
232232
MachineOperand &UseMO = MI.getOperand(UseOpIdx);
233233
if (UseMO.getReg() == MCRegister::NoRegister) {
234234
const TargetRegisterClass *RC =
235-
TII->getRegClass(MI.getDesc(), UseOpIdx, TRI);
235+
TII->getRegClass(MI.getDesc(), UseOpIdx);
236236
Register NewDest = MRI->createVirtualRegister(RC);
237237
// We don't have a way to update dead lanes, so keep track of the
238238
// new register so that we avoid querying it later.

llvm/lib/CodeGen/MachineInstr.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -978,7 +978,7 @@ MachineInstr::getRegClassConstraint(unsigned OpIdx,
978978
assert(getMF() && "Can't have an MF reference here!");
979979
// Most opcodes have fixed constraints in their MCInstrDesc.
980980
if (!isInlineAsm())
981-
return TII->getRegClass(getDesc(), OpIdx, TRI);
981+
return TII->getRegClass(getDesc(), OpIdx);
982982

983983
if (!getOperand(OpIdx).isReg())
984984
return nullptr;

llvm/lib/CodeGen/MachineLICM.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1420,7 +1420,7 @@ MachineInstr *MachineLICMImpl::ExtractHoistableLoad(MachineInstr *MI,
14201420
if (NewOpc == 0) return nullptr;
14211421
const MCInstrDesc &MID = TII->get(NewOpc);
14221422
MachineFunction &MF = *MI->getMF();
1423-
const TargetRegisterClass *RC = TII->getRegClass(MID, LoadRegIndex, TRI);
1423+
const TargetRegisterClass *RC = TII->getRegClass(MID, LoadRegIndex);
14241424
// Ok, we're unfolding. Create a temporary register and do the unfold.
14251425
Register Reg = MRI->createVirtualRegister(RC);
14261426

llvm/lib/CodeGen/MachineVerifier.cpp

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2635,8 +2635,7 @@ MachineVerifier::visitMachineOperand(const MachineOperand *MO, unsigned MONum) {
26352635
return;
26362636
}
26372637
if (MONum < MCID.getNumOperands()) {
2638-
if (const TargetRegisterClass *DRC =
2639-
TII->getRegClass(MCID, MONum, TRI)) {
2638+
if (const TargetRegisterClass *DRC = TII->getRegClass(MCID, MONum)) {
26402639
if (!DRC->contains(Reg)) {
26412640
report("Illegal physical register for instruction", MO, MONum);
26422641
OS << printReg(Reg, TRI) << " is not a "
@@ -2720,12 +2719,11 @@ MachineVerifier::visitMachineOperand(const MachineOperand *MO, unsigned MONum) {
27202719
// has register class constraint, the virtual register must
27212720
// comply to it.
27222721
if (!isPreISelGenericOpcode(MCID.getOpcode()) &&
2723-
MONum < MCID.getNumOperands() &&
2724-
TII->getRegClass(MCID, MONum, TRI)) {
2722+
MONum < MCID.getNumOperands() && TII->getRegClass(MCID, MONum)) {
27252723
report("Virtual register does not match instruction constraint", MO,
27262724
MONum);
27272725
OS << "Expect register class "
2728-
<< TRI->getRegClassName(TII->getRegClass(MCID, MONum, TRI))
2726+
<< TRI->getRegClassName(TII->getRegClass(MCID, MONum))
27292727
<< " but got nothing\n";
27302728
return;
27312729
}
@@ -2751,8 +2749,7 @@ MachineVerifier::visitMachineOperand(const MachineOperand *MO, unsigned MONum) {
27512749
}
27522750
}
27532751
if (MONum < MCID.getNumOperands()) {
2754-
if (const TargetRegisterClass *DRC =
2755-
TII->getRegClass(MCID, MONum, TRI)) {
2752+
if (const TargetRegisterClass *DRC = TII->getRegClass(MCID, MONum)) {
27562753
if (SubIdx) {
27572754
const TargetRegisterClass *SuperRC =
27582755
TRI->getLargestLegalSuperClass(RC, *MF);

llvm/lib/CodeGen/RegisterCoalescer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1374,7 +1374,7 @@ bool RegisterCoalescer::reMaterializeTrivialDef(const CoalescerPair &CP,
13741374
}
13751375

13761376
const unsigned DefSubIdx = DefMI->getOperand(0).getSubReg();
1377-
const TargetRegisterClass *DefRC = TII->getRegClass(MCID, 0, TRI);
1377+
const TargetRegisterClass *DefRC = TII->getRegClass(MCID, 0);
13781378
if (!DefMI->isImplicitDef()) {
13791379
if (DstReg.isPhysical()) {
13801380
Register NewDstReg = DstReg;

0 commit comments

Comments
 (0)