[llvm-commits] [llvm] r75275 - in /llvm/trunk/lib/Target/X86: X86Subtarget.cpp X86Subtarget.h X86TargetMachine.cpp
Chris Lattner
sabre at nondot.org
Fri Jul 10 13:58:47 PDT 2009
Author: lattner
Date: Fri Jul 10 15:58:47 2009
New Revision: 75275
URL: http://llvm.org/viewvc/llvm-project?rev=75275&view=rev
Log:
make PIC vs DynamicNoPIC be explicit in PICStyles.
Modified:
llvm/trunk/lib/Target/X86/X86Subtarget.cpp
llvm/trunk/lib/Target/X86/X86Subtarget.h
llvm/trunk/lib/Target/X86/X86TargetMachine.cpp
Modified: llvm/trunk/lib/Target/X86/X86Subtarget.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86Subtarget.cpp?rev=75275&r1=75274&r2=75275&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86Subtarget.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86Subtarget.cpp Fri Jul 10 15:58:47 2009
@@ -34,18 +34,6 @@
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.
Modified: llvm/trunk/lib/Target/X86/X86Subtarget.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86Subtarget.h?rev=75275&r1=75274&r2=75275&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86Subtarget.h (original)
+++ llvm/trunk/lib/Target/X86/X86Subtarget.h Fri Jul 10 15:58:47 2009
@@ -26,10 +26,11 @@
///
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 @@
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.
Modified: llvm/trunk/lib/Target/X86/X86TargetMachine.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86TargetMachine.cpp?rev=75275&r1=75274&r2=75275&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86TargetMachine.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86TargetMachine.cpp Fri Jul 10 15:58:47 2009
@@ -183,8 +183,12 @@
} 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);
More information about the llvm-commits
mailing list