Cache TargetLowering on SelectionDAGISel and update previous

calls to getTargetLowering() with the cached variable.

llvm-svn: 219284
This commit is contained in:
Eric Christopher 2014-10-08 07:32:17 +00:00
parent 1b3b70e371
commit b17140de35
8 changed files with 57 additions and 78 deletions

View File

@ -52,6 +52,7 @@ public:
GCFunctionInfo *GFI; GCFunctionInfo *GFI;
CodeGenOpt::Level OptLevel; CodeGenOpt::Level OptLevel;
const TargetInstrInfo *TII; const TargetInstrInfo *TII;
const TargetLowering *TLI;
static char ID; static char ID;
@ -59,9 +60,7 @@ public:
CodeGenOpt::Level OL = CodeGenOpt::Default); CodeGenOpt::Level OL = CodeGenOpt::Default);
virtual ~SelectionDAGISel(); virtual ~SelectionDAGISel();
const TargetLowering *getTargetLowering() const { const TargetLowering *getTargetLowering() const { return TLI; }
return TM.getSubtargetImpl()->getTargetLowering();
}
void getAnalysisUsage(AnalysisUsage &AU) const override; void getAnalysisUsage(AnalysisUsage &AU) const override;

View File

@ -42,13 +42,12 @@ static cl::opt<signed> RegPressureThreshold(
cl::desc("Track reg pressure and switch priority to in-depth")); cl::desc("Track reg pressure and switch priority to in-depth"));
ResourcePriorityQueue::ResourcePriorityQueue(SelectionDAGISel *IS) ResourcePriorityQueue::ResourcePriorityQueue(SelectionDAGISel *IS)
: Picker(this), InstrItins(IS->getTargetLowering() : Picker(this), InstrItins(IS->TLI->getTargetMachine()
->getTargetMachine()
.getSubtargetImpl() .getSubtargetImpl()
->getInstrItineraryData()) { ->getInstrItineraryData()) {
const TargetMachine &TM = (*IS->MF).getTarget(); const TargetMachine &TM = (*IS->MF).getTarget();
TRI = TM.getSubtargetImpl()->getRegisterInfo(); TRI = TM.getSubtargetImpl()->getRegisterInfo();
TLI = IS->getTargetLowering(); TLI = IS->TLI;
TII = TM.getSubtargetImpl()->getInstrInfo(); TII = TM.getSubtargetImpl()->getInstrInfo();
ResourcesModel = TII->CreateTargetScheduleState(&TM, nullptr); ResourcesModel = TII->CreateTargetScheduleState(&TM, nullptr);
// This hard requirement could be relaxed, but for now // This hard requirement could be relaxed, but for now

View File

@ -3010,7 +3010,7 @@ llvm::createHybridListDAGScheduler(SelectionDAGISel *IS,
const TargetMachine &TM = IS->TM; const TargetMachine &TM = IS->TM;
const TargetInstrInfo *TII = TM.getSubtargetImpl()->getInstrInfo(); const TargetInstrInfo *TII = TM.getSubtargetImpl()->getInstrInfo();
const TargetRegisterInfo *TRI = TM.getSubtargetImpl()->getRegisterInfo(); const TargetRegisterInfo *TRI = TM.getSubtargetImpl()->getRegisterInfo();
const TargetLowering *TLI = IS->getTargetLowering(); const TargetLowering *TLI = IS->TLI;
HybridBURRPriorityQueue *PQ = HybridBURRPriorityQueue *PQ =
new HybridBURRPriorityQueue(*IS->MF, true, false, TII, TRI, TLI); new HybridBURRPriorityQueue(*IS->MF, true, false, TII, TRI, TLI);
@ -3026,7 +3026,7 @@ llvm::createILPListDAGScheduler(SelectionDAGISel *IS,
const TargetMachine &TM = IS->TM; const TargetMachine &TM = IS->TM;
const TargetInstrInfo *TII = TM.getSubtargetImpl()->getInstrInfo(); const TargetInstrInfo *TII = TM.getSubtargetImpl()->getInstrInfo();
const TargetRegisterInfo *TRI = TM.getSubtargetImpl()->getRegisterInfo(); const TargetRegisterInfo *TRI = TM.getSubtargetImpl()->getRegisterInfo();
const TargetLowering *TLI = IS->getTargetLowering(); const TargetLowering *TLI = IS->TLI;
ILPBURRPriorityQueue *PQ = ILPBURRPriorityQueue *PQ =
new ILPBURRPriorityQueue(*IS->MF, true, false, TII, TRI, TLI); new ILPBURRPriorityQueue(*IS->MF, true, false, TII, TRI, TLI);

View File

@ -7478,15 +7478,13 @@ static bool isOnlyUsedInEntryBlock(const Argument *A, bool FastISel) {
void SelectionDAGISel::LowerArguments(const Function &F) { void SelectionDAGISel::LowerArguments(const Function &F) {
SelectionDAG &DAG = SDB->DAG; SelectionDAG &DAG = SDB->DAG;
SDLoc dl = SDB->getCurSDLoc(); SDLoc dl = SDB->getCurSDLoc();
const TargetLowering *TLI = getTargetLowering();
const DataLayout *DL = TLI->getDataLayout(); const DataLayout *DL = TLI->getDataLayout();
SmallVector<ISD::InputArg, 16> Ins; SmallVector<ISD::InputArg, 16> Ins;
if (!FuncInfo->CanLowerReturn) { if (!FuncInfo->CanLowerReturn) {
// Put in an sret pointer parameter before all the other parameters. // Put in an sret pointer parameter before all the other parameters.
SmallVector<EVT, 1> ValueVTs; SmallVector<EVT, 1> ValueVTs;
ComputeValueVTs(*getTargetLowering(), ComputeValueVTs(*TLI, PointerType::getUnqual(F.getReturnType()), ValueVTs);
PointerType::getUnqual(F.getReturnType()), ValueVTs);
// NOTE: Assuming that a pointer will never break down to more than one VT // NOTE: Assuming that a pointer will never break down to more than one VT
// or one register. // or one register.
@ -7576,9 +7574,8 @@ void SelectionDAGISel::LowerArguments(const Function &F) {
// Call the target to set up the argument values. // Call the target to set up the argument values.
SmallVector<SDValue, 8> InVals; SmallVector<SDValue, 8> InVals;
SDValue NewRoot = TLI->LowerFormalArguments(DAG.getRoot(), F.getCallingConv(), SDValue NewRoot = TLI->LowerFormalArguments(
F.isVarArg(), Ins, DAG.getRoot(), F.getCallingConv(), F.isVarArg(), Ins, dl, DAG, InVals);
dl, DAG, InVals);
// Verify that the target's LowerFormalArguments behaved as expected. // Verify that the target's LowerFormalArguments behaved as expected.
assert(NewRoot.getNode() && NewRoot.getValueType() == MVT::Other && assert(NewRoot.getNode() && NewRoot.getValueType() == MVT::Other &&

View File

@ -284,7 +284,7 @@ namespace llvm {
/// for the target. /// for the target.
ScheduleDAGSDNodes* createDefaultScheduler(SelectionDAGISel *IS, ScheduleDAGSDNodes* createDefaultScheduler(SelectionDAGISel *IS,
CodeGenOpt::Level OptLevel) { CodeGenOpt::Level OptLevel) {
const TargetLowering *TLI = IS->getTargetLowering(); const TargetLowering *TLI = IS->TLI;
const TargetSubtargetInfo &ST = IS->MF->getSubtarget(); const TargetSubtargetInfo &ST = IS->MF->getSubtarget();
if (OptLevel == CodeGenOpt::None || ST.useMachineScheduler() || if (OptLevel == CodeGenOpt::None || ST.useMachineScheduler() ||
@ -425,7 +425,8 @@ bool SelectionDAGISel::runOnMachineFunction(MachineFunction &mf) {
NewOptLevel = CodeGenOpt::None; NewOptLevel = CodeGenOpt::None;
OptLevelChanger OLC(*this, NewOptLevel); OptLevelChanger OLC(*this, NewOptLevel);
TII = TM.getSubtargetImpl()->getInstrInfo(); TII = MF->getSubtarget().getInstrInfo();
TLI = MF->getSubtarget().getTargetLowering();
RegInfo = &MF->getRegInfo(); RegInfo = &MF->getRegInfo();
AA = &getAnalysis<AliasAnalysis>(); AA = &getAnalysis<AliasAnalysis>();
LibInfo = &getAnalysis<TargetLibraryInfo>(); LibInfo = &getAnalysis<TargetLibraryInfo>();
@ -903,7 +904,6 @@ void SelectionDAGISel::PrepareEHLandingPad() {
.addSym(Label); .addSym(Label);
// Mark exception register as live in. // Mark exception register as live in.
const TargetLowering *TLI = getTargetLowering();
const TargetRegisterClass *PtrRC = TLI->getRegClassFor(TLI->getPointerTy()); const TargetRegisterClass *PtrRC = TLI->getRegClassFor(TLI->getPointerTy());
if (unsigned Reg = TLI->getExceptionPointerRegister()) if (unsigned Reg = TLI->getExceptionPointerRegister())
FuncInfo->ExceptionPointerVirtReg = MBB->addLiveIn(Reg, PtrRC); FuncInfo->ExceptionPointerVirtReg = MBB->addLiveIn(Reg, PtrRC);
@ -1039,7 +1039,7 @@ void SelectionDAGISel::SelectAllBasicBlocks(const Function &Fn) {
// Initialize the Fast-ISel state, if needed. // Initialize the Fast-ISel state, if needed.
FastISel *FastIS = nullptr; FastISel *FastIS = nullptr;
if (TM.Options.EnableFastISel) if (TM.Options.EnableFastISel)
FastIS = getTargetLowering()->createFastISel(*FuncInfo, LibInfo); FastIS = TLI->createFastISel(*FuncInfo, LibInfo);
// Iterate over all basic blocks in the function. // Iterate over all basic blocks in the function.
ReversePostOrderTraversal<const Function*> RPOT(&Fn); ReversePostOrderTraversal<const Function*> RPOT(&Fn);
@ -1858,8 +1858,8 @@ SDNode
SDLoc dl(Op); SDLoc dl(Op);
MDNodeSDNode *MD = dyn_cast<MDNodeSDNode>(Op->getOperand(0)); MDNodeSDNode *MD = dyn_cast<MDNodeSDNode>(Op->getOperand(0));
const MDString *RegStr = dyn_cast<MDString>(MD->getMD()->getOperand(0)); const MDString *RegStr = dyn_cast<MDString>(MD->getMD()->getOperand(0));
unsigned Reg = getTargetLowering()->getRegisterByName( unsigned Reg =
RegStr->getString().data(), Op->getValueType(0)); TLI->getRegisterByName(RegStr->getString().data(), Op->getValueType(0));
SDValue New = CurDAG->getCopyFromReg( SDValue New = CurDAG->getCopyFromReg(
CurDAG->getEntryNode(), dl, Reg, Op->getValueType(0)); CurDAG->getEntryNode(), dl, Reg, Op->getValueType(0));
New->setNodeId(-1); New->setNodeId(-1);
@ -1871,8 +1871,8 @@ SDNode
SDLoc dl(Op); SDLoc dl(Op);
MDNodeSDNode *MD = dyn_cast<MDNodeSDNode>(Op->getOperand(1)); MDNodeSDNode *MD = dyn_cast<MDNodeSDNode>(Op->getOperand(1));
const MDString *RegStr = dyn_cast<MDString>(MD->getMD()->getOperand(0)); const MDString *RegStr = dyn_cast<MDString>(MD->getMD()->getOperand(0));
unsigned Reg = getTargetLowering()->getRegisterByName( unsigned Reg = TLI->getRegisterByName(RegStr->getString().data(),
RegStr->getString().data(), Op->getOperand(2).getValueType()); Op->getOperand(2).getValueType());
SDValue New = CurDAG->getCopyToReg( SDValue New = CurDAG->getCopyToReg(
CurDAG->getEntryNode(), dl, Reg, Op->getOperand(2)); CurDAG->getEntryNode(), dl, Reg, Op->getOperand(2));
New->setNodeId(-1); New->setNodeId(-1);
@ -2372,7 +2372,7 @@ static unsigned IsPredicateKnownToFail(const unsigned char *Table,
Result = !::CheckOpcode(Table, Index, N.getNode()); Result = !::CheckOpcode(Table, Index, N.getNode());
return Index; return Index;
case SelectionDAGISel::OPC_CheckType: case SelectionDAGISel::OPC_CheckType:
Result = !::CheckType(Table, Index, N, SDISel.getTargetLowering()); Result = !::CheckType(Table, Index, N, SDISel.TLI);
return Index; return Index;
case SelectionDAGISel::OPC_CheckChild0Type: case SelectionDAGISel::OPC_CheckChild0Type:
case SelectionDAGISel::OPC_CheckChild1Type: case SelectionDAGISel::OPC_CheckChild1Type:
@ -2382,14 +2382,15 @@ static unsigned IsPredicateKnownToFail(const unsigned char *Table,
case SelectionDAGISel::OPC_CheckChild5Type: case SelectionDAGISel::OPC_CheckChild5Type:
case SelectionDAGISel::OPC_CheckChild6Type: case SelectionDAGISel::OPC_CheckChild6Type:
case SelectionDAGISel::OPC_CheckChild7Type: case SelectionDAGISel::OPC_CheckChild7Type:
Result = !::CheckChildType(Table, Index, N, SDISel.getTargetLowering(), Result = !::CheckChildType(Table, Index, N, SDISel.TLI,
Table[Index-1] - SelectionDAGISel::OPC_CheckChild0Type); Table[Index - 1] -
SelectionDAGISel::OPC_CheckChild0Type);
return Index; return Index;
case SelectionDAGISel::OPC_CheckCondCode: case SelectionDAGISel::OPC_CheckCondCode:
Result = !::CheckCondCode(Table, Index, N); Result = !::CheckCondCode(Table, Index, N);
return Index; return Index;
case SelectionDAGISel::OPC_CheckValueType: case SelectionDAGISel::OPC_CheckValueType:
Result = !::CheckValueType(Table, Index, N, SDISel.getTargetLowering()); Result = !::CheckValueType(Table, Index, N, SDISel.TLI);
return Index; return Index;
case SelectionDAGISel::OPC_CheckInteger: case SelectionDAGISel::OPC_CheckInteger:
Result = !::CheckInteger(Table, Index, N); Result = !::CheckInteger(Table, Index, N);
@ -2742,7 +2743,7 @@ SelectCodeCommon(SDNode *NodeToMatch, const unsigned char *MatcherTable,
continue; continue;
case OPC_CheckType: case OPC_CheckType:
if (!::CheckType(MatcherTable, MatcherIndex, N, getTargetLowering())) if (!::CheckType(MatcherTable, MatcherIndex, N, TLI))
break; break;
continue; continue;
@ -2790,7 +2791,7 @@ SelectCodeCommon(SDNode *NodeToMatch, const unsigned char *MatcherTable,
MVT CaseVT = (MVT::SimpleValueType)MatcherTable[MatcherIndex++]; MVT CaseVT = (MVT::SimpleValueType)MatcherTable[MatcherIndex++];
if (CaseVT == MVT::iPTR) if (CaseVT == MVT::iPTR)
CaseVT = getTargetLowering()->getPointerTy(); CaseVT = TLI->getPointerTy();
// If the VT matches, then we will execute this case. // If the VT matches, then we will execute this case.
if (CurNodeVT == CaseVT) if (CurNodeVT == CaseVT)
@ -2812,7 +2813,7 @@ SelectCodeCommon(SDNode *NodeToMatch, const unsigned char *MatcherTable,
case OPC_CheckChild2Type: case OPC_CheckChild3Type: case OPC_CheckChild2Type: case OPC_CheckChild3Type:
case OPC_CheckChild4Type: case OPC_CheckChild5Type: case OPC_CheckChild4Type: case OPC_CheckChild5Type:
case OPC_CheckChild6Type: case OPC_CheckChild7Type: case OPC_CheckChild6Type: case OPC_CheckChild7Type:
if (!::CheckChildType(MatcherTable, MatcherIndex, N, getTargetLowering(), if (!::CheckChildType(MatcherTable, MatcherIndex, N, TLI,
Opcode-OPC_CheckChild0Type)) Opcode-OPC_CheckChild0Type))
break; break;
continue; continue;
@ -2820,7 +2821,7 @@ SelectCodeCommon(SDNode *NodeToMatch, const unsigned char *MatcherTable,
if (!::CheckCondCode(MatcherTable, MatcherIndex, N)) break; if (!::CheckCondCode(MatcherTable, MatcherIndex, N)) break;
continue; continue;
case OPC_CheckValueType: case OPC_CheckValueType:
if (!::CheckValueType(MatcherTable, MatcherIndex, N, getTargetLowering())) if (!::CheckValueType(MatcherTable, MatcherIndex, N, TLI))
break; break;
continue; continue;
case OPC_CheckInteger: case OPC_CheckInteger:
@ -3019,7 +3020,8 @@ SelectCodeCommon(SDNode *NodeToMatch, const unsigned char *MatcherTable,
for (unsigned i = 0; i != NumVTs; ++i) { for (unsigned i = 0; i != NumVTs; ++i) {
MVT::SimpleValueType VT = MVT::SimpleValueType VT =
(MVT::SimpleValueType)MatcherTable[MatcherIndex++]; (MVT::SimpleValueType)MatcherTable[MatcherIndex++];
if (VT == MVT::iPTR) VT = getTargetLowering()->getPointerTy().SimpleTy; if (VT == MVT::iPTR)
VT = TLI->getPointerTy().SimpleTy;
VTs.push_back(VT); VTs.push_back(VT);
} }

View File

@ -526,8 +526,7 @@ bool ARMDAGToDAGISel::SelectAddrModeImm12(SDValue N,
if (N.getOpcode() == ISD::FrameIndex) { if (N.getOpcode() == ISD::FrameIndex) {
// Match frame index. // Match frame index.
int FI = cast<FrameIndexSDNode>(N)->getIndex(); int FI = cast<FrameIndexSDNode>(N)->getIndex();
Base = CurDAG->getTargetFrameIndex(FI, Base = CurDAG->getTargetFrameIndex(FI, TLI->getPointerTy());
getTargetLowering()->getPointerTy());
OffImm = CurDAG->getTargetConstant(0, MVT::i32); OffImm = CurDAG->getTargetConstant(0, MVT::i32);
return true; return true;
} }
@ -550,8 +549,7 @@ bool ARMDAGToDAGISel::SelectAddrModeImm12(SDValue N,
Base = N.getOperand(0); Base = N.getOperand(0);
if (Base.getOpcode() == ISD::FrameIndex) { if (Base.getOpcode() == ISD::FrameIndex) {
int FI = cast<FrameIndexSDNode>(Base)->getIndex(); int FI = cast<FrameIndexSDNode>(Base)->getIndex();
Base = CurDAG->getTargetFrameIndex(FI, Base = CurDAG->getTargetFrameIndex(FI, TLI->getPointerTy());
getTargetLowering()->getPointerTy());
} }
OffImm = CurDAG->getTargetConstant(RHSC, MVT::i32); OffImm = CurDAG->getTargetConstant(RHSC, MVT::i32);
return true; return true;
@ -697,8 +695,7 @@ AddrMode2Type ARMDAGToDAGISel::SelectAddrMode2Worker(SDValue N,
Base = N; Base = N;
if (N.getOpcode() == ISD::FrameIndex) { if (N.getOpcode() == ISD::FrameIndex) {
int FI = cast<FrameIndexSDNode>(N)->getIndex(); int FI = cast<FrameIndexSDNode>(N)->getIndex();
Base = CurDAG->getTargetFrameIndex(FI, Base = CurDAG->getTargetFrameIndex(FI, TLI->getPointerTy());
getTargetLowering()->getPointerTy());
} else if (N.getOpcode() == ARMISD::Wrapper && } else if (N.getOpcode() == ARMISD::Wrapper &&
N.getOperand(0).getOpcode() != ISD::TargetGlobalAddress) { N.getOperand(0).getOpcode() != ISD::TargetGlobalAddress) {
Base = N.getOperand(0); Base = N.getOperand(0);
@ -718,8 +715,7 @@ AddrMode2Type ARMDAGToDAGISel::SelectAddrMode2Worker(SDValue N,
Base = N.getOperand(0); Base = N.getOperand(0);
if (Base.getOpcode() == ISD::FrameIndex) { if (Base.getOpcode() == ISD::FrameIndex) {
int FI = cast<FrameIndexSDNode>(Base)->getIndex(); int FI = cast<FrameIndexSDNode>(Base)->getIndex();
Base = CurDAG->getTargetFrameIndex(FI, Base = CurDAG->getTargetFrameIndex(FI, TLI->getPointerTy());
getTargetLowering()->getPointerTy());
} }
Offset = CurDAG->getRegister(0, MVT::i32); Offset = CurDAG->getRegister(0, MVT::i32);
@ -896,8 +892,7 @@ bool ARMDAGToDAGISel::SelectAddrMode3(SDValue N,
Base = N; Base = N;
if (N.getOpcode() == ISD::FrameIndex) { if (N.getOpcode() == ISD::FrameIndex) {
int FI = cast<FrameIndexSDNode>(N)->getIndex(); int FI = cast<FrameIndexSDNode>(N)->getIndex();
Base = CurDAG->getTargetFrameIndex(FI, Base = CurDAG->getTargetFrameIndex(FI, TLI->getPointerTy());
getTargetLowering()->getPointerTy());
} }
Offset = CurDAG->getRegister(0, MVT::i32); Offset = CurDAG->getRegister(0, MVT::i32);
Opc = CurDAG->getTargetConstant(ARM_AM::getAM3Opc(ARM_AM::add, 0),MVT::i32); Opc = CurDAG->getTargetConstant(ARM_AM::getAM3Opc(ARM_AM::add, 0),MVT::i32);
@ -911,8 +906,7 @@ bool ARMDAGToDAGISel::SelectAddrMode3(SDValue N,
Base = N.getOperand(0); Base = N.getOperand(0);
if (Base.getOpcode() == ISD::FrameIndex) { if (Base.getOpcode() == ISD::FrameIndex) {
int FI = cast<FrameIndexSDNode>(Base)->getIndex(); int FI = cast<FrameIndexSDNode>(Base)->getIndex();
Base = CurDAG->getTargetFrameIndex(FI, Base = CurDAG->getTargetFrameIndex(FI, TLI->getPointerTy());
getTargetLowering()->getPointerTy());
} }
Offset = CurDAG->getRegister(0, MVT::i32); Offset = CurDAG->getRegister(0, MVT::i32);
@ -957,8 +951,7 @@ bool ARMDAGToDAGISel::SelectAddrMode5(SDValue N,
Base = N; Base = N;
if (N.getOpcode() == ISD::FrameIndex) { if (N.getOpcode() == ISD::FrameIndex) {
int FI = cast<FrameIndexSDNode>(N)->getIndex(); int FI = cast<FrameIndexSDNode>(N)->getIndex();
Base = CurDAG->getTargetFrameIndex(FI, Base = CurDAG->getTargetFrameIndex(FI, TLI->getPointerTy());
getTargetLowering()->getPointerTy());
} else if (N.getOpcode() == ARMISD::Wrapper && } else if (N.getOpcode() == ARMISD::Wrapper &&
N.getOperand(0).getOpcode() != ISD::TargetGlobalAddress) { N.getOperand(0).getOpcode() != ISD::TargetGlobalAddress) {
Base = N.getOperand(0); Base = N.getOperand(0);
@ -975,8 +968,7 @@ bool ARMDAGToDAGISel::SelectAddrMode5(SDValue N,
Base = N.getOperand(0); Base = N.getOperand(0);
if (Base.getOpcode() == ISD::FrameIndex) { if (Base.getOpcode() == ISD::FrameIndex) {
int FI = cast<FrameIndexSDNode>(Base)->getIndex(); int FI = cast<FrameIndexSDNode>(Base)->getIndex();
Base = CurDAG->getTargetFrameIndex(FI, Base = CurDAG->getTargetFrameIndex(FI, TLI->getPointerTy());
getTargetLowering()->getPointerTy());
} }
ARM_AM::AddrOpc AddSub = ARM_AM::add; ARM_AM::AddrOpc AddSub = ARM_AM::add;
@ -1199,8 +1191,7 @@ bool ARMDAGToDAGISel::SelectThumbAddrModeSP(SDValue N,
SDValue &Base, SDValue &OffImm) { SDValue &Base, SDValue &OffImm) {
if (N.getOpcode() == ISD::FrameIndex) { if (N.getOpcode() == ISD::FrameIndex) {
int FI = cast<FrameIndexSDNode>(N)->getIndex(); int FI = cast<FrameIndexSDNode>(N)->getIndex();
Base = CurDAG->getTargetFrameIndex(FI, Base = CurDAG->getTargetFrameIndex(FI, TLI->getPointerTy());
getTargetLowering()->getPointerTy());
OffImm = CurDAG->getTargetConstant(0, MVT::i32); OffImm = CurDAG->getTargetConstant(0, MVT::i32);
return true; return true;
} }
@ -1217,8 +1208,7 @@ bool ARMDAGToDAGISel::SelectThumbAddrModeSP(SDValue N,
Base = N.getOperand(0); Base = N.getOperand(0);
if (Base.getOpcode() == ISD::FrameIndex) { if (Base.getOpcode() == ISD::FrameIndex) {
int FI = cast<FrameIndexSDNode>(Base)->getIndex(); int FI = cast<FrameIndexSDNode>(Base)->getIndex();
Base = CurDAG->getTargetFrameIndex(FI, Base = CurDAG->getTargetFrameIndex(FI, TLI->getPointerTy());
getTargetLowering()->getPointerTy());
} }
OffImm = CurDAG->getTargetConstant(RHSC, MVT::i32); OffImm = CurDAG->getTargetConstant(RHSC, MVT::i32);
return true; return true;
@ -1266,8 +1256,7 @@ bool ARMDAGToDAGISel::SelectT2AddrModeImm12(SDValue N,
if (N.getOpcode() == ISD::FrameIndex) { if (N.getOpcode() == ISD::FrameIndex) {
// Match frame index. // Match frame index.
int FI = cast<FrameIndexSDNode>(N)->getIndex(); int FI = cast<FrameIndexSDNode>(N)->getIndex();
Base = CurDAG->getTargetFrameIndex(FI, Base = CurDAG->getTargetFrameIndex(FI, TLI->getPointerTy());
getTargetLowering()->getPointerTy());
OffImm = CurDAG->getTargetConstant(0, MVT::i32); OffImm = CurDAG->getTargetConstant(0, MVT::i32);
return true; return true;
} }
@ -1296,8 +1285,7 @@ bool ARMDAGToDAGISel::SelectT2AddrModeImm12(SDValue N,
Base = N.getOperand(0); Base = N.getOperand(0);
if (Base.getOpcode() == ISD::FrameIndex) { if (Base.getOpcode() == ISD::FrameIndex) {
int FI = cast<FrameIndexSDNode>(Base)->getIndex(); int FI = cast<FrameIndexSDNode>(Base)->getIndex();
Base = CurDAG->getTargetFrameIndex(FI, Base = CurDAG->getTargetFrameIndex(FI, TLI->getPointerTy());
getTargetLowering()->getPointerTy());
} }
OffImm = CurDAG->getTargetConstant(RHSC, MVT::i32); OffImm = CurDAG->getTargetConstant(RHSC, MVT::i32);
return true; return true;
@ -1326,8 +1314,7 @@ bool ARMDAGToDAGISel::SelectT2AddrModeImm8(SDValue N,
Base = N.getOperand(0); Base = N.getOperand(0);
if (Base.getOpcode() == ISD::FrameIndex) { if (Base.getOpcode() == ISD::FrameIndex) {
int FI = cast<FrameIndexSDNode>(Base)->getIndex(); int FI = cast<FrameIndexSDNode>(Base)->getIndex();
Base = CurDAG->getTargetFrameIndex(FI, Base = CurDAG->getTargetFrameIndex(FI, TLI->getPointerTy());
getTargetLowering()->getPointerTy());
} }
OffImm = CurDAG->getTargetConstant(RHSC, MVT::i32); OffImm = CurDAG->getTargetConstant(RHSC, MVT::i32);
return true; return true;
@ -1425,7 +1412,7 @@ bool ARMDAGToDAGISel::SelectT2AddrModeExclusive(SDValue N, SDValue &Base,
Base = N.getOperand(0); Base = N.getOperand(0);
if (Base.getOpcode() == ISD::FrameIndex) { if (Base.getOpcode() == ISD::FrameIndex) {
int FI = cast<FrameIndexSDNode>(Base)->getIndex(); int FI = cast<FrameIndexSDNode>(Base)->getIndex();
Base = CurDAG->getTargetFrameIndex(FI, getTargetLowering()->getPointerTy()); Base = CurDAG->getTargetFrameIndex(FI, TLI->getPointerTy());
} }
OffImm = CurDAG->getTargetConstant(RHSC / 4, MVT::i32); OffImm = CurDAG->getTargetConstant(RHSC / 4, MVT::i32);
@ -2476,10 +2463,9 @@ SDNode *ARMDAGToDAGISel::Select(SDNode *N) {
} }
if (UseCP) { if (UseCP) {
SDValue CPIdx = SDValue CPIdx = CurDAG->getTargetConstantPool(
CurDAG->getTargetConstantPool(ConstantInt::get( ConstantInt::get(Type::getInt32Ty(*CurDAG->getContext()), Val),
Type::getInt32Ty(*CurDAG->getContext()), Val), TLI->getPointerTy());
getTargetLowering()->getPointerTy());
SDNode *ResNode; SDNode *ResNode;
if (Subtarget->isThumb()) { if (Subtarget->isThumb()) {
@ -2509,8 +2495,7 @@ SDNode *ARMDAGToDAGISel::Select(SDNode *N) {
case ISD::FrameIndex: { case ISD::FrameIndex: {
// Selects to ADDri FI, 0 which in turn will become ADDri SP, imm. // Selects to ADDri FI, 0 which in turn will become ADDri SP, imm.
int FI = cast<FrameIndexSDNode>(N)->getIndex(); int FI = cast<FrameIndexSDNode>(N)->getIndex();
SDValue TFI = CurDAG->getTargetFrameIndex(FI, SDValue TFI = CurDAG->getTargetFrameIndex(FI, TLI->getPointerTy());
getTargetLowering()->getPointerTy());
if (Subtarget->isThumb1Only()) { if (Subtarget->isThumb1Only()) {
SDValue Ops[] = { TFI, CurDAG->getTargetConstant(0, MVT::i32), SDValue Ops[] = { TFI, CurDAG->getTargetConstant(0, MVT::i32),
getAL(CurDAG), CurDAG->getRegister(0, MVT::i32) }; getAL(CurDAG), CurDAG->getRegister(0, MVT::i32) };

View File

@ -68,15 +68,13 @@ private:
SDNode* SparcDAGToDAGISel::getGlobalBaseReg() { SDNode* SparcDAGToDAGISel::getGlobalBaseReg() {
unsigned GlobalBaseReg = unsigned GlobalBaseReg =
TM.getSubtargetImpl()->getInstrInfo()->getGlobalBaseReg(MF); TM.getSubtargetImpl()->getInstrInfo()->getGlobalBaseReg(MF);
return CurDAG->getRegister(GlobalBaseReg, return CurDAG->getRegister(GlobalBaseReg, TLI->getPointerTy()).getNode();
getTargetLowering()->getPointerTy()).getNode();
} }
bool SparcDAGToDAGISel::SelectADDRri(SDValue Addr, bool SparcDAGToDAGISel::SelectADDRri(SDValue Addr,
SDValue &Base, SDValue &Offset) { SDValue &Base, SDValue &Offset) {
if (FrameIndexSDNode *FIN = dyn_cast<FrameIndexSDNode>(Addr)) { if (FrameIndexSDNode *FIN = dyn_cast<FrameIndexSDNode>(Addr)) {
Base = CurDAG->getTargetFrameIndex(FIN->getIndex(), Base = CurDAG->getTargetFrameIndex(FIN->getIndex(), TLI->getPointerTy());
getTargetLowering()->getPointerTy());
Offset = CurDAG->getTargetConstant(0, MVT::i32); Offset = CurDAG->getTargetConstant(0, MVT::i32);
return true; return true;
} }
@ -91,8 +89,8 @@ bool SparcDAGToDAGISel::SelectADDRri(SDValue Addr,
if (FrameIndexSDNode *FIN = if (FrameIndexSDNode *FIN =
dyn_cast<FrameIndexSDNode>(Addr.getOperand(0))) { dyn_cast<FrameIndexSDNode>(Addr.getOperand(0))) {
// Constant offset from frame ref. // Constant offset from frame ref.
Base = CurDAG->getTargetFrameIndex(FIN->getIndex(), Base =
getTargetLowering()->getPointerTy()); CurDAG->getTargetFrameIndex(FIN->getIndex(), TLI->getPointerTy());
} else { } else {
Base = Addr.getOperand(0); Base = Addr.getOperand(0);
} }
@ -136,7 +134,7 @@ bool SparcDAGToDAGISel::SelectADDRrr(SDValue Addr, SDValue &R1, SDValue &R2) {
} }
R1 = Addr; R1 = Addr;
R2 = CurDAG->getRegister(SP::G0, getTargetLowering()->getPointerTy()); R2 = CurDAG->getRegister(SP::G0, TLI->getPointerTy());
return true; return true;
} }

View File

@ -238,10 +238,10 @@ namespace {
inline void getAddressOperands(X86ISelAddressMode &AM, SDValue &Base, inline void getAddressOperands(X86ISelAddressMode &AM, SDValue &Base,
SDValue &Scale, SDValue &Index, SDValue &Scale, SDValue &Index,
SDValue &Disp, SDValue &Segment) { SDValue &Disp, SDValue &Segment) {
Base = (AM.BaseType == X86ISelAddressMode::FrameIndexBase) ? Base = (AM.BaseType == X86ISelAddressMode::FrameIndexBase)
CurDAG->getTargetFrameIndex(AM.Base_FrameIndex, ? CurDAG->getTargetFrameIndex(AM.Base_FrameIndex,
getTargetLowering()->getPointerTy()) : TLI->getPointerTy())
AM.Base_Reg; : AM.Base_Reg;
Scale = getI8Imm(AM.Scale); Scale = getI8Imm(AM.Scale);
Index = AM.IndexReg; Index = AM.IndexReg;
// These are 32-bit even in 64-bit mode since RIP relative offset // These are 32-bit even in 64-bit mode since RIP relative offset
@ -518,7 +518,7 @@ void X86DAGToDAGISel::PreprocessISelDAG() {
// If the source and destination are SSE registers, then this is a legal // If the source and destination are SSE registers, then this is a legal
// conversion that should not be lowered. // conversion that should not be lowered.
const X86TargetLowering *X86Lowering = const X86TargetLowering *X86Lowering =
static_cast<const X86TargetLowering *>(getTargetLowering()); static_cast<const X86TargetLowering *>(TLI);
bool SrcIsSSE = X86Lowering->isScalarFPTypeInSSEReg(SrcVT); bool SrcIsSSE = X86Lowering->isScalarFPTypeInSSEReg(SrcVT);
bool DstIsSSE = X86Lowering->isScalarFPTypeInSSEReg(DstVT); bool DstIsSSE = X86Lowering->isScalarFPTypeInSSEReg(DstVT);
if (SrcIsSSE && DstIsSSE) if (SrcIsSSE && DstIsSSE)
@ -1572,8 +1572,7 @@ bool X86DAGToDAGISel::TryFoldLoad(SDNode *P, SDValue N,
/// ///
SDNode *X86DAGToDAGISel::getGlobalBaseReg() { SDNode *X86DAGToDAGISel::getGlobalBaseReg() {
unsigned GlobalBaseReg = getInstrInfo()->getGlobalBaseReg(MF); unsigned GlobalBaseReg = getInstrInfo()->getGlobalBaseReg(MF);
return CurDAG->getRegister(GlobalBaseReg, return CurDAG->getRegister(GlobalBaseReg, TLI->getPointerTy()).getNode();
getTargetLowering()->getPointerTy()).getNode();
} }
/// Atomic opcode table /// Atomic opcode table