summaryrefslogtreecommitdiffstats
path: root/llvm/lib/VMCore/Function.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2002-09-06 21:33:15 +0000
committerChris Lattner <sabre@nondot.org>2002-09-06 21:33:15 +0000
commit9ed7aef651c798dd08039ba1fa68165edd0b5567 (patch)
tree107688ce7579e4f1ca2d2e0c5d48f29b68179295 /llvm/lib/VMCore/Function.cpp
parent809375647d03a4d89c1f3327cc68e68a1c7e7e84 (diff)
downloadbcm5719-llvm-9ed7aef651c798dd08039ba1fa68165edd0b5567.tar.gz
bcm5719-llvm-9ed7aef651c798dd08039ba1fa68165edd0b5567.zip
Move code out of header files into .cpp files to make future changes easier
llvm-svn: 3605
Diffstat (limited to 'llvm/lib/VMCore/Function.cpp')
-rw-r--r--llvm/lib/VMCore/Function.cpp27
1 files changed, 25 insertions, 2 deletions
diff --git a/llvm/lib/VMCore/Function.cpp b/llvm/lib/VMCore/Function.cpp
index 3ad7a66c5ce..59017178f68 100644
--- a/llvm/lib/VMCore/Function.cpp
+++ b/llvm/lib/VMCore/Function.cpp
@@ -10,6 +10,10 @@
#include "llvm/iOther.h"
#include "SymbolTableListTraitsImpl.h"
+BasicBlock *ilist_traits<BasicBlock>::createNode() {
+ return new BasicBlock();
+}
+
iplist<BasicBlock> &ilist_traits<BasicBlock>::getList(Function *F) {
return F->getBasicBlockList();
}
@@ -31,6 +35,14 @@ template SymbolTableListTraits<BasicBlock, Function, Function>;
// Argument Implementation
//===----------------------------------------------------------------------===//
+Argument::Argument(const Type *Ty, const std::string &Name = "", Function *Par)
+ : Value(Ty, Value::ArgumentVal, Name) {
+ Parent = 0;
+ if (Par)
+ Par->getArgumentList().push_back(this);
+}
+
+
// Specialize setName to take care of symbol table majik
void Argument::setName(const std::string &name, SymbolTable *ST) {
Function *P;
@@ -41,11 +53,15 @@ void Argument::setName(const std::string &name, SymbolTable *ST) {
if (P && hasName()) P->getSymbolTable()->insert(this);
}
+void Argument::setParent(Function *parent) {
+ Parent = parent;
+}
+
+
//===----------------------------------------------------------------------===//
// Function Implementation
//===----------------------------------------------------------------------===//
-
Function::Function(const FunctionType *Ty, bool isInternal,
const std::string &name, Module *ParentModule)
: GlobalValue(PointerType::get(Ty), Value::FunctionVal, isInternal, name) {
@@ -136,10 +152,17 @@ void Function::dropAllReferences() {
GlobalVariable::GlobalVariable(const Type *Ty, bool constant, bool isIntern,
Constant *Initializer,
- const std::string &Name)
+ const std::string &Name, Module *ParentModule)
: GlobalValue(PointerType::get(Ty), Value::GlobalVariableVal, isIntern, Name),
isConstantGlobal(constant) {
if (Initializer) Operands.push_back(Use((Value*)Initializer, this));
+
+ if (ParentModule)
+ ParentModule->getGlobalList().push_back(this);
+}
+
+void GlobalVariable::setParent(Module *parent) {
+ Parent = parent;
}
// Specialize setName to take care of symbol table majik
OpenPOWER on IntegriCloud