diff options
author | Chris Lattner <sabre@nondot.org> | 2009-07-10 07:33:30 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-07-10 07:33:30 +0000 |
commit | 119396042b8360aa403faa0daf2d1c2cd410f649 (patch) | |
tree | 253cc61e14c5049258af0256f4ef34707d231efc /lib/Target | |
parent | 505aa6c1db5bed0173f100261342d2e8a176baa7 (diff) | |
download | external_llvm-119396042b8360aa403faa0daf2d1c2cd410f649.zip external_llvm-119396042b8360aa403faa0daf2d1c2cd410f649.tar.gz external_llvm-119396042b8360aa403faa0daf2d1c2cd410f649.tar.bz2 |
add a predicate to determine if a global var reference requires a
PIC-base to be added in.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75238 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target')
-rw-r--r-- | lib/Target/X86/X86InstrInfo.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/Target/X86/X86InstrInfo.h b/lib/Target/X86/X86InstrInfo.h index 83f6345..75f3667 100644 --- a/lib/Target/X86/X86InstrInfo.h +++ b/lib/Target/X86/X86InstrInfo.h @@ -199,6 +199,22 @@ inline static bool isGlobalStubReference(unsigned char TargetFlag) { 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. |