mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-23 02:29:18 +00:00
* Clean up some comments
* Move code out of header file to .cpp files, to make future changes easier * Add arguments to classes so that they can be automatically inserted into their parent structure upon creation. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3604 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
82f2f954fd
commit
fab8c796f6
@ -1,7 +1,7 @@
|
|||||||
//===-- llvm/Argument.h - Definition of the Argument class -------*- C++ -*--=//
|
//===-- llvm/Argument.h - Definition of the Argument class -------*- C++ -*--=//
|
||||||
//
|
//
|
||||||
// This file defines the Argument class, which represents and incoming formal
|
// This file defines the Argument class, which represents and incoming formal
|
||||||
// argument to a function.
|
// argument to a Function.
|
||||||
//
|
//
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
@ -10,20 +10,20 @@
|
|||||||
|
|
||||||
#include "llvm/Value.h"
|
#include "llvm/Value.h"
|
||||||
|
|
||||||
class Argument : public Value { // Defined in the InstrType.cpp file
|
class Argument : public Value { // Defined in the Function.cpp file
|
||||||
Function *Parent;
|
Function *Parent;
|
||||||
|
|
||||||
Argument *Prev, *Next; // Next and Prev links for our intrusive linked list
|
Argument *Prev, *Next; // Next and Prev links for our intrusive linked list
|
||||||
void setNext(Argument *N) { Next = N; }
|
void setNext(Argument *N) { Next = N; }
|
||||||
void setPrev(Argument *N) { Prev = N; }
|
void setPrev(Argument *N) { Prev = N; }
|
||||||
friend class SymbolTableListTraits<Argument, Function, Function>;
|
friend class SymbolTableListTraits<Argument, Function, Function>;
|
||||||
inline void setParent(Function *parent) { Parent = parent; }
|
void setParent(Function *parent);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Argument(const Type *Ty, const std::string &Name = "")
|
/// Argument ctor - If Function argument is specified, this argument is
|
||||||
: Value(Ty, Value::ArgumentVal, Name) {
|
/// inserted at the end of the argument list for the function.
|
||||||
Parent = 0;
|
///
|
||||||
}
|
Argument(const Type *Ty, const std::string &Name = "", Function *F = 0);
|
||||||
|
|
||||||
/// setName - Specialize setName to handle symbol table majik...
|
/// setName - Specialize setName to handle symbol table majik...
|
||||||
virtual void setName(const std::string &name, SymbolTable *ST = 0);
|
virtual void setName(const std::string &name, SymbolTable *ST = 0);
|
||||||
|
@ -44,7 +44,7 @@ private :
|
|||||||
InstListType InstList;
|
InstListType InstList;
|
||||||
BasicBlock *Prev, *Next; // Next and Prev links for our intrusive linked list
|
BasicBlock *Prev, *Next; // Next and Prev links for our intrusive linked list
|
||||||
|
|
||||||
void setParent(Function *parent) { InstList.setParent(parent); }
|
void setParent(Function *parent);
|
||||||
void setNext(BasicBlock *N) { Next = N; }
|
void setNext(BasicBlock *N) { Next = N; }
|
||||||
void setPrev(BasicBlock *N) { Prev = N; }
|
void setPrev(BasicBlock *N) { Prev = N; }
|
||||||
friend class SymbolTableListTraits<BasicBlock, Function, Function>;
|
friend class SymbolTableListTraits<BasicBlock, Function, Function>;
|
||||||
@ -53,20 +53,23 @@ private :
|
|||||||
void operator=(const BasicBlock &); // Do not implement
|
void operator=(const BasicBlock &); // Do not implement
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// Instruction iterators...
|
/// Instruction iterators...
|
||||||
typedef InstListType::iterator iterator;
|
typedef InstListType::iterator iterator;
|
||||||
typedef InstListType::const_iterator const_iterator;
|
typedef InstListType::const_iterator const_iterator;
|
||||||
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
|
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
|
||||||
typedef std::reverse_iterator<iterator> reverse_iterator;
|
typedef std::reverse_iterator<iterator> reverse_iterator;
|
||||||
|
|
||||||
// Ctor, dtor
|
/// BasicBlock ctor - If the function parameter is specified, the basic block
|
||||||
|
/// is automatically inserted at the end of the function.
|
||||||
|
///
|
||||||
BasicBlock(const std::string &Name = "", Function *Parent = 0);
|
BasicBlock(const std::string &Name = "", Function *Parent = 0);
|
||||||
~BasicBlock();
|
~BasicBlock();
|
||||||
|
|
||||||
// Specialize setName to take care of symbol table majik
|
// Specialize setName to take care of symbol table majik
|
||||||
virtual void setName(const std::string &name, SymbolTable *ST = 0);
|
virtual void setName(const std::string &name, SymbolTable *ST = 0);
|
||||||
|
|
||||||
// getParent - Return the enclosing method, or null if none
|
/// getParent - Return the enclosing method, or null if none
|
||||||
|
///
|
||||||
const Function *getParent() const { return InstList.getParent(); }
|
const Function *getParent() const { return InstList.getParent(); }
|
||||||
Function *getParent() { return InstList.getParent(); }
|
Function *getParent() { return InstList.getParent(); }
|
||||||
|
|
||||||
@ -94,8 +97,8 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
//===--------------------------------------------------------------------===//
|
//===--------------------------------------------------------------------===//
|
||||||
// Instruction iterator methods
|
/// Instruction iterator methods
|
||||||
//
|
///
|
||||||
inline iterator begin() { return InstList.begin(); }
|
inline iterator begin() { return InstList.begin(); }
|
||||||
inline const_iterator begin() const { return InstList.begin(); }
|
inline const_iterator begin() const { return InstList.begin(); }
|
||||||
inline iterator end () { return InstList.end(); }
|
inline iterator end () { return InstList.end(); }
|
||||||
|
@ -22,7 +22,7 @@ template<> struct ilist_traits<BasicBlock>
|
|||||||
: public SymbolTableListTraits<BasicBlock, Function, Function> {
|
: public SymbolTableListTraits<BasicBlock, Function, Function> {
|
||||||
|
|
||||||
// createNode is used to create a node that marks the end of the list...
|
// createNode is used to create a node that marks the end of the list...
|
||||||
static BasicBlock *createNode() { return new BasicBlock(); }
|
static BasicBlock *createNode();
|
||||||
|
|
||||||
static iplist<BasicBlock> &getList(Function *F);
|
static iplist<BasicBlock> &getList(Function *F);
|
||||||
};
|
};
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
//===-- llvm/GlobalValue.h - Class to represent a global value ---*- C++ -*--=//
|
//===-- llvm/GlobalValue.h - Class to represent a global value ---*- C++ -*--=//
|
||||||
//
|
//
|
||||||
// This file is a common base class of all globally definable objects. As such,
|
// This file is a common base class of all globally definable objects. As such,
|
||||||
// it is subclassed by GlobalVariable and by Method. This is used because you
|
// it is subclassed by GlobalVariable and by Function. This is used because you
|
||||||
// can do certain things with these global objects that you can't do to anything
|
// can do certain things with these global objects that you can't do to anything
|
||||||
// else. For example, use the address of one as a constant.
|
// else. For example, use the address of one as a constant.
|
||||||
//
|
//
|
||||||
|
@ -24,7 +24,7 @@ template<typename ValueSubClass, typename ItemParentClass, typename SymTabClass,
|
|||||||
class GlobalVariable : public GlobalValue {
|
class GlobalVariable : public GlobalValue {
|
||||||
friend class SymbolTableListTraits<GlobalVariable, Module, Module,
|
friend class SymbolTableListTraits<GlobalVariable, Module, Module,
|
||||||
ilist_traits<GlobalVariable> >;
|
ilist_traits<GlobalVariable> >;
|
||||||
void setParent(Module *parent) { Parent = parent; }
|
void setParent(Module *parent);
|
||||||
|
|
||||||
GlobalVariable *Prev, *Next;
|
GlobalVariable *Prev, *Next;
|
||||||
void setNext(GlobalVariable *N) { Next = N; }
|
void setNext(GlobalVariable *N) { Next = N; }
|
||||||
@ -32,9 +32,12 @@ class GlobalVariable : public GlobalValue {
|
|||||||
|
|
||||||
bool isConstantGlobal; // Is this a global constant?
|
bool isConstantGlobal; // Is this a global constant?
|
||||||
public:
|
public:
|
||||||
|
/// GlobalVariable ctor - If a parent module is specified, the global is
|
||||||
|
/// automatically inserted into the end of the specified modules global list.
|
||||||
|
///
|
||||||
GlobalVariable(const Type *Ty, bool isConstant, bool isInternal,
|
GlobalVariable(const Type *Ty, bool isConstant, bool isInternal,
|
||||||
Constant *Initializer = 0, const std::string &Name = "");
|
Constant *Initializer = 0, const std::string &Name = "",
|
||||||
~GlobalVariable() {}
|
Module *Parent = 0);
|
||||||
|
|
||||||
// Specialize setName to handle symbol table majik...
|
// Specialize setName to handle symbol table majik...
|
||||||
virtual void setName(const std::string &name, SymbolTable *ST = 0);
|
virtual void setName(const std::string &name, SymbolTable *ST = 0);
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
//===-- llvm/Instruction.h - Instruction class definition --------*- C++ -*--=//
|
//===-- llvm/Instruction.h - Instruction class definition --------*- C++ -*--=//
|
||||||
//
|
//
|
||||||
// This file contains the declaration of the Instruction class, which is the
|
// This file contains the declaration of the Instruction class, which is the
|
||||||
// base class for all of the VM instructions.
|
// base class for all of the LLVM instructions.
|
||||||
//
|
//
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
@ -22,9 +22,9 @@ class Instruction : public User {
|
|||||||
|
|
||||||
friend class SymbolTableListTraits<Instruction, BasicBlock, Function,
|
friend class SymbolTableListTraits<Instruction, BasicBlock, Function,
|
||||||
ilist_traits<Instruction> >;
|
ilist_traits<Instruction> >;
|
||||||
inline void setParent(BasicBlock *P) { Parent = P; }
|
void setParent(BasicBlock *P);
|
||||||
protected:
|
protected:
|
||||||
unsigned iType; // InstructionType
|
unsigned iType; // InstructionType: The opcode of the instruction
|
||||||
public:
|
public:
|
||||||
Instruction(const Type *Ty, unsigned iType, const std::string &Name = "");
|
Instruction(const Type *Ty, unsigned iType, const std::string &Name = "");
|
||||||
virtual ~Instruction() {
|
virtual ~Instruction() {
|
||||||
|
Loading…
Reference in New Issue
Block a user