Skip to content

Commit 0df7143

Browse files
committed
[ARM][Mips][PowerPC] Remove unnecessary static_cast creating GISel InstructionSelector. NFC
Some targets only pass a TargetMachine & to their subtarget constructor and require a static_cast to their target-specific TargetMachine subclass to create *InstructionSelector. These 3 targets already have the correct TargetMachine subclass reference so no cast is needed.
1 parent dcf70e1 commit 0df7143

File tree

3 files changed

+3
-6
lines changed

3 files changed

+3
-6
lines changed

llvm/lib/Target/ARM/ARMSubtarget.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,7 @@ ARMSubtarget::ARMSubtarget(const Triple &TT, const std::string &CPU,
111111
// FIXME: At this point, we can't rely on Subtarget having RBI.
112112
// It's awkward to mix passing RBI and the Subtarget; should we pass
113113
// TII/TRI as well?
114-
InstSelector.reset(createARMInstructionSelector(
115-
*static_cast<const ARMBaseTargetMachine *>(&TM), *this, *RBI));
114+
InstSelector.reset(createARMInstructionSelector(TM, *this, *RBI));
116115

117116
RegBankInfo.reset(RBI);
118117
}

llvm/lib/Target/Mips/MipsSubtarget.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,8 +217,7 @@ MipsSubtarget::MipsSubtarget(const Triple &TT, StringRef CPU, StringRef FS,
217217

218218
auto *RBI = new MipsRegisterBankInfo(*getRegisterInfo());
219219
RegBankInfo.reset(RBI);
220-
InstSelector.reset(createMipsInstructionSelector(
221-
*static_cast<const MipsTargetMachine *>(&TM), *this, *RBI));
220+
InstSelector.reset(createMipsInstructionSelector(TM, *this, *RBI));
222221
}
223222

224223
bool MipsSubtarget::isPositionIndependent() const {

llvm/lib/Target/PowerPC/PPCSubtarget.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,7 @@ PPCSubtarget::PPCSubtarget(const Triple &TT, const std::string &CPU,
6565
auto *RBI = new PPCRegisterBankInfo(*getRegisterInfo());
6666
RegBankInfo.reset(RBI);
6767

68-
InstSelector.reset(createPPCInstructionSelector(
69-
*static_cast<const PPCTargetMachine *>(&TM), *this, *RBI));
68+
InstSelector.reset(createPPCInstructionSelector(TM, *this, *RBI));
7069
}
7170

7271
void PPCSubtarget::initializeEnvironment() {

0 commit comments

Comments
 (0)