1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-25 12:12:47 +01:00

* 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

llvm-svn: 184
This commit is contained in:
Chris Lattner 2001-07-14 06:13:19 +00:00
parent a969eb234b
commit d3e41d4d2f
6 changed files with 20 additions and 13 deletions

View File

@ -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() {

View 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.
//

View File

@ -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;

View File

@ -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) {
}

View 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;
}

View 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();
}