mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-03-03 18:09:29 +00:00
* AllocationInst ctor moved here from iMemory.h
* AllocationInst now always has an array size operand llvm-svn: 1939
This commit is contained in:
parent
e8057176ec
commit
8051e7c953
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user