aboutsummaryrefslogtreecommitdiffstats
path: root/include/llvm/iMemory.h
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2001-10-02 03:41:24 +0000
committerChris Lattner <sabre@nondot.org>2001-10-02 03:41:24 +0000
commitb00c582b6d40e6b9ff2d1ed4f5eaf7930e792ace (patch)
tree44b5f879c16e7ecb2e9334ad120e3454270e1bb3 /include/llvm/iMemory.h
parent1d87bcf4909b06dcd86320722653341f08b8b396 (diff)
downloadexternal_llvm-b00c582b6d40e6b9ff2d1ed4f5eaf7930e792ace.zip
external_llvm-b00c582b6d40e6b9ff2d1ed4f5eaf7930e792ace.tar.gz
external_llvm-b00c582b6d40e6b9ff2d1ed4f5eaf7930e792ace.tar.bz2
Commit more code over to new cast style
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@697 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/iMemory.h')
-rw-r--r--include/llvm/iMemory.h63
1 files changed, 59 insertions, 4 deletions
diff --git a/include/llvm/iMemory.h b/include/llvm/iMemory.h
index 5667da6..147ff18 100644
--- a/include/llvm/iMemory.h
+++ b/include/llvm/iMemory.h
@@ -27,16 +27,16 @@ public:
if (ArraySize) {
// Make sure they didn't try to specify a size for !(unsized array) type
- assert((getType()->getValueType()->isArrayType() &&
- ((const ArrayType*)getType()->getValueType())->isUnsized()) &&
- "Trying to allocate something other than unsized array, with size!");
+ assert(getType()->getValueType()->isArrayType() &&
+ cast<ArrayType>(getType()->getValueType())->isUnsized() &&
+ "Trying to allocate something other than unsized array, with size!");
Operands.reserve(1);
Operands.push_back(Use(ArraySize, this));
} else {
// Make sure that the pointer is not to an unsized array!
assert(!getType()->getValueType()->isArrayType() ||
- ((const ArrayType*)getType()->getValueType())->isSized() &&
+ cast<const ArrayType>(getType()->getValueType())->isSized() &&
"Trying to allocate unsized array without size!");
}
}
@@ -64,6 +64,15 @@ public:
}
virtual const char *getOpcodeName() const { return "malloc"; }
+
+ // Methods for support type inquiry through isa, cast, and dyn_cast:
+ static inline bool classof(const MallocInst *) { return true; }
+ static inline bool classof(const Instruction *I) {
+ return (I->getOpcode() == Instruction::Malloc);
+ }
+ static inline bool classof(const Value *V) {
+ return isa<Instruction>(V) && classof(cast<Instruction>(V));
+ }
};
@@ -81,6 +90,15 @@ public:
}
virtual const char *getOpcodeName() const { return "alloca"; }
+
+ // Methods for support type inquiry through isa, cast, and dyn_cast:
+ static inline bool classof(const AllocaInst *) { return true; }
+ static inline bool classof(const Instruction *I) {
+ return (I->getOpcode() == Instruction::Alloca);
+ }
+ static inline bool classof(const Value *V) {
+ return isa<Instruction>(V) && classof(cast<Instruction>(V));
+ }
};
@@ -102,6 +120,15 @@ public:
virtual const char *getOpcodeName() const { return "free"; }
virtual bool hasSideEffects() const { return true; }
+
+ // Methods for support type inquiry through isa, cast, and dyn_cast:
+ static inline bool classof(const FreeInst *) { return true; }
+ static inline bool classof(const Instruction *I) {
+ return (I->getOpcode() == Instruction::Free);
+ }
+ static inline bool classof(const Value *V) {
+ return isa<Instruction>(V) && classof(cast<Instruction>(V));
+ }
};
@@ -160,6 +187,15 @@ public:
virtual const char* getOpcodeName() const { return "load"; }
virtual Value* getPtrOperand() { return this->getOperand(0); }
virtual int getFirstOffsetIdx() const { return (this->getNumOperands() > 1)? 1 : -1;}
+
+ // Methods for support type inquiry through isa, cast, and dyn_cast:
+ static inline bool classof(const LoadInst *) { return true; }
+ static inline bool classof(const Instruction *I) {
+ return (I->getOpcode() == Instruction::Load);
+ }
+ static inline bool classof(const Value *V) {
+ return isa<Instruction>(V) && classof(cast<Instruction>(V));
+ }
};
@@ -182,6 +218,15 @@ public:
virtual bool hasSideEffects() const { return true; }
virtual Value* getPtrOperand() { return this->getOperand(1); }
virtual int getFirstOffsetIdx() const { return (this->getNumOperands() > 2)? 2 : -1;}
+
+ // Methods for support type inquiry through isa, cast, and dyn_cast:
+ static inline bool classof(const StoreInst *) { return true; }
+ static inline bool classof(const Instruction *I) {
+ return (I->getOpcode() == Instruction::Store);
+ }
+ static inline bool classof(const Value *V) {
+ return isa<Instruction>(V) && classof(cast<Instruction>(V));
+ }
};
@@ -206,6 +251,16 @@ public:
inline bool isArraySelector() const { return !isStructSelector(); }
bool isStructSelector() const;
+
+
+ // Methods for support type inquiry through isa, cast, and dyn_cast:
+ static inline bool classof(const GetElementPtrInst *) { return true; }
+ static inline bool classof(const Instruction *I) {
+ return (I->getOpcode() == Instruction::GetElementPtr);
+ }
+ static inline bool classof(const Value *V) {
+ return isa<Instruction>(V) && classof(cast<Instruction>(V));
+ }
};
#endif // LLVM_IMEMORY_H