summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2007-05-04 00:26:58 +0000
committerEvan Cheng <evan.cheng@apple.com>2007-05-04 00:26:58 +0000
commit33c988600166f3c156929ad7751651497ce096c7 (patch)
tree3ce05522052668db8785777acaec24beb57b36df
parent579abf45bb4005b7cea19f9b1b70e5f53ad84f2c (diff)
downloadbcm5719-llvm-33c988600166f3c156929ad7751651497ce096c7.tar.gz
bcm5719-llvm-33c988600166f3c156929ad7751651497ce096c7.zip
On Mac OS X, GV requires an extra load only when relocation-model is non-static.
llvm-svn: 36718
-rw-r--r--llvm/lib/Target/ARM/ARMISelLowering.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/llvm/lib/Target/ARM/ARMISelLowering.cpp b/llvm/lib/Target/ARM/ARMISelLowering.cpp
index 585b660b9cf..34ea98c0b94 100644
--- a/llvm/lib/Target/ARM/ARMISelLowering.cpp
+++ b/llvm/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);
OpenPOWER on IntegriCloud