mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-25 04:02:41 +01:00
Reuse a bunch of cached subtargets and remove getSubtarget calls
without a Function argument. llvm-svn: 227647
This commit is contained in:
parent
99e74b090b
commit
c020244686
@ -127,8 +127,7 @@ struct RxSBGOperands {
|
||||
};
|
||||
|
||||
class SystemZDAGToDAGISel : public SelectionDAGISel {
|
||||
const SystemZTargetLowering &Lowering;
|
||||
const SystemZSubtarget &Subtarget;
|
||||
const SystemZSubtarget *Subtarget;
|
||||
|
||||
// Used by SystemZOperands.td to create integer constants.
|
||||
inline SDValue getImm(const SDNode *Node, uint64_t Imm) const {
|
||||
@ -140,7 +139,7 @@ class SystemZDAGToDAGISel : public SelectionDAGISel {
|
||||
}
|
||||
|
||||
const SystemZInstrInfo *getInstrInfo() const {
|
||||
return getTargetMachine().getSubtargetImpl()->getInstrInfo();
|
||||
return Subtarget->getInstrInfo();
|
||||
}
|
||||
|
||||
// Try to fold more of the base or index of AM into AM, where IsBase
|
||||
@ -315,9 +314,12 @@ class SystemZDAGToDAGISel : public SelectionDAGISel {
|
||||
|
||||
public:
|
||||
SystemZDAGToDAGISel(SystemZTargetMachine &TM, CodeGenOpt::Level OptLevel)
|
||||
: SelectionDAGISel(TM, OptLevel),
|
||||
Lowering(*TM.getSubtargetImpl()->getTargetLowering()),
|
||||
Subtarget(*TM.getSubtargetImpl()) {}
|
||||
: SelectionDAGISel(TM, OptLevel) {}
|
||||
|
||||
bool runOnMachineFunction(MachineFunction &MF) override {
|
||||
Subtarget = &MF.getSubtarget<SystemZSubtarget>();
|
||||
return SelectionDAGISel::runOnMachineFunction(MF);
|
||||
}
|
||||
|
||||
// Override MachineFunctionPass.
|
||||
const char *getPassName() const override {
|
||||
@ -897,7 +899,7 @@ SDNode *SystemZDAGToDAGISel::tryRISBGZero(SDNode *N) {
|
||||
|
||||
unsigned Opcode = SystemZ::RISBG;
|
||||
EVT OpcodeVT = MVT::i64;
|
||||
if (VT == MVT::i32 && Subtarget.hasHighWord()) {
|
||||
if (VT == MVT::i32 && Subtarget->hasHighWord()) {
|
||||
Opcode = SystemZ::RISBMux;
|
||||
OpcodeVT = MVT::i32;
|
||||
RISBG.Start &= 31;
|
||||
|
@ -80,9 +80,9 @@ static MachineOperand earlyUseOperand(MachineOperand Op) {
|
||||
return Op;
|
||||
}
|
||||
|
||||
SystemZTargetLowering::SystemZTargetLowering(const TargetMachine &tm)
|
||||
: TargetLowering(tm),
|
||||
Subtarget(tm.getSubtarget<SystemZSubtarget>()) {
|
||||
SystemZTargetLowering::SystemZTargetLowering(const TargetMachine &tm,
|
||||
const SystemZSubtarget &STI)
|
||||
: TargetLowering(tm), Subtarget(STI) {
|
||||
MVT PtrVT = getPointerTy();
|
||||
|
||||
// Set up the register classes.
|
||||
@ -677,8 +677,8 @@ LowerFormalArguments(SDValue Chain, CallingConv::ID CallConv, bool IsVarArg,
|
||||
MachineRegisterInfo &MRI = MF.getRegInfo();
|
||||
SystemZMachineFunctionInfo *FuncInfo =
|
||||
MF.getInfo<SystemZMachineFunctionInfo>();
|
||||
auto *TFL = static_cast<const SystemZFrameLowering *>(
|
||||
DAG.getSubtarget().getFrameLowering());
|
||||
auto *TFL =
|
||||
static_cast<const SystemZFrameLowering *>(Subtarget.getFrameLowering());
|
||||
|
||||
// Assign locations to all of the incoming arguments.
|
||||
SmallVector<CCValAssign, 16> ArgLocs;
|
||||
@ -917,8 +917,7 @@ SystemZTargetLowering::LowerCall(CallLoweringInfo &CLI,
|
||||
RegsToPass[I].second.getValueType()));
|
||||
|
||||
// Add a register mask operand representing the call-preserved registers.
|
||||
const TargetRegisterInfo *TRI =
|
||||
getTargetMachine().getSubtargetImpl()->getRegisterInfo();
|
||||
const TargetRegisterInfo *TRI = Subtarget.getRegisterInfo();
|
||||
const uint32_t *Mask = TRI->getCallPreservedMask(CallConv);
|
||||
assert(Mask && "Missing call preserved mask for calling convention");
|
||||
Ops.push_back(DAG.getRegisterMask(Mask));
|
||||
@ -2614,8 +2613,8 @@ static unsigned forceReg(MachineInstr *MI, MachineOperand &Base,
|
||||
MachineBasicBlock *
|
||||
SystemZTargetLowering::emitSelect(MachineInstr *MI,
|
||||
MachineBasicBlock *MBB) const {
|
||||
const SystemZInstrInfo *TII = static_cast<const SystemZInstrInfo *>(
|
||||
MBB->getParent()->getSubtarget().getInstrInfo());
|
||||
const SystemZInstrInfo *TII =
|
||||
static_cast<const SystemZInstrInfo *>(Subtarget.getInstrInfo());
|
||||
|
||||
unsigned DestReg = MI->getOperand(0).getReg();
|
||||
unsigned TrueReg = MI->getOperand(1).getReg();
|
||||
@ -2663,8 +2662,8 @@ SystemZTargetLowering::emitCondStore(MachineInstr *MI,
|
||||
MachineBasicBlock *MBB,
|
||||
unsigned StoreOpcode, unsigned STOCOpcode,
|
||||
bool Invert) const {
|
||||
const SystemZInstrInfo *TII = static_cast<const SystemZInstrInfo *>(
|
||||
MBB->getParent()->getSubtarget().getInstrInfo());
|
||||
const SystemZInstrInfo *TII =
|
||||
static_cast<const SystemZInstrInfo *>(Subtarget.getInstrInfo());
|
||||
|
||||
unsigned SrcReg = MI->getOperand(0).getReg();
|
||||
MachineOperand Base = MI->getOperand(1);
|
||||
@ -2733,7 +2732,7 @@ SystemZTargetLowering::emitAtomicLoadBinary(MachineInstr *MI,
|
||||
bool Invert) const {
|
||||
MachineFunction &MF = *MBB->getParent();
|
||||
const SystemZInstrInfo *TII =
|
||||
static_cast<const SystemZInstrInfo *>(MF.getSubtarget().getInstrInfo());
|
||||
static_cast<const SystemZInstrInfo *>(Subtarget.getInstrInfo());
|
||||
MachineRegisterInfo &MRI = MF.getRegInfo();
|
||||
bool IsSubWord = (BitSize < 32);
|
||||
|
||||
@ -2853,7 +2852,7 @@ SystemZTargetLowering::emitAtomicLoadMinMax(MachineInstr *MI,
|
||||
unsigned BitSize) const {
|
||||
MachineFunction &MF = *MBB->getParent();
|
||||
const SystemZInstrInfo *TII =
|
||||
static_cast<const SystemZInstrInfo *>(MF.getSubtarget().getInstrInfo());
|
||||
static_cast<const SystemZInstrInfo *>(Subtarget.getInstrInfo());
|
||||
MachineRegisterInfo &MRI = MF.getRegInfo();
|
||||
bool IsSubWord = (BitSize < 32);
|
||||
|
||||
@ -2965,7 +2964,7 @@ SystemZTargetLowering::emitAtomicCmpSwapW(MachineInstr *MI,
|
||||
MachineBasicBlock *MBB) const {
|
||||
MachineFunction &MF = *MBB->getParent();
|
||||
const SystemZInstrInfo *TII =
|
||||
static_cast<const SystemZInstrInfo *>(MF.getSubtarget().getInstrInfo());
|
||||
static_cast<const SystemZInstrInfo *>(Subtarget.getInstrInfo());
|
||||
MachineRegisterInfo &MRI = MF.getRegInfo();
|
||||
|
||||
// Extract the operands. Base can be a register or a frame index.
|
||||
@ -3082,7 +3081,7 @@ SystemZTargetLowering::emitExt128(MachineInstr *MI,
|
||||
bool ClearEven, unsigned SubReg) const {
|
||||
MachineFunction &MF = *MBB->getParent();
|
||||
const SystemZInstrInfo *TII =
|
||||
static_cast<const SystemZInstrInfo *>(MF.getSubtarget().getInstrInfo());
|
||||
static_cast<const SystemZInstrInfo *>(Subtarget.getInstrInfo());
|
||||
MachineRegisterInfo &MRI = MF.getRegInfo();
|
||||
DebugLoc DL = MI->getDebugLoc();
|
||||
|
||||
@ -3114,7 +3113,7 @@ SystemZTargetLowering::emitMemMemWrapper(MachineInstr *MI,
|
||||
unsigned Opcode) const {
|
||||
MachineFunction &MF = *MBB->getParent();
|
||||
const SystemZInstrInfo *TII =
|
||||
static_cast<const SystemZInstrInfo *>(MF.getSubtarget().getInstrInfo());
|
||||
static_cast<const SystemZInstrInfo *>(Subtarget.getInstrInfo());
|
||||
MachineRegisterInfo &MRI = MF.getRegInfo();
|
||||
DebugLoc DL = MI->getDebugLoc();
|
||||
|
||||
@ -3284,7 +3283,7 @@ SystemZTargetLowering::emitStringWrapper(MachineInstr *MI,
|
||||
unsigned Opcode) const {
|
||||
MachineFunction &MF = *MBB->getParent();
|
||||
const SystemZInstrInfo *TII =
|
||||
static_cast<const SystemZInstrInfo *>(MF.getSubtarget().getInstrInfo());
|
||||
static_cast<const SystemZInstrInfo *>(Subtarget.getInstrInfo());
|
||||
MachineRegisterInfo &MRI = MF.getRegInfo();
|
||||
DebugLoc DL = MI->getDebugLoc();
|
||||
|
||||
|
@ -198,7 +198,8 @@ class SystemZTargetMachine;
|
||||
|
||||
class SystemZTargetLowering : public TargetLowering {
|
||||
public:
|
||||
explicit SystemZTargetLowering(const TargetMachine &TM);
|
||||
explicit SystemZTargetLowering(const TargetMachine &TM,
|
||||
const SystemZSubtarget &STI);
|
||||
|
||||
// Override TargetLowering.
|
||||
MVT getScalarShiftAmountTy(EVT LHSTy) const override {
|
||||
|
@ -12,12 +12,12 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
class SystemZFeature<string extname, string intname, string desc>
|
||||
: Predicate<"Subtarget.has"##intname##"()">,
|
||||
: Predicate<"Subtarget->has"##intname##"()">,
|
||||
AssemblerPredicate<"Feature"##intname, extname>,
|
||||
SubtargetFeature<extname, "Has"##intname, "true", desc>;
|
||||
|
||||
class SystemZMissingFeature<string intname>
|
||||
: Predicate<"!Subtarget.has"##intname##"()">;
|
||||
: Predicate<"!Subtarget->has"##intname##"()">;
|
||||
|
||||
def FeatureDistinctOps : SystemZFeature<
|
||||
"distinct-ops", "DistinctOps",
|
||||
|
@ -45,7 +45,7 @@ SystemZSubtarget::SystemZSubtarget(const std::string &TT,
|
||||
HasLoadStoreOnCond(false), HasHighWord(false), HasFPExtension(false),
|
||||
HasFastSerialization(false), HasInterlockedAccess1(false),
|
||||
TargetTriple(TT), InstrInfo(initializeSubtargetDependencies(CPU, FS)),
|
||||
TLInfo(TM), TSInfo(*TM.getDataLayout()), FrameLowering() {}
|
||||
TLInfo(TM, *this), TSInfo(*TM.getDataLayout()), FrameLowering() {}
|
||||
|
||||
// Return true if GV binds locally under reloc model RM.
|
||||
static bool bindsLocally(const GlobalValue *GV, Reloc::Model RM) {
|
||||
|
Loading…
Reference in New Issue
Block a user