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

Alkis Evlogimenos alkis at cs.uiuc.edu
Sat Mar 19 03:40:43 PST 2005



Changes in directory llvm/lib/VMCore:

Constants.cpp updated: 1.124 -> 1.125
---
Log message:

Add new function getPtrPtrFromArrayPtr().


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

 Constants.cpp |    7 +++++++
 1 files changed, 7 insertions(+)


Index: llvm/lib/VMCore/Constants.cpp
diff -u llvm/lib/VMCore/Constants.cpp:1.124 llvm/lib/VMCore/Constants.cpp:1.125
--- llvm/lib/VMCore/Constants.cpp:1.124	Wed Mar  9 09:19:41 2005
+++ llvm/lib/VMCore/Constants.cpp	Sat Mar 19 05:40:31 2005
@@ -1298,6 +1298,13 @@
     Type::ULongTy);
 }
 
+Constant *ConstantExpr::getPtrPtrFromArrayPtr(Constant *C) {
+  // pointer from array is implemented as: getelementptr arr ptr, 0, 0
+  static std::vector<Constant*> Indices(2, ConstantUInt::get(Type::UIntTy, 0));
+
+  return ConstantExpr::getGetElementPtr(C, Indices);
+}
+
 Constant *ConstantExpr::getTy(const Type *ReqTy, unsigned Opcode,
                               Constant *C1, Constant *C2) {
   if (Opcode == Instruction::Shl || Opcode == Instruction::Shr)






More information about the llvm-commits mailing list