add a couple of predicates to test for "stub style pic in PIC mode" and "stub style pic in dynamic-no-pic" mode.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75273 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Target/X86/X86Subtarget.cpp b/lib/Target/X86/X86Subtarget.cpp
index 6665c67..c68b29b 100644
--- a/lib/Target/X86/X86Subtarget.cpp
+++ b/lib/Target/X86/X86Subtarget.cpp
@@ -34,6 +34,17 @@
     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 @@
     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.