summaryrefslogtreecommitdiff
path: root/include/llvm/iMemory.h
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2001-12-14 16:22:56 +0000
committerChris Lattner <sabre@nondot.org>2001-12-14 16:22:56 +0000
commita1c7df8286b2949c12867462c0af546659402e86 (patch)
tree2f14906485184798159641750c5cc54fc3cbd15c /include/llvm/iMemory.h
parent389e1118a7cb7601e4f888ae58fe16fc92fce18a (diff)
downloadllvm-a1c7df8286b2949c12867462c0af546659402e86.tar.gz
llvm-a1c7df8286b2949c12867462c0af546659402e86.tar.bz2
llvm-a1c7df8286b2949c12867462c0af546659402e86.tar.xz
* Remove support for unsized arrays.
* Free instruction does not accept a name * MemAccessInst can now be used with cast/isa/dyn_cast/... git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1455 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/iMemory.h')
-rw-r--r--include/llvm/iMemory.h22
1 files changed, 11 insertions, 11 deletions
diff --git a/include/llvm/iMemory.h b/include/llvm/iMemory.h
index 13843d2274..2f2ebd8b60 100644
--- a/include/llvm/iMemory.h
+++ b/include/llvm/iMemory.h
@@ -26,20 +26,11 @@ public:
assert(Ty->isPointerType() && "Can't allocate a non pointer type!");
if (ArraySize) {
- // Make sure they didn't try to specify a size for !(unsized array) type
- assert(getType()->getElementType()->isArrayType() &&
- cast<ArrayType>(getType()->getElementType())->isUnsized() &&
- "Trying to allocate something other than unsized array, with size!");
assert(ArraySize->getType() == Type::UIntTy &&
"Malloc/Allocation array size != UIntTy!");
Operands.reserve(1);
Operands.push_back(Use(ArraySize, this));
- } else {
- // Make sure that the pointer is not to an unsized array!
- assert(!getType()->getElementType()->isArrayType() ||
- cast<const ArrayType>(getType()->getElementType())->isSized() &&
- "Trying to allocate unsized array without size!");
}
}
@@ -130,8 +121,7 @@ public:
class FreeInst : public Instruction {
public:
- FreeInst(Value *Ptr, const string &Name = "")
- : Instruction(Type::VoidTy, Free, Name) {
+ FreeInst(Value *Ptr) : Instruction(Type::VoidTy, Free, "") {
assert(Ptr->getType()->isPointerType() && "Can't free nonpointer!");
Operands.reserve(1);
Operands.push_back(Use(Ptr, this));
@@ -206,6 +196,16 @@ public:
inline bool hasIndices() const {
return getNumOperands() > getFirstIndexOperandNumber();
}
+
+ // Methods for support type inquiry through isa, cast, and dyn_cast:
+ static inline bool classof(const MemAccessInst *) { return true; }
+ static inline bool classof(const Instruction *I) {
+ return I->getOpcode() == Load || I->getOpcode() == Store ||
+ I->getOpcode() == GetElementPtr;
+ }
+ static inline bool classof(const Value *V) {
+ return isa<Instruction>(V) && classof(cast<Instruction>(V));
+ }
};