summaryrefslogtreecommitdiffstats
path: root/llvm/lib/VMCore
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2002-03-21 22:37:48 +0000
committerChris Lattner <sabre@nondot.org>2002-03-21 22:37:48 +0000
commiteae5096ebde945ba0f7937377c3c83780cef27d8 (patch)
treea1f36279024f0e7c218992c5d45875b7aad5b8e2 /llvm/lib/VMCore
parentd713541ffdf2dfba569a0662cc0eede211387d80 (diff)
downloadbcm5719-llvm-eae5096ebde945ba0f7937377c3c83780cef27d8.tar.gz
bcm5719-llvm-eae5096ebde945ba0f7937377c3c83780cef27d8.zip
* AllocationInst ctor moved here from iMemory.h
* AllocationInst now always has an array size operand llvm-svn: 1939
Diffstat (limited to 'llvm/lib/VMCore')
-rw-r--r--llvm/lib/VMCore/iMemory.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/llvm/lib/VMCore/iMemory.cpp b/llvm/lib/VMCore/iMemory.cpp
index 7280998a17d..cf80909d8b4 100644
--- a/llvm/lib/VMCore/iMemory.cpp
+++ b/llvm/lib/VMCore/iMemory.cpp
@@ -12,6 +12,21 @@ static inline const Type *checkType(const Type *Ty) {
return Ty;
}
+AllocationInst::AllocationInst(const Type *Ty, Value *ArraySize, unsigned iTy,
+ const std::string &Name = "")
+ : Instruction(Ty, iTy, Name) {
+ assert(Ty->isPointerType() && "Can't allocate a non pointer type!");
+
+ // ArraySize defaults to 1.
+ if (!ArraySize) ArraySize = ConstantUInt::get(Type::UIntTy, 1);
+
+ Operands.reserve(1);
+ assert(ArraySize->getType() == Type::UIntTy &&
+ "Malloc/Allocation array size != UIntTy!");
+
+ Operands.push_back(Use(ArraySize, this));
+}
+
bool AllocationInst::isArrayAllocation() const {
return getNumOperands() == 1 &&
getOperand(0) != ConstantUInt::get(Type::UIntTy, 1);
OpenPOWER on IntegriCloud