From 97c9bb5cc6c2f936493ae5e8f577ecbfc1f750ce Mon Sep 17 00:00:00 2001 From: Evan Cheng Date: Fri, 4 May 2007 00:26:58 +0000 Subject: [PATCH] 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 --- lib/Target/ARM/ARMISelLowering.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/Target/ARM/ARMISelLowering.cpp b/lib/Target/ARM/ARMISelLowering.cpp index 585b660b9cf..34ea98c0b94 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(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); -- 2.34.1