* ValueHolder now takes 3 arguments
authorChris Lattner <sabre@nondot.org>
Sat, 14 Jul 2001 06:13:19 +0000 (06:13 +0000)
committerChris Lattner <sabre@nondot.org>
Sat, 14 Jul 2001 06:13:19 +0000 (06:13 +0000)
* Added a few methods to ConstantPool
* ConstPoolVal no longer derives from Value
* Method & Module multiply inherit from SymTabValue & Value now
* Added a GetElementPtrInst::isStructSelector() method

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184 91177308-0d34-0410-b5e6-96231b3b80d8

lib/VMCore/BasicBlock.cpp
lib/VMCore/ConstantPool.cpp
lib/VMCore/Function.cpp
lib/VMCore/Module.cpp
lib/VMCore/Value.cpp
lib/VMCore/iMemory.cpp

index 8fee4eff587a02a110ee67991469b8bcc488b116..04941075e3e7defa40fd3753128a6cb1bedb2ed8 100644 (file)
 // Instantiate Templates - This ugliness is the price we have to pay
 // for having a ValueHolderImpl.h file seperate from ValueHolder.h!  :(
 //
-template class ValueHolder<Instruction, BasicBlock>;
+template class ValueHolder<Instruction, BasicBlock, Method>;
 
-BasicBlock::BasicBlock(const string &name, Method *parent)
+BasicBlock::BasicBlock(const string &name, Method *Parent)
   : Value(Type::LabelTy, Value::BasicBlockVal, name), InstList(this, 0) {
-
-  if (parent)
-    parent->getBasicBlocks().push_back(this);
+  if (Parent)
+    Parent->getBasicBlocks().push_back(this);
 }
 
 BasicBlock::~BasicBlock() {
index 13463a17344403af8b926d0b9bf26e1c3aca4b2e..7f2f30a6064ca39e67de0e320cf9a6423271834c 100644 (file)
@@ -23,6 +23,11 @@ void ConstantPool::setParent(SymTabValue *STV) {
     Planes[i]->setParent(Parent);  
 }
 
+const Value *ConstantPool::getParentV() const { return Parent->getSTVParent(); }
+Value *ConstantPool::getParentV() { return Parent->getSTVParent(); }
+
+
+
 // Constant getPlane - Returns true if the type plane does not exist, otherwise
 // updates the pointer to point to the correct plane.
 //
index aa0d08b0a2db35c18b59d7e8b1f5c36e350588f3..3d4a3547b0d7448bf4c53ac7457373982bcad8fc 100644 (file)
 // Instantiate Templates - This ugliness is the price we have to pay
 // for having a ValueHolderImpl.h file seperate from ValueHolder.h!  :(
 //
-template class ValueHolder<MethodArgument, Method>;
-template class ValueHolder<BasicBlock    , Method>;
+template class ValueHolder<MethodArgument, Method, Method>;
+template class ValueHolder<BasicBlock    , Method, Method>;
 
 Method::Method(const MethodType *Ty, const string &name) 
-  : SymTabValue(Ty, Value::MethodVal, name), BasicBlocks(this), 
+  : Value(Ty, Value::MethodVal, name), SymTabValue(this), BasicBlocks(this), 
     ArgumentList(this, this) {
   assert(Ty->isMethodType() && "Method signature must be of method type!");
   Parent = 0;
index cec75bd3fb6e5db39c4da3dbda50b03f5760ac2d..9d0015f7696a232213035cf2e6b3cc68f66f7cde 100644 (file)
 // Instantiate Templates - This ugliness is the price we have to pay
 // for having a DefHolderImpl.h file seperate from DefHolder.h!  :(
 //
-template class ValueHolder<Method, Module>;
+template class ValueHolder<Method, Module, Module>;
 
 Module::Module()
-  : SymTabValue(0/*TODO: REAL TYPE*/, Value::ModuleVal, ""),
+  : Value(0/*TODO: REAL TYPE*/, Value::ModuleVal, ""), SymTabValue(this),
     MethodList(this, this) {
 }
 
index a051bcb3cc6d36e2833c5c92fa600585c74e8f53..48f9347f962e6394ef8c0593973066cbd4e435ba 100644 (file)
@@ -106,10 +106,10 @@ void User::replaceUsesOfWith(Value *From, Value *To) {
 // Instantiate Templates - This ugliness is the price we have to pay
 // for having a ValueHolderImpl.h file seperate from ValueHolder.h!  :(
 //
-template class ValueHolder<ConstPoolVal, SymTabValue>;
+template class ValueHolder<ConstPoolVal, SymTabValue, SymTabValue>;
 
-SymTabValue::SymTabValue(const Type *Ty, ValueTy dty, const string &name = "") 
-  : Value(Ty, dty, name), ConstPool(this) { 
+SymTabValue::SymTabValue(Value *p) : ConstPool(this), ValueParent(p) { 
+  assert(ValueParent && "SymTavValue without parent!?!");
   ParentSymTab = SymTab = 0;
 }
 
index 4403224b880e0c5bbc72f8f86696f363e9fe6cf2..a003e89a10523f407a6c3f02d0a0f2e80a699c12 100644 (file)
@@ -95,3 +95,6 @@ GetElementPtrInst::GetElementPtrInst(Value *Ptr,
     Operands.push_back(Use(Idx[i], this));
 }
 
+bool GetElementPtrInst::isStructSelector() const {
+  return ((PointerType*)Operands[0]->getType())->getValueType()->isStructType();
+}