[PATCH] D21480: [X86SubTarget] use isPositionIndependent()

Davide Italiano via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 17 17:10:17 PDT 2016


This revision was automatically updated to reflect the committed changes.
Closed by commit rL273071: [X86Subtarget] Use isPositionIndependent(). NFC. (authored by davide).

Changed prior to commit:
  http://reviews.llvm.org/D21480?vs=61128&id=61147#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D21480

Files:
  llvm/trunk/lib/Target/X86/X86Subtarget.cpp
  llvm/trunk/lib/Target/X86/X86Subtarget.h

Index: llvm/trunk/lib/Target/X86/X86Subtarget.h
===================================================================
--- llvm/trunk/lib/Target/X86/X86Subtarget.h
+++ llvm/trunk/lib/Target/X86/X86Subtarget.h
@@ -533,6 +533,10 @@
            PICStyle == PICStyles::StubPIC;
   }
 
+  bool isPositionIndependent() const {
+    return TM.getRelocationModel() == Reloc::PIC_;
+  }
+
   bool isCallingConvWin64(CallingConv::ID CC) const {
     switch (CC) {
     // On Win64, all these conventions just use the default convention.
Index: llvm/trunk/lib/Target/X86/X86Subtarget.cpp
===================================================================
--- llvm/trunk/lib/Target/X86/X86Subtarget.cpp
+++ llvm/trunk/lib/Target/X86/X86Subtarget.cpp
@@ -66,7 +66,7 @@
 
   // If this is for a position dependent executable, the static linker can
   // figure it out.
-  if (TM.getRelocationModel() != Reloc::PIC_)
+  if (!isPositionIndependent())
     return X86II::MO_NO_FLAG;
 
   // The COFF dynamic linker just patches the executable sections.
@@ -104,7 +104,7 @@
     return X86II::MO_GOTPCREL;
 
   if (isTargetDarwin()) {
-    if (RM != Reloc::PIC_)
+    if (!isPositionIndependent())
       return X86II::MO_DARWIN_NONLAZY;
     return X86II::MO_DARWIN_NONLAZY_PIC_BASE;
   }
@@ -334,7 +334,7 @@
   } else if (isTargetCOFF()) {
     setPICStyle(PICStyles::None);
   } else if (isTargetDarwin()) {
-    if (TM.getRelocationModel() == Reloc::PIC_)
+    if (isPositionIndependent())
       setPICStyle(PICStyles::StubPIC);
     else {
       assert(TM.getRelocationModel() == Reloc::DynamicNoPIC);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D21480.61147.patch
Type: text/x-patch
Size: 1589 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160618/7443bb6b/attachment.bin>


More information about the llvm-commits mailing list