* 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
diff --git a/lib/VMCore/BasicBlock.cpp b/lib/VMCore/BasicBlock.cpp
index 8fee4ef..0494107 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<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() {
diff --git a/lib/VMCore/ConstantPool.cpp b/lib/VMCore/ConstantPool.cpp
index 13463a1..7f2f30a 100644
--- a/lib/VMCore/ConstantPool.cpp
+++ b/lib/VMCore/ConstantPool.cpp
@@ -23,6 +23,11 @@
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 aa0d08b..3d4a354 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<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;
diff --git a/lib/VMCore/Module.cpp b/lib/VMCore/Module.cpp
index cec75bd..9d0015f 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<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) {
}
diff --git a/lib/VMCore/Value.cpp b/lib/VMCore/Value.cpp
index a051bcb..48f9347 100644
--- a/lib/VMCore/Value.cpp
+++ b/lib/VMCore/Value.cpp
@@ -106,10 +106,10 @@
// 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;
}
diff --git a/lib/VMCore/iMemory.cpp b/lib/VMCore/iMemory.cpp
index 4403224..a003e89 100644
--- a/lib/VMCore/iMemory.cpp
+++ b/lib/VMCore/iMemory.cpp
@@ -95,3 +95,6 @@
Operands.push_back(Use(Idx[i], this));
}
+bool GetElementPtrInst::isStructSelector() const {
+ return ((PointerType*)Operands[0]->getType())->getValueType()->isStructType();
+}