[llvm-commits] CVS: llvm/lib/VMCore/iMemory.cpp
Chris Lattner
lattner at cs.uiuc.edu
Thu Jul 1 15:25:11 PDT 2004
Changes in directory llvm/lib/VMCore:
iMemory.cpp updated: 1.40 -> 1.41
---
Log message:
Add much better assertion checking for load and store insts.
Contributed by Vladimir Merzliakov!
---
Diffs of the changes: (+17 -0)
Index: llvm/lib/VMCore/iMemory.cpp
diff -u llvm/lib/VMCore/iMemory.cpp:1.40 llvm/lib/VMCore/iMemory.cpp:1.41
--- llvm/lib/VMCore/iMemory.cpp:1.40 Wed May 26 19:15:23 2004
+++ llvm/lib/VMCore/iMemory.cpp Thu Jul 1 15:23:52 2004
@@ -86,6 +86,13 @@
// LoadInst Implementation
//===----------------------------------------------------------------------===//
+void LoadInst::init(Value *Ptr) {
+ assert(Ptr && isa<PointerType>(Ptr->getType()) &&
+ "Ptr must have pointer type.");
+ Operands.reserve(1);
+ Operands.push_back(Use(Ptr, this));
+}
+
LoadInst::LoadInst(Value *Ptr, const std::string &Name, Instruction *InsertBef)
: Instruction(cast<PointerType>(Ptr->getType())->getElementType(),
Load, Name, InsertBef), Volatile(false) {
@@ -112,6 +119,7 @@
init(Ptr);
}
+
//===----------------------------------------------------------------------===//
// StoreInst Implementation
//===----------------------------------------------------------------------===//
@@ -138,6 +146,15 @@
init(Val, Ptr);
}
+void StoreInst::init(Value *Val, Value *Ptr) {
+ assert(isa<PointerType>(Ptr->getType()) &&
+ Val->getType() == cast<PointerType>(Ptr->getType())->getElementType()
+ && "Ptr must have pointer type.");
+
+ Operands.reserve(2);
+ Operands.push_back(Use(Val, this));
+ Operands.push_back(Use(Ptr, this));
+}
//===----------------------------------------------------------------------===//
// GetElementPtrInst Implementation
More information about the llvm-commits
mailing list