aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Target
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-07-10 06:06:17 +0000
committerChris Lattner <sabre@nondot.org>2009-07-10 06:06:17 +0000
commit578c2c89352455658eda33ed34fc95656e09b483 (patch)
tree08b6b5bb14dfc8f5929fa2170d64bb09e0b2a1b9 /lib/Target
parent6bdfa1c9b72130dc0b12b177ad0e69a7c7a5cc7b (diff)
downloadexternal_llvm-578c2c89352455658eda33ed34fc95656e09b483.zip
external_llvm-578c2c89352455658eda33ed34fc95656e09b483.tar.gz
external_llvm-578c2c89352455658eda33ed34fc95656e09b483.tar.bz2
add a new predicate method that says whether a GlobalValue
MachineOperand is a reference to a stub, not a reference to the global variable itself. Look no context needed! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75233 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target')
-rw-r--r--lib/Target/X86/X86InstrInfo.h28
1 files changed, 27 insertions, 1 deletions
diff --git a/lib/Target/X86/X86InstrInfo.h b/lib/Target/X86/X86InstrInfo.h
index 83f3f09..0838739 100644
--- a/lib/Target/X86/X86InstrInfo.h
+++ b/lib/Target/X86/X86InstrInfo.h
@@ -178,8 +178,34 @@ namespace X86II {
/// indicates that the reference is actually to "FOO$non_lazy_ptr -PICBASE",
/// which is a PIC-base-relative reference to a hidden dyld lazy pointer
/// stub.
- MO_DARWIN_HIDDEN_NONLAZY_PIC_BASE = 17,
+ MO_DARWIN_HIDDEN_NONLAZY_PIC_BASE = 17
+ };
+}
+
+/// isGlobalStubReference - Return true if the specified GlobalValue operand is
+/// a reference to a stub for a global, not the global itself.
+inline static bool isGlobalStubReference(const MachineOperand &MO) {
+ assert(MO.isGlobal() && "Predicate only works on globalvalue operands");
+ switch (MO.getTargetFlags()) {
+ case X86II::MO_DLLIMPORT: // dllimport stub.
+ case X86II::MO_GOTPCREL: // rip-relative GOT reference.
+ case X86II::MO_GOT: // normal GOT reference.
+ case X86II::MO_DARWIN_NONLAZY_PIC_BASE: // Normal $non_lazy_ptr ref.
+ case X86II::MO_DARWIN_NONLAZY: // Normal $non_lazy_ptr ref.
+ case X86II::MO_DARWIN_HIDDEN_NONLAZY_PIC_BASE: // Hidden $non_lazy_ptr ref.
+ case X86II::MO_DARWIN_HIDDEN_NONLAZY: // Hidden $non_lazy_ptr ref.
+ return true;
+ default:
+ return false;
+ }
+}
+
+/// X86II - This namespace holds all of the target specific flags that
+/// instruction info tracks.
+///
+namespace X86II {
+ enum {
//===------------------------------------------------------------------===//
// Instruction encodings. These are the standard/most common forms for X86
// instructions.