diff options
author | Chris Lattner <sabre@nondot.org> | 2009-07-10 20:58:47 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-07-10 20:58:47 +0000 |
commit | 8097b65c432c3cc39339b6bb0ead9e1e09232ff7 (patch) | |
tree | 92d122ab7216e113ed3c26a0f0cfea978fb54da1 /lib/Target/X86 | |
parent | 84853a17a3f79f37277f6b67ac9f5468ea6d8438 (diff) |
make PIC vs DynamicNoPIC be explicit in PICStyles.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75275 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/X86')
-rw-r--r-- | lib/Target/X86/X86Subtarget.cpp | 12 | ||||
-rw-r--r-- | lib/Target/X86/X86Subtarget.h | 22 | ||||
-rw-r--r-- | lib/Target/X86/X86TargetMachine.cpp | 8 |
3 files changed, 21 insertions, 21 deletions
diff --git a/lib/Target/X86/X86Subtarget.cpp b/lib/Target/X86/X86Subtarget.cpp index db9a09f76d..8259629b81 100644 --- a/lib/Target/X86/X86Subtarget.cpp +++ b/lib/Target/X86/X86Subtarget.cpp @@ -34,18 +34,6 @@ AsmWriterFlavor("x86-asm-syntax", cl::init(X86Subtarget::Unset), clEnumValN(X86Subtarget::Intel, "intel", "Emit Intel-style assembly"), clEnumValEnd)); -bool X86Subtarget::isPICStyleStubPIC(const TargetMachine &TM) const { - return PICStyle == PICStyles::Stub && - TM.getRelocationModel() == Reloc::PIC_; -} - -bool X86Subtarget::isPICStyleStubNoDynamic(const TargetMachine &TM) const { - return PICStyle == PICStyles::Stub && - TM.getRelocationModel() == Reloc::DynamicNoPIC; -} - - - /// ClassifyGlobalReference - Classify a global variable reference for the /// current subtarget according to how we should reference it in a non-pcrel /// context. diff --git a/lib/Target/X86/X86Subtarget.h b/lib/Target/X86/X86Subtarget.h index 6509f04e33..9bba9401b5 100644 --- a/lib/Target/X86/X86Subtarget.h +++ b/lib/Target/X86/X86Subtarget.h @@ -26,10 +26,11 @@ class TargetMachine; /// namespace PICStyles { enum Style { - Stub, // Used on i386-darwin - GOT, // Used on many 32-bit unices. - RIPRel, // Used on X86-64 when not in -static mode. - None // Set when in -static mode (not PIC or DynamicNoPIC mode). + StubPIC, // Used on i386-darwin in -fPIC mode. + StubDynamicNoPIC, // Used on i386-darwin in -mdynamic-no-pic mode. + GOT, // Used on many 32-bit unices in -fPIC mode. + RIPRel, // Used on X86-64 when not in -static mode. + None // Set when in -static mode (not PIC or DynamicNoPIC mode). }; } @@ -186,9 +187,16 @@ public: bool isPICStyleGOT() const { return PICStyle == PICStyles::GOT; } bool isPICStyleRIPRel() const { return PICStyle == PICStyles::RIPRel; } - bool isPICStyleStubPIC(const TargetMachine &TM) const; - bool isPICStyleStubNoDynamic(const TargetMachine &TM) const; - bool isPICStyleStubAny() const { return PICStyle == PICStyles::Stub; } + bool isPICStyleStubPIC(const TargetMachine &TM) const { + return PICStyle == PICStyles::StubPIC; + } + + bool isPICStyleStubNoDynamic(const TargetMachine &TM) const { + return PICStyle == PICStyles::StubDynamicNoPIC; + } + bool isPICStyleStubAny() const { + return PICStyle == PICStyles::StubDynamicNoPIC || + PICStyle == PICStyles::StubPIC; } /// getDarwinVers - Return the darwin version number, 8 = Tiger, 9 = Leopard, /// 10 = Snow Leopard, etc. diff --git a/lib/Target/X86/X86TargetMachine.cpp b/lib/Target/X86/X86TargetMachine.cpp index eb0cf93562..92a98a065b 100644 --- a/lib/Target/X86/X86TargetMachine.cpp +++ b/lib/Target/X86/X86TargetMachine.cpp @@ -183,8 +183,12 @@ X86TargetMachine::X86TargetMachine(const Module &M, const std::string &FS, } else if (Subtarget.isTargetDarwin()) { if (Subtarget.is64Bit()) Subtarget.setPICStyle(PICStyles::RIPRel); - else - Subtarget.setPICStyle(PICStyles::Stub); + else if (getRelocationModel() == Reloc::PIC_) + Subtarget.setPICStyle(PICStyles::StubPIC); + else { + assert(getRelocationModel() == Reloc::DynamicNoPIC); + Subtarget.setPICStyle(PICStyles::StubDynamicNoPIC); + } } else if (Subtarget.isTargetELF()) { if (Subtarget.is64Bit()) Subtarget.setPICStyle(PICStyles::RIPRel); |