[llvm-commits] CVS: llvm/lib/VMCore/Instructions.cpp

Chris Lattner sabre at nondot.org
Fri Apr 27 13:36:19 PDT 2007



Changes in directory llvm/lib/VMCore:

Instructions.cpp updated: 1.90 -> 1.91
---
Log message:

add a GEP helper function


---
Diffs of the changes:  (+11 -0)

 Instructions.cpp |   11 +++++++++++
 1 files changed, 11 insertions(+)


Index: llvm/lib/VMCore/Instructions.cpp
diff -u llvm/lib/VMCore/Instructions.cpp:1.90 llvm/lib/VMCore/Instructions.cpp:1.91
--- llvm/lib/VMCore/Instructions.cpp:1.90	Sun Apr 22 14:24:39 2007
+++ llvm/lib/VMCore/Instructions.cpp	Fri Apr 27 15:35:56 2007
@@ -1043,6 +1043,17 @@
   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 GetElementPtrInst::hasAllConstantIndices() const {
+  for (unsigned i = 1, e = getNumOperands(); i != e; ++i) {
+    if (!isa<ConstantInt>(getOperand(i)))
+      return false;
+  }
+  return true;
+}
+
 
 //===----------------------------------------------------------------------===//
 //                           ExtractElementInst Implementation






More information about the llvm-commits mailing list