summaryrefslogtreecommitdiffstats
path: root/llvm/lib/VMCore/Function.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2001-10-03 14:53:21 +0000
committerChris Lattner <sabre@nondot.org>2001-10-03 14:53:21 +0000
commit7fac070215c8d4fd4a41ae58750e6c1faef4931f (patch)
tree65568c242ce17aae14e6f3319ae88b056aa1f474 /llvm/lib/VMCore/Function.cpp
parent23356658b3a2dba4126d82e8e062585ad83f1b20 (diff)
downloadbcm5719-llvm-7fac070215c8d4fd4a41ae58750e6c1faef4931f.tar.gz
bcm5719-llvm-7fac070215c8d4fd4a41ae58750e6c1faef4931f.zip
* Both Method & GlobalVariable now subclass GlobalValue
* ConstPoolPointerReference now represents a pointer to a GlobalValue * Methods name references are now explicit pointers to methods * Rename Value::GlobalVal to Value::GlobalVariableVal to avoid confusion llvm-svn: 703
Diffstat (limited to 'llvm/lib/VMCore/Function.cpp')
-rw-r--r--llvm/lib/VMCore/Function.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/llvm/lib/VMCore/Function.cpp b/llvm/lib/VMCore/Function.cpp
index 9eb8277a272..372d0d28b91 100644
--- a/llvm/lib/VMCore/Function.cpp
+++ b/llvm/lib/VMCore/Function.cpp
@@ -26,8 +26,8 @@ template class ValueHolder<MethodArgument, Method, Method>;
template class ValueHolder<BasicBlock , Method, Method>;
Method::Method(const MethodType *Ty, const string &name)
- : Value(Ty, Value::MethodVal, name), SymTabValue(this), BasicBlocks(this),
- ArgumentList(this, this) {
+ : GlobalValue(PointerType::get(Ty), Value::MethodVal, name),
+ SymTabValue(this), BasicBlocks(this), ArgumentList(this, this) {
assert(::isa<MethodType>(Ty) && "Method signature must be of method type!");
Parent = 0;
}
@@ -62,8 +62,12 @@ void Method::setParent(Module *parent) {
setParentSymTab(Parent ? Parent->getSymbolTableSure() : 0);
}
+const MethodType *Method::getMethodType() const {
+ return cast<MethodType>(cast<PointerType>(getType())->getValueType());
+}
+
const Type *Method::getReturnType() const {
- return ((const MethodType *)getType())->getReturnType();
+ return getMethodType()->getReturnType();
}
// dropAllReferences() - This function causes all the subinstructions to "let
@@ -85,8 +89,8 @@ void Method::dropAllReferences() {
GlobalVariable::GlobalVariable(const Type *Ty, bool isConstant,
ConstPoolVal *Initializer = 0,
const string &Name = "")
- : User(Ty, Value::GlobalVal, Name), Parent(0), Constant(isConstant) {
- assert(Ty->isPointerType() && "Global Variables must be pointers!");
+ : GlobalValue(PointerType::get(Ty), Value::GlobalVariableVal, Name),
+ Parent(0), Constant(isConstant) {
if (Initializer) Operands.push_back(Use((Value*)Initializer, this));
assert(!isConstant || hasInitializer() &&
OpenPOWER on IntegriCloud