mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-18 14:31:27 +00:00
Move code out of header files into .cpp files to make future changes easier
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3605 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
fab8c796f6
commit
bded132d00
@ -48,6 +48,9 @@ iplist<Instruction> &ilist_traits<Instruction>::getList(BasicBlock *BB) {
|
|||||||
template SymbolTableListTraits<Instruction, BasicBlock, Function>;
|
template SymbolTableListTraits<Instruction, BasicBlock, Function>;
|
||||||
|
|
||||||
|
|
||||||
|
// BasicBlock ctor - If the function parameter is specified, the basic block is
|
||||||
|
// automatically inserted at the end of the function.
|
||||||
|
//
|
||||||
BasicBlock::BasicBlock(const std::string &name, Function *Parent)
|
BasicBlock::BasicBlock(const std::string &name, Function *Parent)
|
||||||
: Value(Type::LabelTy, Value::BasicBlockVal, name) {
|
: Value(Type::LabelTy, Value::BasicBlockVal, name) {
|
||||||
// Initialize the instlist...
|
// Initialize the instlist...
|
||||||
@ -62,6 +65,10 @@ BasicBlock::~BasicBlock() {
|
|||||||
InstList.clear();
|
InstList.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BasicBlock::setParent(Function *parent) {
|
||||||
|
InstList.setParent(parent);
|
||||||
|
}
|
||||||
|
|
||||||
// Specialize setName to take care of symbol table majik
|
// Specialize setName to take care of symbol table majik
|
||||||
void BasicBlock::setName(const std::string &name, SymbolTable *ST) {
|
void BasicBlock::setName(const std::string &name, SymbolTable *ST) {
|
||||||
Function *P;
|
Function *P;
|
||||||
|
@ -10,6 +10,10 @@
|
|||||||
#include "llvm/iOther.h"
|
#include "llvm/iOther.h"
|
||||||
#include "SymbolTableListTraitsImpl.h"
|
#include "SymbolTableListTraitsImpl.h"
|
||||||
|
|
||||||
|
BasicBlock *ilist_traits<BasicBlock>::createNode() {
|
||||||
|
return new BasicBlock();
|
||||||
|
}
|
||||||
|
|
||||||
iplist<BasicBlock> &ilist_traits<BasicBlock>::getList(Function *F) {
|
iplist<BasicBlock> &ilist_traits<BasicBlock>::getList(Function *F) {
|
||||||
return F->getBasicBlockList();
|
return F->getBasicBlockList();
|
||||||
}
|
}
|
||||||
@ -31,6 +35,14 @@ template SymbolTableListTraits<BasicBlock, Function, Function>;
|
|||||||
// Argument Implementation
|
// 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
|
// Specialize setName to take care of symbol table majik
|
||||||
void Argument::setName(const std::string &name, SymbolTable *ST) {
|
void Argument::setName(const std::string &name, SymbolTable *ST) {
|
||||||
Function *P;
|
Function *P;
|
||||||
@ -41,11 +53,15 @@ void Argument::setName(const std::string &name, SymbolTable *ST) {
|
|||||||
if (P && hasName()) P->getSymbolTable()->insert(this);
|
if (P && hasName()) P->getSymbolTable()->insert(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Argument::setParent(Function *parent) {
|
||||||
|
Parent = parent;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
// Function Implementation
|
// Function Implementation
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
|
|
||||||
Function::Function(const FunctionType *Ty, bool isInternal,
|
Function::Function(const FunctionType *Ty, bool isInternal,
|
||||||
const std::string &name, Module *ParentModule)
|
const std::string &name, Module *ParentModule)
|
||||||
: GlobalValue(PointerType::get(Ty), Value::FunctionVal, isInternal, name) {
|
: GlobalValue(PointerType::get(Ty), Value::FunctionVal, isInternal, name) {
|
||||||
@ -136,10 +152,17 @@ void Function::dropAllReferences() {
|
|||||||
|
|
||||||
GlobalVariable::GlobalVariable(const Type *Ty, bool constant, bool isIntern,
|
GlobalVariable::GlobalVariable(const Type *Ty, bool constant, bool isIntern,
|
||||||
Constant *Initializer,
|
Constant *Initializer,
|
||||||
const std::string &Name)
|
const std::string &Name, Module *ParentModule)
|
||||||
: GlobalValue(PointerType::get(Ty), Value::GlobalVariableVal, isIntern, Name),
|
: GlobalValue(PointerType::get(Ty), Value::GlobalVariableVal, isIntern, Name),
|
||||||
isConstantGlobal(constant) {
|
isConstantGlobal(constant) {
|
||||||
if (Initializer) Operands.push_back(Use((Value*)Initializer, this));
|
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
|
// Specialize setName to take care of symbol table majik
|
||||||
|
@ -14,6 +14,10 @@ Instruction::Instruction(const Type *ty, unsigned it, const std::string &Name)
|
|||||||
iType = it;
|
iType = it;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Instruction::setParent(BasicBlock *P) {
|
||||||
|
Parent = P;
|
||||||
|
}
|
||||||
|
|
||||||
// Specialize setName to take care of symbol table majik
|
// Specialize setName to take care of symbol table majik
|
||||||
void Instruction::setName(const std::string &name, SymbolTable *ST) {
|
void Instruction::setName(const std::string &name, SymbolTable *ST) {
|
||||||
BasicBlock *P = 0; Function *PP = 0;
|
BasicBlock *P = 0; Function *PP = 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user