Skip to content

Commit 727e9f5

Browse files
arsenms-barannikov
andauthored
CodeGen: Pass SubtargetInfo to TargetGenInstrInfo constructors (#157337)
This will make it possible for tablegen to make subtarget dependent decisions without adding new arguments to every target. --------- Co-authored-by: Sergei Barannikov <[email protected]>
1 parent 27af6bc commit 727e9f5

Some content is hidden

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

52 files changed

+113
-86
lines changed

llvm/lib/Target/AArch64/AArch64InstrInfo.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,8 @@ static cl::opt<unsigned> GatherOptSearchLimit(
9191
"machine-combiner gather pattern optimization"));
9292

9393
AArch64InstrInfo::AArch64InstrInfo(const AArch64Subtarget &STI)
94-
: AArch64GenInstrInfo(AArch64::ADJCALLSTACKDOWN, AArch64::ADJCALLSTACKUP,
95-
AArch64::CATCHRET),
94+
: AArch64GenInstrInfo(STI, AArch64::ADJCALLSTACKDOWN,
95+
AArch64::ADJCALLSTACKUP, AArch64::CATCHRET),
9696
RI(STI.getTargetTriple(), STI.getHwMode()), Subtarget(STI) {}
9797

9898
/// GetInstSize - Return the number of bytes of code the specified

llvm/lib/Target/AMDGPU/R600InstrInfo.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ using namespace llvm;
2929
#include "R600GenInstrInfo.inc"
3030

3131
R600InstrInfo::R600InstrInfo(const R600Subtarget &ST)
32-
: R600GenInstrInfo(-1, -1), RI(), ST(ST) {}
32+
: R600GenInstrInfo(ST, -1, -1), RI(), ST(ST) {}
3333

3434
bool R600InstrInfo::isVector(const MachineInstr &MI) const {
3535
return get(MI.getOpcode()).TSFlags & R600_InstFlag::VECTOR;

llvm/lib/Target/AMDGPU/SIInstrInfo.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ static cl::opt<bool> Fix16BitCopies(
6262
cl::ReallyHidden);
6363

6464
SIInstrInfo::SIInstrInfo(const GCNSubtarget &ST)
65-
: AMDGPUGenInstrInfo(AMDGPU::ADJCALLSTACKUP, AMDGPU::ADJCALLSTACKDOWN),
66-
RI(ST), ST(ST) {
65+
: AMDGPUGenInstrInfo(ST, AMDGPU::ADJCALLSTACKUP, AMDGPU::ADJCALLSTACKDOWN),
66+
RI(ST), ST(ST) {
6767
SchedModel.init(&ST);
6868
}
6969

llvm/lib/Target/ARC/ARCInstrInfo.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ enum TSFlagsConstants {
4444
void ARCInstrInfo::anchor() {}
4545

4646
ARCInstrInfo::ARCInstrInfo(const ARCSubtarget &ST)
47-
: ARCGenInstrInfo(ARC::ADJCALLSTACKDOWN, ARC::ADJCALLSTACKUP), RI(ST) {}
47+
: ARCGenInstrInfo(ST, ARC::ADJCALLSTACKDOWN, ARC::ADJCALLSTACKUP), RI(ST) {}
4848

4949
static bool isZeroImm(const MachineOperand &Op) {
5050
return Op.isImm() && Op.getImm() == 0;

llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,9 @@ static const ARM_MLxEntry ARM_MLxTable[] = {
107107
{ ARM::VMLSslfq, ARM::VMULslfq, ARM::VSUBfq, false, true },
108108
};
109109

110-
ARMBaseInstrInfo::ARMBaseInstrInfo(const ARMSubtarget& STI)
111-
: ARMGenInstrInfo(ARM::ADJCALLSTACKDOWN, ARM::ADJCALLSTACKUP),
112-
Subtarget(STI) {
110+
ARMBaseInstrInfo::ARMBaseInstrInfo(const ARMSubtarget &STI)
111+
: ARMGenInstrInfo(STI, ARM::ADJCALLSTACKDOWN, ARM::ADJCALLSTACKUP),
112+
Subtarget(STI) {
113113
for (unsigned i = 0, e = std::size(ARM_MLxTable); i != e; ++i) {
114114
if (!MLxEntryMap.insert(std::make_pair(ARM_MLxTable[i].MLxOpc, i)).second)
115115
llvm_unreachable("Duplicated entries?");

llvm/lib/Target/AVR/AVRInstrInfo.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@
2929

3030
namespace llvm {
3131

32-
AVRInstrInfo::AVRInstrInfo(AVRSubtarget &STI)
33-
: AVRGenInstrInfo(AVR::ADJCALLSTACKDOWN, AVR::ADJCALLSTACKUP), RI(),
32+
AVRInstrInfo::AVRInstrInfo(const AVRSubtarget &STI)
33+
: AVRGenInstrInfo(STI, AVR::ADJCALLSTACKDOWN, AVR::ADJCALLSTACKUP), RI(),
3434
STI(STI) {}
3535

3636
void AVRInstrInfo::copyPhysReg(MachineBasicBlock &MBB,

llvm/lib/Target/AVR/AVRInstrInfo.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ enum TOF {
6565
/// Utilities related to the AVR instruction set.
6666
class AVRInstrInfo : public AVRGenInstrInfo {
6767
public:
68-
explicit AVRInstrInfo(AVRSubtarget &STI);
68+
explicit AVRInstrInfo(const AVRSubtarget &STI);
6969

7070
const AVRRegisterInfo &getRegisterInfo() const { return RI; }
7171
const MCInstrDesc &getBrCond(AVRCC::CondCodes CC) const;

llvm/lib/Target/BPF/BPFInstrInfo.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
#include "BPFInstrInfo.h"
1414
#include "BPF.h"
15+
#include "BPFSubtarget.h"
1516
#include "llvm/ADT/SmallVector.h"
1617
#include "llvm/CodeGen/MachineBasicBlock.h"
1718
#include "llvm/CodeGen/MachineInstrBuilder.h"
@@ -25,8 +26,8 @@
2526

2627
using namespace llvm;
2728

28-
BPFInstrInfo::BPFInstrInfo()
29-
: BPFGenInstrInfo(BPF::ADJCALLSTACKDOWN, BPF::ADJCALLSTACKUP) {}
29+
BPFInstrInfo::BPFInstrInfo(const BPFSubtarget &STI)
30+
: BPFGenInstrInfo(STI, BPF::ADJCALLSTACKDOWN, BPF::ADJCALLSTACKUP) {}
3031

3132
void BPFInstrInfo::copyPhysReg(MachineBasicBlock &MBB,
3233
MachineBasicBlock::iterator I,

llvm/lib/Target/BPF/BPFInstrInfo.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,13 @@
2020
#include "BPFGenInstrInfo.inc"
2121

2222
namespace llvm {
23+
class BPFSubtarget;
2324

2425
class BPFInstrInfo : public BPFGenInstrInfo {
2526
const BPFRegisterInfo RI;
2627

2728
public:
28-
BPFInstrInfo();
29+
explicit BPFInstrInfo(const BPFSubtarget &STI);
2930

3031
const BPFRegisterInfo &getRegisterInfo() const { return RI; }
3132

llvm/lib/Target/BPF/BPFSubtarget.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ void BPFSubtarget::initSubtargetFeatures(StringRef CPU, StringRef FS) {
103103
BPFSubtarget::BPFSubtarget(const Triple &TT, const std::string &CPU,
104104
const std::string &FS, const TargetMachine &TM)
105105
: BPFGenSubtargetInfo(TT, CPU, /*TuneCPU*/ CPU, FS),
106-
FrameLowering(initializeSubtargetDependencies(CPU, FS)),
106+
InstrInfo(initializeSubtargetDependencies(CPU, FS)), FrameLowering(*this),
107107
TLInfo(TM, *this) {
108108
IsLittleEndian = TT.isLittleEndian();
109109

0 commit comments

Comments
 (0)