aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2002-06-25 16:12:52 +0000
committerChris Lattner <sabre@nondot.org>2002-06-25 16:12:52 +0000
commit18961504fc2b299578dba817900a0696cf3ccc4d (patch)
treec34853ffc064b841932d0897e25305c81c3a7338
parenta2204e1ff25265a1da00ecbb3ebb22c05acf7194 (diff)
*** empty log message ***
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2777 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/llvm/Analysis/LiveVar/FunctionLiveVarInfo.h2
-rw-r--r--include/llvm/Analysis/LiveVar/ValueSet.h5
-rw-r--r--include/llvm/Argument.h11
-rw-r--r--include/llvm/BasicBlock.h38
-rw-r--r--include/llvm/Bytecode/WriteBytecodePass.h4
-rw-r--r--include/llvm/CodeGen/FunctionLiveVarInfo.h2
-rw-r--r--include/llvm/CodeGen/ValueSet.h5
-rw-r--r--include/llvm/DerivedTypes.h4
-rw-r--r--include/llvm/Function.h113
-rw-r--r--include/llvm/GlobalVariable.h16
-rw-r--r--include/llvm/Instruction.h18
-rw-r--r--include/llvm/Module.h37
-rw-r--r--include/llvm/Pass.h18
-rw-r--r--include/llvm/PassManager.h2
-rw-r--r--include/llvm/SymbolTableListTraits.h68
-rw-r--r--include/llvm/Transforms/FunctionInlining.h2
-rw-r--r--include/llvm/Transforms/IPO/ConstantMerge.h5
-rw-r--r--include/llvm/Transforms/Utils/BasicBlockUtils.h8
-rw-r--r--include/llvm/Transforms/Utils/Local.h7
-rw-r--r--include/llvm/Transforms/Utils/UnifyFunctionExitNodes.h2
-rw-r--r--include/llvm/Type.h7
-rw-r--r--include/llvm/Value.h80
-rw-r--r--include/llvm/ValueHolder.h132
-rw-r--r--lib/Analysis/DataStructure/DataStructure.cpp19
-rw-r--r--lib/Analysis/DataStructure/FunctionRepBuilder.cpp104
-rw-r--r--lib/Analysis/DataStructure/FunctionRepBuilder.h32
-rw-r--r--lib/Analysis/DataStructure/NodeImpl.cpp11
-rw-r--r--lib/Analysis/LiveVar/BBLiveVar.cpp22
-rw-r--r--lib/Analysis/LiveVar/BBLiveVar.h10
-rw-r--r--lib/Analysis/LiveVar/FunctionLiveVarInfo.cpp16
-rw-r--r--lib/Analysis/LiveVar/ValueSet.cpp10
-rw-r--r--lib/Linker/LinkModules.cpp102
-rw-r--r--lib/Target/SparcV9/LiveVar/BBLiveVar.cpp22
-rw-r--r--lib/Target/SparcV9/LiveVar/BBLiveVar.h10
-rw-r--r--lib/Target/SparcV9/LiveVar/FunctionLiveVarInfo.cpp16
-rw-r--r--lib/Target/SparcV9/LiveVar/ValueSet.cpp10
-rw-r--r--lib/Transforms/Utils/BasicBlockUtils.cpp43
-rw-r--r--lib/Transforms/Utils/CloneFunction.cpp36
-rw-r--r--lib/Transforms/Utils/Linker.cpp102
-rw-r--r--lib/Transforms/Utils/Local.cpp12
-rw-r--r--lib/Transforms/Utils/SimplifyCFG.cpp55
-rw-r--r--lib/Transforms/Utils/UnifyFunctionExitNodes.cpp16
-rw-r--r--lib/VMCore/Linker.cpp102
43 files changed, 652 insertions, 684 deletions
diff --git a/include/llvm/Analysis/LiveVar/FunctionLiveVarInfo.h b/include/llvm/Analysis/LiveVar/FunctionLiveVarInfo.h
index 816dd860d0..ee21d4fdbe 100644
--- a/include/llvm/Analysis/LiveVar/FunctionLiveVarInfo.h
+++ b/include/llvm/Analysis/LiveVar/FunctionLiveVarInfo.h
@@ -98,7 +98,7 @@ public:
// --------- Implement the FunctionPass interface ----------------------
// runOnFunction - Perform analysis, update internal data structures.
- virtual bool runOnFunction(Function *F);
+ virtual bool runOnFunction(Function &F);
// releaseMemory - After LiveVariable analysis has been used, forget!
virtual void releaseMemory();
diff --git a/include/llvm/Analysis/LiveVar/ValueSet.h b/include/llvm/Analysis/LiveVar/ValueSet.h
index 0c0aefad20..88897bf3ad 100644
--- a/include/llvm/Analysis/LiveVar/ValueSet.h
+++ b/include/llvm/Analysis/LiveVar/ValueSet.h
@@ -7,8 +7,9 @@ class Value;
// RAV - Used to print values in a form used by the register allocator.
//
struct RAV { // Register Allocator Value
- const Value *V;
- RAV(const Value *v) : V(v) {}
+ const Value &V;
+ RAV(const Value *v) : V(*v) {}
+ RAV(const Value &v) : V(v) {}
};
std::ostream &operator<<(std::ostream &out, RAV Val);
diff --git a/include/llvm/Argument.h b/include/llvm/Argument.h
index cd05ca4d5b..6c2458d9d0 100644
--- a/include/llvm/Argument.h
+++ b/include/llvm/Argument.h
@@ -13,7 +13,10 @@
class Argument : public Value { // Defined in the InstrType.cpp file
Function *Parent;
- friend class ValueHolder<Argument, Function, Function>;
+ Argument *Prev, *Next; // Next and Prev links for our intrusive linked list
+ void setNext(Argument *N) { Next = N; }
+ void setPrev(Argument *N) { Prev = N; }
+ friend class SymbolTableListTraits<Argument, Function, Function>;
inline void setParent(Function *parent) { Parent = parent; }
public:
@@ -27,6 +30,12 @@ public:
inline const Function *getParent() const { return Parent; }
inline Function *getParent() { return Parent; }
+
+ // getNext/Prev - Return the next or previous argument in the list.
+ Argument *getNext() { return Next; }
+ const Argument *getNext() const { return Next; }
+ Argument *getPrev() { return Prev; }
+ const Argument *getPrev() const { return Prev; }
virtual void print(std::ostream &OS) const;
diff --git a/include/llvm/BasicBlock.h b/include/llvm/BasicBlock.h
index d8bb660479..8fc25d58d4 100644
--- a/include/llvm/BasicBlock.h
+++ b/include/llvm/BasicBlock.h
@@ -20,23 +20,37 @@
#ifndef LLVM_BASICBLOCK_H
#define LLVM_BASICBLOCK_H
-#include "llvm/ValueHolder.h"
-#include "llvm/Value.h"
+#include "llvm/Instruction.h"
+#include "llvm/SymbolTableListTraits.h"
+#include "Support/ilist"
class TerminatorInst;
class MachineCodeForBasicBlock;
template <class _Term, class _BB> class SuccIterator; // Successor Iterator
template <class _Ptr, class _USE_iterator> class PredIterator;
+template<> struct ilist_traits<Instruction>
+ : public SymbolTableListTraits<Instruction, BasicBlock, Function> {
+ // createNode is used to create a node that marks the end of the list...
+ static Instruction *createNode();
+ static iplist<Instruction> &getList(BasicBlock *BB);
+};
+
class BasicBlock : public Value { // Basic blocks are data objects also
public:
- typedef ValueHolder<Instruction, BasicBlock, Function> InstListType;
+ typedef iplist<Instruction> InstListType;
private :
InstListType InstList;
MachineCodeForBasicBlock* machineInstrVec;
+ BasicBlock *Prev, *Next; // Next and Prev links for our intrusive linked list
- friend class ValueHolder<BasicBlock,Function,Function>;
- void setParent(Function *parent);
+ void setParent(Function *parent) { InstList.setParent(parent); }
+ void setNext(BasicBlock *N) { Next = N; }
+ void setPrev(BasicBlock *N) { Prev = N; }
+ friend class SymbolTableListTraits<BasicBlock, Function, Function>;
+
+ BasicBlock(const BasicBlock &); // Do not implement
+ void operator=(const BasicBlock &); // Do not implement
public:
// Instruction iterators...
@@ -56,6 +70,12 @@ public:
const Function *getParent() const { return InstList.getParent(); }
Function *getParent() { return InstList.getParent(); }
+ // getNext/Prev - Return the next or previous basic block in the list.
+ BasicBlock *getNext() { return Next; }
+ const BasicBlock *getNext() const { return Next; }
+ BasicBlock *getPrev() { return Prev; }
+ const BasicBlock *getPrev() const { return Prev; }
+
// getTerminator() - If this is a well formed basic block, then this returns
// a pointer to the terminator instruction. If it is not, then you get a null
// pointer back.
@@ -93,10 +113,10 @@ public:
inline unsigned size() const { return InstList.size(); }
inline bool empty() const { return InstList.empty(); }
- inline const Instruction *front() const { return InstList.front(); }
- inline Instruction *front() { return InstList.front(); }
- inline const Instruction *back() const { return InstList.back(); }
- inline Instruction *back() { return InstList.back(); }
+ inline const Instruction &front() const { return InstList.front(); }
+ inline Instruction &front() { return InstList.front(); }
+ inline const Instruction &back() const { return InstList.back(); }
+ inline Instruction &back() { return InstList.back(); }
// getInstList() - Return the underlying instruction list container. You need
// to access it directly if you want to modify it currently.
diff --git a/include/llvm/Bytecode/WriteBytecodePass.h b/include/llvm/Bytecode/WriteBytecodePass.h
index 84e491a7d9..297fbb76e1 100644
--- a/include/llvm/Bytecode/WriteBytecodePass.h
+++ b/include/llvm/Bytecode/WriteBytecodePass.h
@@ -25,8 +25,8 @@ public:
if (DeleteStream) delete Out;
}
- bool run(Module *M) {
- WriteBytecodeToFile(M, *Out);
+ bool run(Module &M) {
+ WriteBytecodeToFile(&M, *Out);
return false;
}
};
diff --git a/include/llvm/CodeGen/FunctionLiveVarInfo.h b/include/llvm/CodeGen/FunctionLiveVarInfo.h
index 816dd860d0..ee21d4fdbe 100644
--- a/include/llvm/CodeGen/FunctionLiveVarInfo.h
+++ b/include/llvm/CodeGen/FunctionLiveVarInfo.h
@@ -98,7 +98,7 @@ public:
// --------- Implement the FunctionPass interface ----------------------
// runOnFunction - Perform analysis, update internal data structures.
- virtual bool runOnFunction(Function *F);
+ virtual bool runOnFunction(Function &F);
// releaseMemory - After LiveVariable analysis has been used, forget!
virtual void releaseMemory();
diff --git a/include/llvm/CodeGen/ValueSet.h b/include/llvm/CodeGen/ValueSet.h
index 0c0aefad20..88897bf3ad 100644
--- a/include/llvm/CodeGen/ValueSet.h
+++ b/include/llvm/CodeGen/ValueSet.h
@@ -7,8 +7,9 @@ class Value;
// RAV - Used to print values in a form used by the register allocator.
//
struct RAV { // Register Allocator Value
- const Value *V;
- RAV(const Value *v) : V(v) {}
+ const Value &V;
+ RAV(const Value *v) : V(*v) {}
+ RAV(const Value &v) : V(v) {}
};
std::ostream &operator<<(std::ostream &out, RAV Val);
diff --git a/include/llvm/DerivedTypes.h b/include/llvm/DerivedTypes.h
index 9e01ba37c9..9e6382328c 100644
--- a/include/llvm/DerivedTypes.h
+++ b/include/llvm/DerivedTypes.h
@@ -75,7 +75,7 @@ public:
return T->isDerivedType();
}
static inline bool classof(const Value *V) {
- return isa<Type>(V) && classof(cast<const Type>(V));
+ return isa<Type>(V) && classof(cast<Type>(V));
}
};
@@ -377,7 +377,7 @@ public:
return T->getPrimitiveID() == OpaqueTyID;
}
static inline bool classof(const Value *V) {
- return isa<Type>(V) && classof(cast<const Type>(V));
+ return isa<Type>(V) && classof(cast<Type>(V));
}
};
diff --git a/include/llvm/Function.h b/include/llvm/Function.h
index 5bba530ed0..66a372e711 100644
--- a/include/llvm/Function.h
+++ b/include/llvm/Function.h
@@ -13,31 +13,59 @@
#define LLVM_FUNCTION_H
#include "llvm/GlobalValue.h"
-#include "llvm/ValueHolder.h"
+#include "llvm/BasicBlock.h"
+#include "llvm/Argument.h"
class FunctionType;
+// Traits for intrusive list of instructions...
+template<> struct ilist_traits<BasicBlock>
+ : public SymbolTableListTraits<BasicBlock, Function, Function> {
+
+ // createNode is used to create a node that marks the end of the list...
+ static BasicBlock *createNode() { return new BasicBlock(); }
+
+ static iplist<BasicBlock> &getList(Function *F);
+};
+
+template<> struct ilist_traits<Argument>
+ : public SymbolTableListTraits<Argument, Function, Function> {
+
+ // createNode is used to create a node that marks the end of the list...
+ static Argument *createNode();
+ static iplist<Argument> &getList(Function *F);
+};
+
class Function : public GlobalValue {
public:
- typedef ValueHolder<Argument , Function, Function> ArgumentListType;
- typedef ValueHolder<BasicBlock, Function, Function> BasicBlocksType;
+ typedef iplist<Argument> ArgumentListType;
+ typedef iplist<BasicBlock> BasicBlockListType;
// BasicBlock iterators...
- typedef BasicBlocksType::iterator iterator;
- typedef BasicBlocksType::const_iterator const_iterator;
+ typedef BasicBlockListType::iterator iterator;
+ typedef BasicBlockListType::const_iterator const_iterator;
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
typedef std::reverse_iterator<iterator> reverse_iterator;
+ typedef ArgumentListType::iterator aiterator;
+ typedef ArgumentListType::const_iterator const_aiterator;
+ typedef std::reverse_iterator<const_aiterator> const_reverse_aiterator;
+ typedef std::reverse_iterator<aiterator> reverse_aiterator;
+
private:
// Important things that make up a function!
- BasicBlocksType BasicBlocks; // The basic blocks
+ BasicBlockListType BasicBlocks; // The basic blocks
ArgumentListType ArgumentList; // The formal arguments
SymbolTable *SymTab, *ParentSymTab;
- friend class ValueHolder<Function, Module, Module>;
+ friend class SymbolTableListTraits<Function, Module, Module>;
+
void setParent(Module *parent);
+ Function *Prev, *Next;
+ void setNext(Function *N) { Next = N; }
+ void setPrev(Function *N) { Prev = N; }
public:
Function(const FunctionType *Ty, bool isInternal, const std::string &N = "");
@@ -53,17 +81,24 @@ public:
// this is true for external functions, defined as forward "declare"ations
bool isExternal() const { return BasicBlocks.empty(); }
+ // getNext/Prev - Return the next or previous instruction in the list. The
+ // last node in the list is a terminator instruction.
+ Function *getNext() { return Next; }
+ const Function *getNext() const { return Next; }
+ Function *getPrev() { return Prev; }
+ const Function *getPrev() const { return Prev; }
+
// Get the underlying elements of the Function... both the argument list and
// basic block list are empty for external functions.
//
- inline const ArgumentListType &getArgumentList() const{ return ArgumentList; }
- inline ArgumentListType &getArgumentList() { return ArgumentList; }
+ const ArgumentListType &getArgumentList() const { return ArgumentList; }
+ ArgumentListType &getArgumentList() { return ArgumentList; }
- inline const BasicBlocksType &getBasicBlocks() const { return BasicBlocks; }
- inline BasicBlocksType &getBasicBlocks() { return BasicBlocks; }
+ const BasicBlockListType &getBasicBlockList() const { return BasicBlocks; }
+ BasicBlockListType &getBasicBlockList() { return BasicBlocks; }
- inline const BasicBlock *getEntryNode() const { return front(); }
- inline BasicBlock *getEntryNode() { return front(); }
+ const BasicBlock &getEntryNode() const { return front(); }
+ BasicBlock &getEntryNode() { return front(); }
//===--------------------------------------------------------------------===//
// Symbol Table Accessing functions...
@@ -89,22 +124,42 @@ public:
//===--------------------------------------------------------------------===//
// BasicBlock iterator forwarding functions
//
- inline iterator begin() { return BasicBlocks.begin(); }
- inline const_iterator begin() const { return BasicBlocks.begin(); }
- inline iterator end () { return BasicBlocks.end(); }
- inline const_iterator end () const { return BasicBlocks.end(); }
-
- inline reverse_iterator rbegin() { return BasicBlocks.rbegin(); }
- inline const_reverse_iterator rbegin() const { return BasicBlocks.rbegin(); }
- inline reverse_iterator rend () { return BasicBlocks.rend(); }
- inline const_reverse_iterator rend () const { return BasicBlocks.rend(); }
-
- inline unsigned size() const { return BasicBlocks.size(); }
- inline bool empty() const { return BasicBlocks.empty(); }
- inline const BasicBlock *front() const { return BasicBlocks.front(); }
- inline BasicBlock *front() { return BasicBlocks.front(); }
- inline const BasicBlock *back() const { return BasicBlocks.back(); }
- inline BasicBlock *back() { return BasicBlocks.back(); }
+ iterator begin() { return BasicBlocks.begin(); }
+ const_iterator begin() const { return BasicBlocks.begin(); }
+ iterator end () { return BasicBlocks.end(); }
+ const_iterator end () const { return BasicBlocks.end(); }
+
+ reverse_iterator rbegin() { return BasicBlocks.rbegin(); }
+ const_reverse_iterator rbegin() const { return BasicBlocks.rbegin(); }
+ reverse_iterator rend () { return BasicBlocks.rend(); }
+ const_reverse_iterator rend () const { return BasicBlocks.rend(); }
+
+ unsigned size() const { return BasicBlocks.size(); }
+ bool empty() const { return BasicBlocks.empty(); }
+ const BasicBlock &front() const { return BasicBlocks.front(); }
+ BasicBlock &front() { return BasicBlocks.front(); }
+ const BasicBlock &back() const { return BasicBlocks.back(); }
+ BasicBlock &back() { return BasicBlocks.back(); }
+
+ //===--------------------------------------------------------------------===//
+ // Argument iterator forwarding functions
+ //
+ aiterator abegin() { return ArgumentList.begin(); }
+ const_aiterator abegin() const { return ArgumentList.begin(); }
+ aiterator aend () { return ArgumentList.end(); }
+ const_aiterator aend () const { return ArgumentList.end(); }
+
+ reverse_aiterator arbegin() { return ArgumentList.rbegin(); }
+ const_reverse_aiterator arbegin() const { return ArgumentList.rbegin(); }
+ reverse_aiterator arend () { return ArgumentList.rend(); }
+ const_reverse_aiterator arend () const { return ArgumentList.rend(); }
+
+ unsigned asize() const { return ArgumentList.size(); }
+ bool aempty() const { return ArgumentList.empty(); }
+ const Argument &afront() const { return ArgumentList.front(); }
+ Argument &afront() { return ArgumentList.front(); }
+ const Argument &aback() const { return ArgumentList.back(); }
+ Argument &aback() { return ArgumentList.back(); }
virtual void print(std::ostream &OS) const;
diff --git a/include/llvm/GlobalVariable.h b/include/llvm/GlobalVariable.h
index 79507a5670..2e2dd2bb41 100644
--- a/include/llvm/GlobalVariable.h
+++ b/include/llvm/GlobalVariable.h
@@ -17,11 +17,19 @@
class Module;
class Constant;
class PointerType;
+template<typename SC> struct ilist_traits;
+template<typename ValueSubClass, typename ItemParentClass, typename SymTabClass,
+ typename SubClass> class SymbolTableListTraits;
class GlobalVariable : public GlobalValue {
- friend class ValueHolder<GlobalVariable, Module, Module>;
+ friend class SymbolTableListTraits<GlobalVariable, Module, Module,
+ ilist_traits<GlobalVariable> >;
void setParent(Module *parent) { Parent = parent; }
+ GlobalVariable *Prev, *Next;
+ void setNext(GlobalVariable *N) { Next = N; }
+ void setPrev(GlobalVariable *N) { Prev = N; }
+
bool isConstantGlobal; // Is this a global constant?
public:
GlobalVariable(const Type *Ty, bool isConstant, bool isInternal,
@@ -52,6 +60,12 @@ public:
}
}
+ // getNext/Prev - Return the next or previous instruction in the list. The
+ // last node in the list is a terminator instruction.
+ GlobalVariable *getNext() { return Next; }
+ const GlobalVariable *getNext() const { return Next; }
+ GlobalVariable *getPrev() { return Prev; }
+ const GlobalVariable *getPrev() const { return Prev; }
// If the value is a global constant, its value is immutable throughout the
// runtime execution of the program. Assigning a value into the constant
diff --git a/include/llvm/Instruction.h b/include/llvm/Instruction.h
index 9ab6f8a106..7cdee5d2c1 100644
--- a/include/llvm/Instruction.h
+++ b/include/llvm/Instruction.h
@@ -9,11 +9,19 @@
#define LLVM_INSTRUCTION_H
#include "llvm/User.h"
+template<typename SC> struct ilist_traits;
+template<typename ValueSubClass, typename ItemParentClass, typename SymTabClass,
+ typename SubClass> class SymbolTableListTraits;
class Instruction : public User {
BasicBlock *Parent;
+ Instruction *Prev, *Next; // Next and Prev links for our intrusive linked list
- friend class ValueHolder<Instruction,BasicBlock,Function>;
+ void setNext(Instruction *N) { Next = N; }
+ void setPrev(Instruction *N) { Prev = N; }
+
+ friend class SymbolTableListTraits<Instruction, BasicBlock, Function,
+ ilist_traits<Instruction> >;
inline void setParent(BasicBlock *P) { Parent = P; }
protected:
unsigned iType; // InstructionType
@@ -37,6 +45,14 @@ public:
//
inline const BasicBlock *getParent() const { return Parent; }
inline BasicBlock *getParent() { return Parent; }
+
+ // getNext/Prev - Return the next or previous instruction in the list. The
+ // last node in the list is a terminator instruction.
+ Instruction *getNext() { return Next; }
+ const Instruction *getNext() const { return Next; }
+ Instruction *getPrev() { return Prev; }
+ const Instruction *getPrev() const { return Prev; }
+
virtual bool hasSideEffects() const { return false; } // Memory & Call insts
// ---------------------------------------------------------------------------
diff --git a/include/llvm/Module.h b/include/llvm/Module.h
index 3f142cbe0b..8e527d0960 100644
--- a/include/llvm/Module.h
+++ b/include/llvm/Module.h
@@ -12,18 +12,31 @@
#ifndef LLVM_MODULE_H
#define LLVM_MODULE_H
-#include "llvm/Value.h"
-#include "llvm/ValueHolder.h"
+#include "llvm/Function.h"
+#include "llvm/GlobalVariable.h"
class GlobalVariable;
class GlobalValueRefMap; // Used by ConstantVals.cpp
class ConstantPointerRef;
class FunctionType;
class SymbolTable;
+template<> struct ilist_traits<Function>
+ : public SymbolTableListTraits<Function, Module, Module> {
+ // createNode is used to create a node that marks the end of the list...
+ static Function *createNode();
+ static iplist<Function> &getList(Module *M);
+};
+template<> struct ilist_traits<GlobalVariable>
+ : public SymbolTableListTraits<GlobalVariable, Module, Module> {
+ // createNode is used to create a node that marks the end of the list...
+ static GlobalVariable *createNode();
+ static iplist<GlobalVariable> &getList(Module *M);
+};
+
class Module : public Annotable {
public:
- typedef ValueHolder<GlobalVariable, Module, Module> GlobalListType;
- typedef ValueHolder<Function, Module, Module> FunctionListType;
+ typedef iplist<GlobalVariable> GlobalListType;
+ typedef iplist<Function> FunctionListType;
// Global Variable iterators...
typedef GlobalListType::iterator giterator;
@@ -119,10 +132,10 @@ public:
inline unsigned gsize() const { return GlobalList.size(); }
inline bool gempty() const { return GlobalList.empty(); }
- inline const GlobalVariable *gfront() const { return GlobalList.front(); }
- inline GlobalVariable *gfront() { return GlobalList.front(); }
- inline const GlobalVariable *gback() const { return GlobalList.back(); }
- inline GlobalVariable *gback() { return GlobalList.back(); }
+ inline const GlobalVariable &gfront() const { return GlobalList.front(); }
+ inline GlobalVariable &gfront() { return GlobalList.front(); }
+ inline const GlobalVariable &gback() const { return GlobalList.back(); }
+ inline GlobalVariable &gback() { return GlobalList.back(); }
@@ -138,10 +151,10 @@ public:
inline unsigned size() const { return FunctionList.size(); }
inline bool empty() const { return FunctionList.empty(); }
- inline const Function *front() const { return FunctionList.front(); }
- inline Function *front() { return FunctionList.front(); }
- inline const Function *back() const { return FunctionList.back(); }
- inline Function *back() { return FunctionList.back(); }
+ inline const Function &front() const { return FunctionList.front(); }
+ inline Function &front() { return FunctionList.front(); }
+ inline const Function &back() const { return FunctionList.back(); }
+ inline Function &back() { return FunctionList.back(); }
void print(std::ostream &OS) const;
diff --git a/include/llvm/Pass.h b/include/llvm/Pass.h
index f604921601..097fc34e61 100644
--- a/include/llvm/Pass.h
+++ b/include/llvm/Pass.h
@@ -50,7 +50,7 @@ public:
// run - Run this pass, returning true if a modification was made to the
// module argument. This should be implemented by all concrete subclasses.
//
- virtual bool run(Module *M) = 0;
+ virtual bool run(Module &M) = 0;
// getAnalysisUsage - This function should be overriden by passes that need
// analysis information to do their job. If a pass specifies that it uses a
@@ -122,26 +122,26 @@ struct FunctionPass : public Pass {
// doInitialization - Virtual method overridden by subclasses to do
// any neccesary per-module initialization.
//
- virtual bool doInitialization(Module *M) { return false; }
+ virtual bool doInitialization(Module &M) { return false; }
// runOnFunction - Virtual method overriden by subclasses to do the
// per-function processing of the pass.
//
- virtual bool runOnFunction(Function *F) = 0;
+ virtual bool runOnFunction(Function &F) = 0;
// doFinalization - Virtual method overriden by subclasses to do any post
// processing needed after all passes have run.
//
- virtual bool doFinalization(Module *M) { return false; }
+ virtual bool doFinalization(Module &M) { return false; }
// run - On a module, we run this pass by initializing, ronOnFunction'ing once
// for every function in the module, then by finalizing.
//
- virtual bool run(Module *M);
+ virtual bool run(Module &M);
// run - On a function, we simply initialize, run the function, then finalize.
//
- bool run(Function *F);
+ bool run(Function &F);
private:
friend class PassManagerT<Module>;
@@ -167,17 +167,17 @@ struct BasicBlockPass : public FunctionPass {
// runOnBasicBlock - Virtual method overriden by s