diff options
author | Alkis Evlogimenos <alkis@evlogimenos.com> | 2005-03-19 11:40:31 +0000 |
---|---|---|
committer | Alkis Evlogimenos <alkis@evlogimenos.com> | 2005-03-19 11:40:31 +0000 |
commit | 1cecd3a1d2846315c00cb1cf122372d7e096af8a (patch) | |
tree | 88bfa77d389a6886af6e7d774aa0b691ae9cb034 /lib | |
parent | 12cf385662abfd4622bff7456e36ca485e8f6eb1 (diff) |
Add new function getPtrPtrFromArrayPtr().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20684 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/VMCore/Constants.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/VMCore/Constants.cpp b/lib/VMCore/Constants.cpp index 71754fdac4..ee60f804b3 100644 --- a/lib/VMCore/Constants.cpp +++ b/lib/VMCore/Constants.cpp @@ -1298,6 +1298,13 @@ Constant *ConstantExpr::getSizeOf(const Type *Ty) { 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) |