diff options
author | Evan Cheng <evan.cheng@apple.com> | 2007-05-04 00:26:58 +0000 |
---|---|---|
committer | Evan Cheng <evan.cheng@apple.com> | 2007-05-04 00:26:58 +0000 |
commit | 97c9bb5cc6c2f936493ae5e8f577ecbfc1f750ce (patch) | |
tree | c8087a40396151fcbaedd41015dd0cf1217e0c1e | |
parent | 874ebada58fc94b8612236426f3cc5d119ca62d6 (diff) | |
download | external_llvm-97c9bb5cc6c2f936493ae5e8f577ecbfc1f750ce.zip external_llvm-97c9bb5cc6c2f936493ae5e8f577ecbfc1f750ce.tar.gz external_llvm-97c9bb5cc6c2f936493ae5e8f577ecbfc1f750ce.tar.bz2 |
On Mac OS X, GV requires an extra load only when relocation-model is non-static.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36718 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Target/ARM/ARMISelLowering.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/Target/ARM/ARMISelLowering.cpp b/lib/Target/ARM/ARMISelLowering.cpp index 585b660..34ea98c 100644 --- a/lib/Target/ARM/ARMISelLowering.cpp +++ b/lib/Target/ARM/ARMISelLowering.cpp @@ -812,10 +812,11 @@ SDOperand ARMTargetLowering::LowerGlobalAddressELF(SDOperand Op, } /// GVIsIndirectSymbol - true if the GV will be accessed via an indirect symbol -/// even in dynamic-no-pic mode. -static bool GVIsIndirectSymbol(GlobalValue *GV) { - return (GV->hasWeakLinkage() || GV->hasLinkOnceLinkage() || - (GV->isDeclaration() && !GV->hasNotBeenReadFromBytecode())); +/// even in non-static mode. +static bool GVIsIndirectSymbol(GlobalValue *GV, Reloc::Model RelocM) { + return RelocM != Reloc::Static && + (GV->hasWeakLinkage() || GV->hasLinkOnceLinkage() || + (GV->isDeclaration() && !GV->hasNotBeenReadFromBytecode())); } SDOperand ARMTargetLowering::LowerGlobalAddressDarwin(SDOperand Op, @@ -823,7 +824,7 @@ SDOperand ARMTargetLowering::LowerGlobalAddressDarwin(SDOperand Op, MVT::ValueType PtrVT = getPointerTy(); GlobalValue *GV = cast<GlobalAddressSDNode>(Op)->getGlobal(); Reloc::Model RelocM = getTargetMachine().getRelocationModel(); - bool IsIndirect = GVIsIndirectSymbol(GV); + bool IsIndirect = GVIsIndirectSymbol(GV, RelocM); SDOperand CPAddr; if (RelocM == Reloc::Static) CPAddr = DAG.getTargetConstantPool(GV, PtrVT, 2); |