]> granicus.if.org Git - llvm/commitdiff
Convert a few more comparisons to isPositionIndependent(). NFC.
authorRafael Espindola <rafael.espindola@gmail.com>
Mon, 27 Jun 2016 21:33:08 +0000 (21:33 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Mon, 27 Jun 2016 21:33:08 +0000 (21:33 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@273945 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Target/TargetMachine.h
lib/Target/TargetMachine.cpp
lib/Target/X86/X86ISelDAGToDAG.cpp
lib/Target/X86/X86InstrInfo.cpp
lib/Target/X86/X86InstrInfo.td
lib/Target/X86/X86Subtarget.h

index e054dde0e1b68c4ceecc619e213d82e10de0e1b5..0b521064f2199f19dc87d57c4513fe1037808890 100644 (file)
@@ -175,6 +175,8 @@ public:
   /// target default.
   CodeModel::Model getCodeModel() const;
 
+  bool isPositionIndependent() const;
+
   /// Returns the TLS model which should be used for the given global variable.
   TLSModel::Model getTLSModel(const GlobalValue *GV) const;
 
index 220f1f3183d9653d06500471e8bc4551ce8dc779..d7617e73245829b31afddd8cf8981fe5c3ffbb15 100644 (file)
@@ -53,6 +53,10 @@ TargetMachine::~TargetMachine() {
   delete STI;
 }
 
+bool TargetMachine::isPositionIndependent() const {
+  return getRelocationModel() == Reloc::PIC_;
+}
+
 /// \brief Reset the target options based on the function's attributes.
 // FIXME: This function needs to go away for a number of reasons:
 // a) global state on the TargetMachine is terrible in general,
index cb3b59438a89b3425dbd1a6acceb6dad0e6d4fdc..cc9fc70c0cdafdd469ad5dbdccd1941f8739d47b 100644 (file)
@@ -550,7 +550,7 @@ void X86DAGToDAGISel::PreprocessISelDAG() {
          (N->getOpcode() == X86ISD::TC_RETURN &&
           // Only does this if load can be folded into TC_RETURN.
           (Subtarget->is64Bit() ||
-           getTargetMachine().getRelocationModel() != Reloc::PIC_)))) {
+           !getTargetMachine().isPositionIndependent())))) {
       /// Also try moving call address load from outside callseq_start to just
       /// before the call to allow it to be folded.
       ///
index 480f544f53b0f2c066e5655f79423025af87acd8..4a0a57ad426f5db4effed0f428cffd67f058713d 100644 (file)
@@ -6286,7 +6286,7 @@ MachineInstr *X86InstrInfo::foldMemoryOperandImpl(
 
     // x86-32 PIC requires a PIC base register for constant pools.
     unsigned PICBase = 0;
-    if (MF.getTarget().getRelocationModel() == Reloc::PIC_) {
+    if (MF.getTarget().isPositionIndependent()) {
       if (Subtarget.is64Bit())
         PICBase = X86::RIP;
       else
@@ -7361,7 +7361,7 @@ namespace {
         return false;
 
       // Only emit a global base reg in PIC mode.
-      if (TM->getRelocationModel() != Reloc::PIC_)
+      if (!TM->isPositionIndependent())
         return false;
 
       X86MachineFunctionInfo *X86FI = MF.getInfo<X86MachineFunctionInfo>();
index 51782ef1f07382cf673c01c75e61a40adbc67079..500c0862192006e19fc01025409d27daaf779073 100644 (file)
@@ -880,7 +880,7 @@ def FarData      : Predicate<"TM.getCodeModel() != CodeModel::Small &&"
                              "TM.getCodeModel() != CodeModel::Kernel">;
 def NearData     : Predicate<"TM.getCodeModel() == CodeModel::Small ||"
                              "TM.getCodeModel() == CodeModel::Kernel">;
-def IsNotPIC     : Predicate<"TM.getRelocationModel() != Reloc::PIC_">;
+def IsNotPIC     : Predicate<"!TM.isPositionIndependent()">;
 def OptForSize   : Predicate<"OptForSize">;
 def OptForMinSize : Predicate<"OptForMinSize">;
 def OptForSpeed  : Predicate<"!OptForSize">;
index c3967c41406302f260ffdb4e518aee8643c4ee68..a274b797ca8f1c0c86ac1e385b11cab2412945a0 100644 (file)
@@ -523,9 +523,7 @@ public:
     return PICStyle == PICStyles::StubPIC;
   }
 
-  bool isPositionIndependent() const {
-    return TM.getRelocationModel() == Reloc::PIC_;
-  }
+  bool isPositionIndependent() const { return TM.isPositionIndependent(); }
 
   bool isCallingConvWin64(CallingConv::ID CC) const {
     switch (CC) {