summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-09-21 05:52:45 +0000
committerChris Lattner <sabre@nondot.org>2009-09-21 05:52:45 +0000
commit0c1f688954a087017bcaa0d4e88c1ebd64f11c45 (patch)
treeb9fd349aa4ed46acf7ef402e8b81b95167b925f4 /include
parentb0f5973bee566269f41d1cc21b7a1d3bede1d837 (diff)
downloadllvm-0c1f688954a087017bcaa0d4e88c1ebd64f11c45.tar.gz
llvm-0c1f688954a087017bcaa0d4e88c1ebd64f11c45.tar.bz2
llvm-0c1f688954a087017bcaa0d4e88c1ebd64f11c45.tar.xz
add a helper method.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82438 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/Operator.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/include/llvm/Operator.h b/include/llvm/Operator.h
index 06eb243418..2b5cc57e75 100644
--- a/include/llvm/Operator.h
+++ b/include/llvm/Operator.h
@@ -274,6 +274,18 @@ public:
return true;
}
+ /// hasAllConstantIndices - Return true if all of the indices of this GEP are
+ /// constant integers. If so, the result pointer and the first operand have
+ /// a constant offset between them.
+ bool hasAllConstantIndices() const {
+ for (const_op_iterator I = idx_begin(), E = idx_end(); I != E; ++I) {
+ if (!isa<ConstantInt>(I))
+ return false;
+ }
+ return true;
+ }
+
+
// Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const GEPOperator *) { return true; }
static inline bool classof(const GetElementPtrInst *) { return true; }