summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/X86/X86Subtarget.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-07-10 20:47:30 +0000
committerChris Lattner <sabre@nondot.org>2009-07-10 20:47:30 +0000
commite2f524f176df37bca2dea1ade78e0c303ed3c766 (patch)
tree01222a50dc534e3c42a67233d7ff22050f3738aa /llvm/lib/Target/X86/X86Subtarget.cpp
parent028e6158c256e4bc0fec39de0f44aceeff57a317 (diff)
downloadbcm5719-llvm-e2f524f176df37bca2dea1ade78e0c303ed3c766.tar.gz
bcm5719-llvm-e2f524f176df37bca2dea1ade78e0c303ed3c766.zip
add a couple of predicates to test for "stub style pic in PIC mode" and "stub style pic in dynamic-no-pic" mode.
llvm-svn: 75273
Diffstat (limited to 'llvm/lib/Target/X86/X86Subtarget.cpp')
-rw-r--r--llvm/lib/Target/X86/X86Subtarget.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/llvm/lib/Target/X86/X86Subtarget.cpp b/llvm/lib/Target/X86/X86Subtarget.cpp
index 6665c67bafc..c68b29b00bb 100644
--- a/llvm/lib/Target/X86/X86Subtarget.cpp
+++ b/llvm/lib/Target/X86/X86Subtarget.cpp
@@ -34,6 +34,17 @@ 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
@@ -76,7 +87,7 @@ ClassifyGlobalReference(const GlobalValue *GV, const TargetMachine &TM) const {
return X86II::MO_GOT;
}
- if (isPICStyleStub()) {
+ if (isPICStyleStubAny()) {
// In Darwin/32, we have multiple different stub types, and we have both PIC
// and -mdynamic-no-pic. Determine whether we have a stub reference
// and/or whether the reference is relative to the PIC base or not.
OpenPOWER on IntegriCloud