[llvm-commits] [llvm] r82438 - /llvm/trunk/include/llvm/Operator.h
Chris Lattner
sabre at nondot.org
Sun Sep 20 22:52:45 PDT 2009
Author: lattner
Date: Mon Sep 21 00:52:45 2009
New Revision: 82438
URL: http://llvm.org/viewvc/llvm-project?rev=82438&view=rev
Log:
add a helper method.
Modified:
llvm/trunk/include/llvm/Operator.h
Modified: llvm/trunk/include/llvm/Operator.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Operator.h?rev=82438&r1=82437&r2=82438&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Operator.h (original)
+++ llvm/trunk/include/llvm/Operator.h Mon Sep 21 00:52:45 2009
@@ -274,6 +274,18 @@
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; }
More information about the llvm-commits
mailing list