From a3d3c2b64545c00f70453642e5d84b028dfce671 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sat, 14 Jul 2001 06:13:19 +0000 Subject: [PATCH] * ValueHolder now takes 3 arguments * 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 | 9 ++++----- lib/VMCore/ConstantPool.cpp | 5 +++++ lib/VMCore/Function.cpp | 6 +++--- lib/VMCore/Module.cpp | 4 ++-- lib/VMCore/Value.cpp | 6 +++--- lib/VMCore/iMemory.cpp | 3 +++ 6 files changed, 20 insertions(+), 13 deletions(-) diff --git a/lib/VMCore/BasicBlock.cpp b/lib/VMCore/BasicBlock.cpp index 8fee4eff587..04941075e3e 100644 --- a/lib/VMCore/BasicBlock.cpp +++ b/lib/VMCore/BasicBlock.cpp @@ -17,13 +17,12 @@ // Instantiate Templates - This ugliness is the price we have to pay // for having a ValueHolderImpl.h file seperate from ValueHolder.h! :( // -template class ValueHolder; +template class ValueHolder; -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() { diff --git a/lib/VMCore/ConstantPool.cpp b/lib/VMCore/ConstantPool.cpp index 13463a17344..7f2f30a6064 100644 --- a/lib/VMCore/ConstantPool.cpp +++ b/lib/VMCore/ConstantPool.cpp @@ -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. // diff --git a/lib/VMCore/Function.cpp b/lib/VMCore/Function.cpp index aa0d08b0a2d..3d4a3547b0d 100644 --- a/lib/VMCore/Function.cpp +++ b/lib/VMCore/Function.cpp @@ -15,11 +15,11 @@ // Instantiate Templates - This ugliness is the price we have to pay // for having a ValueHolderImpl.h file seperate from ValueHolder.h! :( // -template class ValueHolder; -template class ValueHolder; +template class ValueHolder; +template class ValueHolder; 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; diff --git a/lib/VMCore/Module.cpp b/lib/VMCore/Module.cpp index cec75bd3fb6..9d0015f7696 100644 --- a/lib/VMCore/Module.cpp +++ b/lib/VMCore/Module.cpp @@ -14,10 +14,10 @@ // Instantiate Templates - This ugliness is the price we have to pay // for having a DefHolderImpl.h file seperate from DefHolder.h! :( // -template class ValueHolder; +template class ValueHolder; Module::Module() - : SymTabValue(0/*TODO: REAL TYPE*/, Value::ModuleVal, ""), + : Value(0/*TODO: REAL TYPE*/, Value::ModuleVal, ""), SymTabValue(this), MethodList(this, this) { } diff --git a/lib/VMCore/Value.cpp b/lib/VMCore/Value.cpp index a051bcb3cc6..48f9347f962 100644 --- a/lib/VMCore/Value.cpp +++ b/lib/VMCore/Value.cpp @@ -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; +template class ValueHolder; -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; } diff --git a/lib/VMCore/iMemory.cpp b/lib/VMCore/iMemory.cpp index 4403224b880..a003e89a105 100644 --- a/lib/VMCore/iMemory.cpp +++ b/lib/VMCore/iMemory.cpp @@ -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(); +} -- 2.34.1