diff options
author | Chris Lattner <sabre@nondot.org> | 2006-12-11 23:22:45 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2006-12-11 23:22:45 +0000 |
commit | 57fc62c8d2bf056b0d2a0e3d1b82b3b787b899f8 (patch) | |
tree | 617a5f64b9a640f0a39f610fe14696373a1a3bc2 /lib/Target/PowerPC/PPCSubtarget.cpp | |
parent | a77fa7edbfb999c487c6da89fcfecafb4b9e83be (diff) |
Another step forward in PPC64 JIT support: we now no-longer need stubs
emitted for external globals in PPC64-JIT-PIC mode (which is good because
we didn't handle them before!).
This also fixes a bug handling the picbase delta, which we would get wrong
in some cases.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32451 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/PowerPC/PPCSubtarget.cpp')
-rw-r--r-- | lib/Target/PowerPC/PPCSubtarget.cpp | 38 |
1 files changed, 34 insertions, 4 deletions
diff --git a/lib/Target/PowerPC/PPCSubtarget.cpp b/lib/Target/PowerPC/PPCSubtarget.cpp index 5c18e65665..eca16c4a38 100644 --- a/lib/Target/PowerPC/PPCSubtarget.cpp +++ b/lib/Target/PowerPC/PPCSubtarget.cpp @@ -14,6 +14,7 @@ #include "PPCSubtarget.h" #include "PPC.h" #include "llvm/Module.h" +#include "llvm/Target/TargetMachine.h" #include "PPCGenSubtarget.inc" using namespace llvm; @@ -55,9 +56,10 @@ static const char *GetCurrentPowerPCCPU() { #endif -PPCSubtarget::PPCSubtarget(const Module &M, const std::string &FS, bool is64Bit) - : StackAlignment(16) - , InstrItins() +PPCSubtarget::PPCSubtarget(const TargetMachine &tm, const Module &M, + const std::string &FS, bool is64Bit) + : TM(tm) + , StackAlignment(16) , IsGigaProcessor(false) , Has64BitSupport(false) , Use64BitRegs(false) @@ -65,7 +67,8 @@ PPCSubtarget::PPCSubtarget(const Module &M, const std::string &FS, bool is64Bit) , HasAltivec(false) , HasFSQRT(false) , HasSTFIWX(false) - , IsDarwin(false) { + , IsDarwin(false) + , HasLazyResolverStubs(false) { // Determine default and user specified characteristics std::string CPU = "generic"; @@ -105,4 +108,31 @@ PPCSubtarget::PPCSubtarget(const Module &M, const std::string &FS, bool is64Bit) IsDarwin = true; #endif } + + // Set up darwin-specific properties. + if (IsDarwin) { + HasLazyResolverStubs = true; + } +} + +/// SetJITMode - This is called to inform the subtarget info that we are +/// producing code for the JIT. +void PPCSubtarget::SetJITMode() { + // JIT mode doesn't want lazy resolver stubs, it knows exactly where + // everything is. This matters for PPC64, which codegens in PIC mode without + // stubs. + HasLazyResolverStubs = false; +} + + +/// 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. +bool PPCSubtarget::hasLazyResolverStub(const GlobalValue *GV) const { + // We never hae stubs if HasLazyResolverStubs=false or if in static mode. + if (!HasLazyResolverStubs || TM.getRelocationModel() == Reloc::Static) + return false; + + return GV->hasWeakLinkage() || GV->hasLinkOnceLinkage() || + (GV->isExternal() && !GV->hasNotBeenReadFromBytecode()); } |