* 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
// 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() {
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.
//
// 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;
// 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) {
}
// 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;
}
Operands.push_back(Use(Idx[i], this));
}
+bool GetElementPtrInst::isStructSelector() const {
+ return ((PointerType*)Operands[0]->getType())->getValueType()->isStructType();
+}