summaryrefslogtreecommitdiffstats
path: root/llvm
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
commit450fd6ffbbeef7536401b6bf8b60fa9dc6ded42c (patch)
tree7e005559e0378619888eef2d2dc0e97ff9303e14 /llvm
parent607a2a1ed1c62a51368a1a2bdd49ef9eb339b66e (diff)
downloadbcm5719-llvm-450fd6ffbbeef7536401b6bf8b60fa9dc6ded42c.tar.gz
bcm5719-llvm-450fd6ffbbeef7536401b6bf8b60fa9dc6ded42c.zip
add a helper method.
llvm-svn: 82438
Diffstat (limited to 'llvm')
-rw-r--r--llvm/include/llvm/Operator.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/llvm/include/llvm/Operator.h b/llvm/include/llvm/Operator.h
index 06eb243418e..2b5cc57e75d 100644
--- a/llvm/include/llvm/Operator.h
+++ b/llvm/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; }
OpenPOWER on IntegriCloud