summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/PowerPC/PPCSubtarget.cpp
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2016-06-23 20:50:42 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2016-06-23 20:50:42 +0000
commit65787a9e01144766a10e7d1159d440bfe1c21b41 (patch)
tree48a30853cef2c2222117d691cbf01a7fbec78a37 /llvm/lib/Target/PowerPC/PPCSubtarget.cpp
parentf0b3e85f4e96f68c22307d10f37c12dec97a2e2a (diff)
downloadbcm5719-llvm-65787a9e01144766a10e7d1159d440bfe1c21b41.tar.gz
bcm5719-llvm-65787a9e01144766a10e7d1159d440bfe1c21b41.zip
Refactor to use shouldAssumeDSOLocal. NFC.
llvm-svn: 273612
Diffstat (limited to 'llvm/lib/Target/PowerPC/PPCSubtarget.cpp')
-rw-r--r--llvm/lib/Target/PowerPC/PPCSubtarget.cpp24
1 files changed, 14 insertions, 10 deletions
diff --git a/llvm/lib/Target/PowerPC/PPCSubtarget.cpp b/llvm/lib/Target/PowerPC/PPCSubtarget.cpp
index b87e5a84c03..577d2d73895 100644
--- a/llvm/lib/Target/PowerPC/PPCSubtarget.cpp
+++ b/llvm/lib/Target/PowerPC/PPCSubtarget.cpp
@@ -15,6 +15,7 @@
#include "PPC.h"
#include "PPCRegisterInfo.h"
#include "PPCTargetMachine.h"
+#include "llvm/CodeGen/Analysis.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineScheduler.h"
#include "llvm/IR/Attributes.h"
@@ -146,18 +147,21 @@ void PPCSubtarget::initSubtargetFeatures(StringRef CPU, StringRef FS) {
IsLittleEndian = (TargetTriple.getArch() == Triple::ppc64le);
}
-/// hasLazyResolverStub - Return true if accesses to the specified global have
-/// to go through a dyld lazy resolution stub. This means that an extra load
-/// is required to get the address of the global.
+/// Return true if accesses to the specified global have to go through a dyld
+/// lazy resolution stub. This means that an extra load is required to get the
+/// address of the global.
bool PPCSubtarget::hasLazyResolverStub(const GlobalValue *GV) const {
- // We never have stubs if HasLazyResolverStubs=false or if in static mode.
- if (!HasLazyResolverStubs || TM.getRelocationModel() == Reloc::Static)
+ if (!HasLazyResolverStubs)
return false;
- bool isDecl = GV->isDeclaration();
- if (GV->hasHiddenVisibility() && !isDecl && !GV->hasCommonLinkage())
- return false;
- return GV->hasWeakLinkage() || GV->hasLinkOnceLinkage() ||
- GV->hasCommonLinkage() || isDecl;
+ if (!shouldAssumeDSOLocal(TM.getRelocationModel(), TM.getTargetTriple(),
+ *GV->getParent(), GV))
+ return true;
+ // 32 bit macho has no relocation for a-b if a is undefined, even if b is in
+ // the section that is being relocated. This means we have to use o load even
+ // for GVs that are known to be local to the dso.
+ if (GV->isDeclarationForLinker() || GV->hasCommonLinkage())
+ return true;
+ return false;
}
// Embedded cores need aggressive scheduling (and some others also benefit).
OpenPOWER on IntegriCloud