[llvm-commits] [llvm] r75238 - /llvm/trunk/lib/Target/X86/X86InstrInfo.h

Chris Lattner sabre at nondot.org
Fri Jul 10 00:33:30 PDT 2009


Author: lattner
Date: Fri Jul 10 02:33:30 2009
New Revision: 75238

URL: http://llvm.org/viewvc/llvm-project?rev=75238&view=rev
Log:
add a predicate to determine if a global var reference requires a
PIC-base to be added in.

Modified:
    llvm/trunk/lib/Target/X86/X86InstrInfo.h

Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.h?rev=75238&r1=75237&r2=75238&view=diff

==============================================================================
--- llvm/trunk/lib/Target/X86/X86InstrInfo.h (original)
+++ llvm/trunk/lib/Target/X86/X86InstrInfo.h Fri Jul 10 02:33:30 2009
@@ -199,6 +199,22 @@
     return false;
   }
 }
+
+/// isGlobalRelativeToPICBase - Return true if the specified global value
+/// reference is relative to a 32-bit PIC base (X86ISD::GlobalBaseReg).  If this
+/// is true, the addressing mode has the PIC base register added in (e.g. EBX).
+inline static bool isGlobalRelativeToPICBase(unsigned char TargetFlag) {
+  switch (TargetFlag) {
+  case X86II::MO_GOTOFF:                         // isPICStyleGOT: local global.
+  case X86II::MO_GOT:                            // isPICStyleGOT: other global.
+  case X86II::MO_PIC_BASE_OFFSET:                // Darwin local global.
+  case X86II::MO_DARWIN_NONLAZY_PIC_BASE:        // Darwin/32 external global.
+  case X86II::MO_DARWIN_HIDDEN_NONLAZY_PIC_BASE: // Darwin/32 hidden global.
+    return true;
+  default:
+    return false;
+  }
+}
  
 /// X86II - This namespace holds all of the target specific flags that
 /// instruction info tracks.





More information about the llvm-commits mailing list