diff options
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/Target/X86/X86FastISel.cpp | 2 | ||||
-rw-r--r-- | llvm/lib/Target/X86/X86ISelLowering.cpp | 9 | ||||
-rw-r--r-- | llvm/lib/Target/X86/X86Subtarget.cpp | 13 | ||||
-rw-r--r-- | llvm/lib/Target/X86/X86Subtarget.h | 5 |
4 files changed, 13 insertions, 16 deletions
diff --git a/llvm/lib/Target/X86/X86FastISel.cpp b/llvm/lib/Target/X86/X86FastISel.cpp index cc7a1024608..69fd8bac64b 100644 --- a/llvm/lib/Target/X86/X86FastISel.cpp +++ b/llvm/lib/Target/X86/X86FastISel.cpp @@ -607,7 +607,7 @@ bool X86FastISel::handleConstantAddresses(const Value *V, X86AddressMode &AM) { AM.GV = GV; // Allow the subtarget to classify the global. - unsigned char GVFlags = Subtarget->classifyGlobalReference(GV, TM); + unsigned char GVFlags = Subtarget->classifyGlobalReference(GV); // If this reference is relative to the pic base, set it now. if (isGlobalRelativeToPICBase(GVFlags)) { diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp index 0f5f72e40da..b8c1d0dd4b8 100644 --- a/llvm/lib/Target/X86/X86ISelLowering.cpp +++ b/llvm/lib/Target/X86/X86ISelLowering.cpp @@ -12679,8 +12679,7 @@ X86TargetLowering::LowerGlobalAddress(const GlobalValue *GV, SDLoc dl, int64_t Offset, SelectionDAG &DAG) const { // Create the TargetGlobalAddress node, folding in the constant // offset if it is legal. - unsigned char OpFlags = - Subtarget.classifyGlobalReference(GV, DAG.getTarget()); + unsigned char OpFlags = Subtarget.classifyGlobalReference(GV); CodeModel::Model M = DAG.getTarget().getCodeModel(); auto PtrVT = getPointerTy(DAG.getDataLayout()); SDValue Result; @@ -21983,8 +21982,7 @@ bool X86TargetLowering::isLegalAddressingMode(const DataLayout &DL, return false; if (AM.BaseGV) { - unsigned GVFlags = - Subtarget.classifyGlobalReference(AM.BaseGV, getTargetMachine()); + unsigned GVFlags = Subtarget.classifyGlobalReference(AM.BaseGV); // If a reference to this global requires an extra load, we can't fold it. if (isGlobalStubReference(GVFlags)) @@ -30186,8 +30184,7 @@ void X86TargetLowering::LowerAsmOperandForConstraint(SDValue Op, const GlobalValue *GV = GA->getGlobal(); // If we require an extra load to get this address, as in PIC mode, we // can't accept it. - if (isGlobalStubReference( - Subtarget.classifyGlobalReference(GV, DAG.getTarget()))) + if (isGlobalStubReference(Subtarget.classifyGlobalReference(GV))) return; Result = DAG.getTargetGlobalAddress(GV, SDLoc(Op), diff --git a/llvm/lib/Target/X86/X86Subtarget.cpp b/llvm/lib/Target/X86/X86Subtarget.cpp index f512cce8343..fe3cd466d00 100644 --- a/llvm/lib/Target/X86/X86Subtarget.cpp +++ b/llvm/lib/Target/X86/X86Subtarget.cpp @@ -59,8 +59,8 @@ unsigned char X86Subtarget::classifyBlockAddressReference() const { /// Classify a global variable reference for the current subtarget according to /// how we should reference it in a non-pcrel context. -unsigned char X86Subtarget:: -classifyGlobalReference(const GlobalValue *GV, const TargetMachine &TM) const { +unsigned char +X86Subtarget::classifyGlobalReference(const GlobalValue *GV) const { // DLLImport only exists on windows, it is implemented as a load from a // DLLIMPORT stub. if (GV->hasDLLImportStorageClass()) @@ -158,8 +158,9 @@ X86Subtarget::classifyGlobalFunctionReference(const GlobalValue *GV) const { // has hidden or protected visibility, or if it is static or local, then // we don't need to use the PLT - we can directly call it. // In PIE mode, calls to global functions don't need to go through PLT - if (isTargetELF() && RM == Reloc::PIC_ && !isGlobalDefinedInPIE(GV) && - GV->hasDefaultVisibility() && !GV->hasLocalLinkage()) { + if (isTargetELF() && TM.getRelocationModel() == Reloc::PIC_ && + !isGlobalDefinedInPIE(GV) && GV->hasDefaultVisibility() && + !GV->hasLocalLinkage()) { return X86II::MO_PLT; } else if (isPICStyleStubAny() && !GV->isStrongDefinitionForLinker() && (!getTargetTriple().isMacOSX() || @@ -205,7 +206,7 @@ bool X86Subtarget::isLegalToCallImmediateAddr() const { // the following check for Win32 should be removed. if (In64BitMode || isTargetWin32()) return false; - return isTargetELF() || RM == Reloc::Static; + return isTargetELF() || TM.getRelocationModel() == Reloc::Static; } void X86Subtarget::initSubtargetFeatures(StringRef CPU, StringRef FS) { @@ -346,7 +347,7 @@ X86Subtarget::X86Subtarget(const Triple &TT, const std::string &CPU, const std::string &FS, const X86TargetMachine &TM, unsigned StackAlignOverride) : X86GenSubtargetInfo(TT, CPU, FS), X86ProcFamily(Others), - PICStyle(PICStyles::None), RM(TM.getRelocationModel()), TargetTriple(TT), + PICStyle(PICStyles::None), TM(TM), TargetTriple(TT), StackAlignOverride(StackAlignOverride), In64BitMode(TargetTriple.getArch() == Triple::x86_64), In32BitMode(TargetTriple.getArch() == Triple::x86 && diff --git a/llvm/lib/Target/X86/X86Subtarget.h b/llvm/lib/Target/X86/X86Subtarget.h index a1fc79ec173..68672c28060 100644 --- a/llvm/lib/Target/X86/X86Subtarget.h +++ b/llvm/lib/Target/X86/X86Subtarget.h @@ -64,7 +64,7 @@ protected: /// Which PIC style to use PICStyles::Style PICStyle; - Reloc::Model RM; + const TargetMachine &TM; /// SSE1, SSE2, SSE3, SSSE3, SSE41, SSE42, or none supported. X86SSEEnum X86SSELevel; @@ -565,8 +565,7 @@ public: /// Classify a global variable reference for the current subtarget according /// to how we should reference it in a non-pcrel context. - unsigned char classifyGlobalReference(const GlobalValue *GV, - const TargetMachine &TM)const; + unsigned char classifyGlobalReference(const GlobalValue *GV) const; /// Classify a global function reference for the current subtarget. unsigned char classifyGlobalFunctionReference(const GlobalValue *GV) const; |