summaryrefslogtreecommitdiff
path: root/lib/VMCore
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2001-07-14 06:13:19 +0000
committerChris Lattner <sabre@nondot.org>2001-07-14 06:13:19 +0000
commita3d3c2b64545c00f70453642e5d84b028dfce671 (patch)
tree587a52c39934f230cc50f86ffcbbde95ee2223b2 /lib/VMCore
parent3b7bfdb201fadea61639dee8f4de4181d745e858 (diff)
downloadllvm-a3d3c2b64545c00f70453642e5d84b028dfce671.tar.gz
llvm-a3d3c2b64545c00f70453642e5d84b028dfce671.tar.bz2
llvm-a3d3c2b64545c00f70453642e5d84b028dfce671.tar.xz
* 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
Diffstat (limited to 'lib/VMCore')
-rw-r--r--lib/VMCore/BasicBlock.cpp9
-rw-r--r--lib/VMCore/ConstantPool.cpp5
-rw-r--r--lib/VMCore/Function.cpp6
-rw-r--r--lib/VMCore/Module.cpp4
-rw-r--r--lib/VMCore/Value.cpp6
-rw-r--r--lib/VMCore/iMemory.cpp3
6 files changed, 20 insertions, 13 deletions
diff --git a/lib/VMCore/BasicBlock.cpp b/lib/VMCore/BasicBlock.cpp
index 8fee4eff58..04941075e3 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 13463a1734..7f2f30a606 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 aa0d08b0a2..3d4a3547b0 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 cec75bd3fb..9d0015f769 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 a051bcb3cc..48f9347f96 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<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 4403224b88..a003e89a10 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();
+}