aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/llvm/Argument.h6
-rw-r--r--include/llvm/BasicBlock.h112
-rw-r--r--include/llvm/Constant.h40
-rw-r--r--include/llvm/Function.h50
-rw-r--r--include/llvm/InstrTypes.h60
-rw-r--r--include/llvm/Instruction.h18
-rw-r--r--include/llvm/Module.h66
-rw-r--r--include/llvm/Pass.h179
-rw-r--r--include/llvm/PassManager.h16
-rw-r--r--include/llvm/Type.h131
-rw-r--r--include/llvm/User.h6
-rw-r--r--include/llvm/Value.h43
12 files changed, 367 insertions, 360 deletions
diff --git a/include/llvm/Argument.h b/include/llvm/Argument.h
index 6c2458d9d0..7a9acdab1d 100644
--- a/include/llvm/Argument.h
+++ b/include/llvm/Argument.h
@@ -25,7 +25,7 @@ public:
Parent = 0;
}
- // 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);
inline const Function *getParent() const { return Parent; }
@@ -39,7 +39,9 @@ public:
virtual void print(std::ostream &OS) const;
- // Methods for support type inquiry through isa, cast, and dyn_cast:
+ /// classof - Methods for support type inquiry through isa, cast, and
+ /// dyn_cast:
+ ///
static inline bool classof(const Argument *) { return true; }
static inline bool classof(const Value *V) {
return V->getValueType() == ArgumentVal;
diff --git a/include/llvm/BasicBlock.h b/include/llvm/BasicBlock.h
index 2ea5e6ad55..bf0e19d802 100644
--- a/include/llvm/BasicBlock.h
+++ b/include/llvm/BasicBlock.h
@@ -1,20 +1,22 @@
//===-- llvm/BasicBlock.h - Represent a basic block in the VM ----*- C++ -*--=//
-//
-// This file contains the declaration of the BasicBlock class, which represents
-// a single basic block in the VM.
-//
-// Note that basic blocks themselves are Value's, because they are referenced
-// by instructions like branches and can go in switch tables and stuff...
-//
-//===----------------------------------------------------------------------===//
-//
-// Note that well formed basic blocks are formed of a list of instructions
-// followed by a single TerminatorInst instruction. TerminatorInst's may not
-// occur in the middle of basic blocks, and must terminate the blocks.
-//
-// This code allows malformed basic blocks to occur, because it may be useful
-// in the intermediate stage of analysis or modification of a program.
-//
+///
+/// \class BasicBlock
+///
+/// This file contains the declaration of the BasicBlock class, which represents
+/// a single basic block in the VM.
+///
+/// Note that basic blocks themselves are Value's, because they are referenced
+/// by instructions like branches and can go in switch tables and stuff...
+///
+///===---------------------------------------------------------------------===//
+///
+/// Note that well formed basic blocks are formed of a list of instructions
+/// followed by a single TerminatorInst instruction. TerminatorInst's may not
+/// occur in the middle of basic blocks, and must terminate the blocks.
+///
+/// This code allows malformed basic blocks to occur, because it may be useful
+/// in the intermediate stage modification to a program.
+///
//===----------------------------------------------------------------------===//
#ifndef LLVM_BASICBLOCK_H
@@ -74,10 +76,10 @@ public:
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.
- //
+ /// 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.
+ ///
TerminatorInst *getTerminator();
const TerminatorInst *const getTerminator() const;
@@ -111,57 +113,57 @@ public:
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.
- //
+ /// getInstList() - Return the underlying instruction list container. You
+ /// need to access it directly if you want to modify it currently.
+ ///
const InstListType &getInstList() const { return InstList; }
InstListType &getInstList() { return InstList; }
virtual void print(std::ostream &OS) const;
- // Methods for support type inquiry through isa, cast, and dyn_cast:
+ /// Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const BasicBlock *BB) { return true; }
static inline bool classof(const Value *V) {
return V->getValueType() == Value::BasicBlockVal;
}
- // hasConstantReferences() - This predicate is true if there is a
- // reference to this basic block in the constant pool for this method. For
- // example, if a block is reached through a switch table, that table resides
- // in the constant pool, and the basic block is reference from it.
- //
+ /// hasConstantReferences() - This predicate is true if there is a
+ /// reference to this basic block in the constant pool for this method. For
+ /// example, if a block is reached through a switch table, that table resides
+ /// in the constant pool, and the basic block is reference from it.
+ ///
bool hasConstantReferences() const;
- // dropAllReferences() - This function causes all the subinstructions to "let
- // go" of all references that they are maintaining. This allows one to
- // 'delete' a whole class at a time, even though there may be circular
- // references... first all references are dropped, and all use counts go to
- // zero. Then everything is delete'd for real. Note that no operations are
- // valid on an object that has "dropped all references", except operator
- // delete.
- //
+ /// dropAllReferences() - This function causes all the subinstructions to "let
+ /// go" of all references that they are maintaining. This allows one to
+ /// 'delete' a whole class at a time, even though there may be circular
+ /// references... first all references are dropped, and all use counts go to
+ /// zero. Then everything is delete'd for real. Note that no operations are
+ /// valid on an object that has "dropped all references", except operator
+ /// delete.
+ ///
void dropAllReferences();
- // removePredecessor - This method is used to notify a BasicBlock that the
- // specified Predecessor of the block is no longer able to reach it. This is
- // actually not used to update the Predecessor list, but is actually used to
- // update the PHI nodes that reside in the block. Note that this should be
- // called while the predecessor still refers to this block.
- //
+ /// removePredecessor - This method is used to notify a BasicBlock that the
+ /// specified Predecessor of the block is no longer able to reach it. This is
+ /// actually not used to update the Predecessor list, but is actually used to
+ /// update the PHI nodes that reside in the block. Note that this should be
+ /// called while the predecessor still refers to this block.
+ ///
void removePredecessor(BasicBlock *Pred);
- // splitBasicBlock - This splits a basic block into two at the specified
- // instruction. Note that all instructions BEFORE the specified iterator stay
- // as part of the original basic block, an unconditional branch is added to
- // the new BB, and the rest of the instructions in the BB are moved to the new
- // BB, including the old terminator. The newly formed BasicBlock is returned.
- // This function invalidates the specified iterator.
- //
- // Note that this only works on well formed basic blocks (must have a
- // terminator), and 'I' must not be the end of instruction list (which would
- // cause a degenerate basic block to be formed, having a terminator inside of
- // the basic block).
- //
+ /// splitBasicBlock - This splits a basic block into two at the specified
+ /// instruction. Note that all instructions BEFORE the specified iterator
+ /// stay as part of the original basic block, an unconditional branch is added
+ /// to the new BB, and the rest of the instructions in the BB are moved to the
+ /// new BB, including the old terminator. The newly formed BasicBlock is
+ /// returned. This function invalidates the specified iterator.
+ ///
+ /// Note that this only works on well formed basic blocks (must have a
+ /// terminator), and 'I' must not be the end of instruction list (which would
+ /// cause a degenerate basic block to be formed, having a terminator inside of
+ /// the basic block).
+ ///
BasicBlock *splitBasicBlock(iterator I);
};
diff --git a/include/llvm/Constant.h b/include/llvm/Constant.h
index af46dbe15c..708573874d 100644
--- a/include/llvm/Constant.h
+++ b/include/llvm/Constant.h
@@ -16,40 +16,40 @@ protected:
void destroyConstantImpl();
public:
- // 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);
- // Static constructor to get a '0' constant of arbitrary type...
+ /// Static constructor to get a '0' constant of arbitrary type...
static Constant *getNullValue(const Type *Ty);
- // isNullValue - Return true if this is the value that would be returned by
- // getNullValue.
+ /// isNullValue - Return true if this is the value that would be returned by
+ /// getNullValue.
virtual bool isNullValue() const = 0;
virtual void print(std::ostream &O) const;
- // isConstantExpr - Return true if this is a ConstantExpr
+ /// isConstantExpr - Return true if this is a ConstantExpr
virtual bool isConstantExpr() const { return false; }
- // destroyConstant - Called if some element of this constant is no longer
- // valid. At this point only other constants may be on the use_list for this
- // constant. Any constants on our Use list must also be destroy'd. The
- // implementation must be sure to remove the constant from the list of
- // available cached constants. Implementations should call
- // destroyConstantImpl as the last thing they do, to destroy all users and
- // delete this.
- //
- // Note that this call is only valid on non-primitive constants: You cannot
- // destroy an integer constant for example. This API is used to delete
- // constants that have ConstantPointerRef's embeded in them when the module is
- // deleted, and it is used by GlobalDCE to remove ConstantPointerRefs that are
- // unneeded, allowing globals to be DCE'd.
- //
+ /// destroyConstant - Called if some element of this constant is no longer
+ /// valid. At this point only other constants may be on the use_list for this
+ /// constant. Any constants on our Use list must also be destroy'd. The
+ /// implementation must be sure to remove the constant from the list of
+ /// available cached constants. Implementations should call
+ /// destroyConstantImpl as the last thing they do, to destroy all users and
+ /// delete this.
+ ///
+ /// Note that this call is only valid on non-primitive constants: You cannot
+ /// destroy an integer constant for example. This API is used to delete
+ /// constants that have ConstantPointerRef's embeded in them when the module
+ /// is deleted, and it is used by GlobalDCE to remove ConstantPointerRefs that
+ /// are unneeded, allowing globals to be DCE'd.
+ ///
virtual void destroyConstant() { assert(0 && "Not reached!"); }
- // Methods for support type inquiry through isa, cast, and dyn_cast:
+ /// Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const Constant *) { return true; }
static inline bool classof(const Value *V) {
return V->getValueType() == Value::ConstantVal;
diff --git a/include/llvm/Function.h b/include/llvm/Function.h
index 66a372e711..81dcf82512 100644
--- a/include/llvm/Function.h
+++ b/include/llvm/Function.h
@@ -77,8 +77,10 @@ public:
const Type *getReturnType() const; // Return the type of the ret val
const FunctionType *getFunctionType() const; // Return the FunctionType for me
- // Is the body of this function unknown? (the basic block list is empty if so)
- // this is true for external functions, defined as forward "declare"ations
+ /// isExternal - Is the body of this function unknown? (the basic block list
+ /// is empty if so) 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
@@ -88,9 +90,9 @@ public:
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.
- //
+ /// Get the underlying elements of the Function... both the argument list and
+ /// basic block list are empty for external functions.
+ ///
const ArgumentListType &getArgumentList() const { return ArgumentList; }
ArgumentListType &getArgumentList() { return ArgumentList; }
@@ -103,21 +105,21 @@ public:
//===--------------------------------------------------------------------===//
// Symbol Table Accessing functions...
- // hasSymbolTable() - Returns true if there is a symbol table allocated to
- // this object AND if there is at least one name in it!
- //
+ /// hasSymbolTable() - Returns true if there is a symbol table allocated to
+ /// this object AND if there is at least one name in it!
+ ///
bool hasSymbolTable() const;
- // CAUTION: The current symbol table may be null if there are no names (ie,
- // the symbol table is empty)
- //
+ /// getSymbolTable() - CAUTION: The current symbol table may be null if there
+ /// are no names (ie, the symbol table is empty)
+ ///
inline SymbolTable *getSymbolTable() { return SymTab; }
inline const SymbolTable *getSymbolTable() const { return SymTab; }
- // getSymbolTableSure is guaranteed to not return a null pointer, because if
- // the function does not already have a symtab, one is created. Use this if
- // you intend to put something into the symbol table for the function.
- //
+ /// getSymbolTableSure is guaranteed to not return a null pointer, because if
+ /// the function does not already have a symtab, one is created. Use this if
+ /// you intend to put something into the symbol table for the function.
+ ///
SymbolTable *getSymbolTableSure(); // Implemented in Value.cpp
@@ -163,20 +165,20 @@ public:
virtual void print(std::ostream &OS) const;
- // Methods for support type inquiry through isa, cast, and dyn_cast:
+ /// Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const Function *) { return true; }
static inline bool classof(const Value *V) {
return V->getValueType() == Value::FunctionVal;
}
- // dropAllReferences() - This function causes all the subinstructions to "let
- // go" of all references that they are maintaining. This allows one to
- // 'delete' a whole class at a time, even though there may be circular
- // references... first all references are dropped, and all use counts go to
- // zero. Then everything is delete'd for real. Note that no operations are
- // valid on an object that has "dropped all references", except operator
- // delete.
- //
+ /// dropAllReferences() - This function causes all the subinstructions to "let
+ /// go" of all references that they are maintaining. This allows one to
+ /// 'delete' a whole class at a time, even though there may be circular
+ /// references... first all references are dropped, and all use counts go to
+ /// zero. Then everything is delete'd for real. Note that no operations are
+ /// valid on an object that has "dropped all references", except operator
+ /// delete.
+ ///
void dropAllReferences();
};
diff --git a/include/llvm/InstrTypes.h b/include/llvm/InstrTypes.h
index ccce21a839..22039a9a01 100644
--- a/include/llvm/InstrTypes.h
+++ b/include/llvm/InstrTypes.h
@@ -15,9 +15,9 @@
// TerminatorInst Class
//===----------------------------------------------------------------------===//
-// TerminatorInst - Subclasses of this class are all able to terminate a basic
-// block. Thus, these are all the flow control type of operations.
-//
+/// TerminatorInst - Subclasses of this class are all able to terminate a basic
+/// block. Thus, these are all the flow control type of operations.
+///
class TerminatorInst : public Instruction {
protected:
TerminatorInst(Instruction::TermOps iType);
@@ -25,17 +25,17 @@ protected:
const std::string &Name = "");
public:
- // Terminators must implement the methods required by Instruction...
+ /// Terminators must implement the methods required by Instruction...
virtual Instruction *clone() const = 0;
- // Additionally, they must provide a method to get at the successors of this
- // terminator instruction. 'idx' may not be >= the number of successors
- // returned by getNumSuccessors()!
- //
+ /// Additionally, they must provide a method to get at the successors of this
+ /// terminator instruction. 'idx' may not be >= the number of successors
+ /// returned by getNumSuccessors()!
+ ///
virtual const BasicBlock *getSuccessor(unsigned idx) const = 0;
virtual unsigned getNumSuccessors() const = 0;
- // Set a successor at a given index
+ /// Set a successor at a given index
virtual void setSuccessor(unsigned idx, BasicBlock *B) = 0;
inline BasicBlock *getSuccessor(unsigned idx) {
@@ -71,29 +71,29 @@ protected:
public:
- // create() - Construct a binary instruction, given the opcode
- // and the two operands.
- //
+ /// create() - Construct a binary instruction, given the opcode
+ /// and the two operands.
+ ///
static BinaryOperator *create(BinaryOps Op, Value *S1, Value *S2,
const std::string &Name = "");
- // Helper functions to construct and inspect unary operations (NEG and NOT)
- // via binary operators SUB and XOR:
- //
- // createNeg, createNot - Create the NEG and NOT
- // instructions out of SUB and XOR instructions.
- //
- // isNeg, isNot - Check if the given Value is a NEG or NOT instruction.
- //
- // getNegArgument, getNotArgument - Helper functions to extract the
- // unary argument of a NEG or NOT operation implemented via Sub or Xor.
- //
+ /// Helper functions to construct and inspect unary operations (NEG and NOT)
+ /// via binary operators SUB and XOR:
+ ///
+ /// createNeg, createNot - Create the NEG and NOT
+ /// instructions out of SUB and XOR instructions.
+ ///
static BinaryOperator *createNeg(Value *Op, const std::string &Name = "");
static BinaryOperator *createNot(Value *Op, const std::string &Name = "");
+ /// isNeg, isNot - Check if the given Value is a NEG or NOT instruction.
+ ///
static bool isNeg(const Value *V);
static bool isNot(const Value *V);
+ /// getNegArgument, getNotArgument - Helper functions to extract the
+ /// unary argument of a NEG or NOT operation implemented via Sub or Xor.
+ ///
static const Value* getNegArgument(const BinaryOperator* Bop);
static Value* getNegArgument( BinaryOperator* Bop);
static const Value* getNotArgument(const BinaryOperator* Bop);
@@ -107,13 +107,13 @@ public:
return create(getOpcode(), Operands[0], Operands[1]);
}
- // swapOperands - Exchange the two operands to this instruction.
- // This instruction is safe to use on any binary instruction and
- // does not modify the semantics of the instruction. If the
- // instruction is order dependant (SetLT f.e.) the opcode is
- // changed. If the instruction cannot be reversed (ie, it's a Div),
- // then return true.
- //
+ /// swapOperands - Exchange the two operands to this instruction.
+ /// This instruction is safe to use on any binary instruction and
+ /// does not modify the semantics of the instruction. If the
+ /// instruction is order dependant (SetLT f.e.) the opcode is
+ /// changed. If the instruction cannot be reversed (ie, it's a Div),
+ /// then return true.
+ ///
bool swapOperands();
// Methods for support type inquiry through isa, cast, and dyn_cast:
diff --git a/include/llvm/Instruction.h b/include/llvm/Instruction.h
index d2804ab704..805371bd15 100644
--- a/include/llvm/Instruction.h
+++ b/include/llvm/Instruction.h
@@ -34,11 +34,11 @@ public:
// Specialize setName to handle symbol table majik...
virtual void setName(const std::string &name, SymbolTable *ST = 0);
- // clone() - Create a copy of 'this' instruction that is identical in all ways
- // except the following:
- // * The instruction has no parent
- // * The instruction has no name
- //
+ /// clone() - Create a copy of 'this' instruction that is identical in all
+ /// ways except the following:
+ /// * The instruction has no parent
+ /// * The instruction has no name
+ ///
virtual Instruction *clone() const = 0;
// Accessor methods...
@@ -56,9 +56,9 @@ public:
virtual bool hasSideEffects() const { return false; } // Memory & Call insts
// ---------------------------------------------------------------------------
- // Subclass classification... getOpcode() returns a member of
- // one of the enums that is coming soon (down below)...
- //
+ /// Subclass classification... getOpcode() returns a member of
+ /// one of the enums that is coming soon (down below)...
+ ///
unsigned getOpcode() const { return iType; }
virtual const char *getOpcodeName() const {
return getOpcodeName(getOpcode());
@@ -74,7 +74,7 @@ public:
virtual void print(std::ostream &OS) const;
- // Methods for support type inquiry through isa, cast, and dyn_cast:
+ /// Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const Instruction *I) { return true; }
static inline bool classof(const Value *V) {
return V->getValueType() == Value::InstructionVal;
diff --git a/include/llvm/Module.h b/include/llvm/Module.h
index 3496e71616..b34c06b9f5 100644
--- a/include/llvm/Module.h
+++ b/include/llvm/Module.h
@@ -69,28 +69,28 @@ public:
Module();
~Module();
- // getOrInsertFunction - Look up the specified function in the module symbol
- // table. If it does not exist, add a prototype for the function and return
- // it.
+ /// getOrInsertFunction - Look up the specified function in the module symbol
+ /// table. If it does not exist, add a prototype for the function and return
+ /// it.
Function *getOrInsertFunction(const std::string &Name, const FunctionType *T);
- // getFunction - Look up the specified function in the module symbol table.
- // If it does not exist, return null.
- //
+ /// getFunction - Look up the specified function in the module symbol table.
+ /// If it does not exist, return null.
+ ///
Function *getFunction(const std::string &Name, const FunctionType *Ty);
- // addTypeName - Insert an entry in the symbol table mapping Str to Type. If
- // there is already an entry for this name, true is returned and the symbol
- // table is not modified.
- //
+ /// addTypeName - Insert an entry in the symbol table mapping Str to Type. If
+ /// there is already an entry for this name, true is returned and the symbol
+ /// table is not modified.
+ ///
bool addTypeName(const std::string &Name, const Type *Ty);
- // getTypeName - If there is at least one entry in the symbol table for the
- // specified type, return it.
- //
+ /// getTypeName - If there is at least one entry in the symbol table for the
+ /// specified type, return it.
+ ///
std::string getTypeName(const Type *Ty);
- // Get the underlying elements of the Module...
+ /// Get the underlying elements of the Module...
inline const GlobalListType &getGlobalList() const { return GlobalList; }
inline GlobalListType &getGlobalList() { return GlobalList; }
inline const FunctionListType &getFunctionList() const { return FunctionList;}
@@ -100,21 +100,21 @@ public:
//===--------------------------------------------------------------------===//
// Symbol table support functions...
- // hasSymbolTable() - Returns true if there is a symbol table allocated to
- // this object AND if there is at least one name in it!
- //
+ /// hasSymbolTable() - Returns true if there is a symbol table allocated to
+ /// this object AND if there is at least one name in it!
+ ///
bool hasSymbolTable() const;
- // CAUTION: The current symbol table may be null if there are no names (ie,
- // the symbol table is empty)
- //
+ /// getSymbolTable() - CAUTION: The current symbol table may be null if there
+ /// are no names (ie, the symbol table is empty)
+ ///
inline SymbolTable *getSymbolTable() { return SymTab; }
inline const SymbolTable *getSymbolTable() const { return SymTab; }
-
- // getSymbolTableSure is guaranteed to not return a null pointer, because if
- // the method does not already have a symtab, one is created. Use this if
- // you intend to put something into the symbol table for the method.
- //
+
+ /// getSymbolTableSure is guaranteed to not return a null pointer, because if
+ /// the method does not already have a symtab, one is created. Use this if
+ /// you intend to put something into the symbol table for the method.
+ ///
SymbolTable *getSymbolTableSure();
@@ -160,14 +160,14 @@ public:
void print(std::ostream &OS) const;
void dump() const;
- // dropAllReferences() - This function causes all the subinstructions to "let
- // go" of all references that they are maintaining. This allows one to
- // 'delete' a whole class at a time, even though there may be circular
- // references... first all references are dropped, and all use counts go to
- // zero. Then everything is delete'd for real. Note that no operations are
- // valid on an object that has "dropped all references", except operator
- // delete.
- //
+ /// dropAllReferences() - This function causes all the subinstructions to "let
+ /// go" of all references that they are maintaining. This allows one to
+ /// 'delete' a whole class at a time, even though there may be circular
+ /// references... first all references are dropped, and all use counts go to
+ /// zero. Then everything is delete'd for real. Note that no operations are
+ /// valid on an object that has "dropped all references", except operator
+ /// delete.
+ ///
void dropAllReferences();
};
diff --git a/include/llvm/Pass.h b/include/llvm/Pass.h
index eaa8fda71c..e717b1971c 100644
--- a/include/llvm/Pass.h
+++ b/include/llvm/Pass.h
@@ -39,10 +39,10 @@ struct AnalysisResolver;
typedef const PassInfo* AnalysisID;
//===----------------------------------------------------------------------===//
-// Pass interface - Implemented by all 'passes'. Subclass this if you are an
-// interprocedural optimization or you do not fit into any of the more
-// constrained passes described below.
-//
+/// Pass interface - Implemented by all 'passes'. Subclass this if you are an
+/// interprocedural optimization or you do not fit into any of the more
+/// constrained passes described below.
+///
class Pass {
friend class AnalysisResolver;
AnalysisResolver *Resolver; // AnalysisResolver this pass is owned by...
@@ -53,56 +53,56 @@ public:
Pass() : Resolver(0), PassInfoCache(0) {}
virtual ~Pass() {} // Destructor is virtual so we can be subclassed
- // getPassName - Return a nice clean name for a pass. This usually
- // implemented in terms of the name that is registered by one of the
- // Registration templates, but can be overloaded directly, and if nothing else
- // is available, C++ RTTI will be consulted to get a SOMEWHAT intelligable
- // name for the pass.
- //
+ /// getPassName - Return a nice clean name for a pass. This usually
+ /// implemented in terms of the name that is registered by one of the
+ /// Registration templates, but can be overloaded directly, and if nothing
+ /// else is available, C++ RTTI will be consulted to get a SOMEWHAT
+ /// intelligable name for the pass.
+ ///
virtual const char *getPassName() const;
- // getPassInfo - Return the PassInfo data structure that corresponds to this
- // pass... If the pass has not been registered, this will return null.
- //
+ /// getPassInfo - Return the PassInfo data structure that corresponds to this
+ /// pass... If the pass has not been registered, this will return null.
+ ///
const PassInfo *getPassInfo() const;
- // run - Run this pass, returning true if a modification was made to the
- // module argument. This should be implemented by all concrete subclasses.
- //
+ /// 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;
- // print - Print out the internal state of the pass. This is called by
- // Analyze to print out the contents of an analysis. Otherwise it is not
- // neccesary to implement this method. Beware that the module pointer MAY be
- // null. This automatically forwards to a virtual function that does not
- // provide the Module* in case the analysis doesn't need it it can just be
- // ignored.
- //
+ /// print - Print out the internal state of the pass. This is called by
+ /// Analyze to print out the contents of an analysis. Otherwise it is not
+ /// neccesary to implement this method. Beware that the module pointer MAY be
+ /// null. This automatically forwards to a virtual function that does not
+ /// provide the Module* in case the analysis doesn't need it it can just be
+ /// ignored.
+ ///
virtual void print(std::ostream &O, const Module *M) const { print(O); }
virtual void print(std::ostream &O) const;
void dump() const; // dump - call print(std::cerr, 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
- // particular analysis result to this function, it can then use the
- // getAnalysis<AnalysisType>() function, below.
- //
+ /// getAnalysisUsage - This function should be overriden by passes that need
+ /// analysis information to do their job. If a pass specifies that it uses a
+ /// particular analysis result to this function, it can then use the
+ /// getAnalysis<AnalysisType>() function, below.
+ ///
virtual void getAnalysisUsage(AnalysisUsage &Info) const {
// By default, no analysis results are used, all are invalidated.
}
- // releaseMemory() - This member can be implemented by a pass if it wants to
- // be able to release its memory when it is no longer needed. The default
- // behavior of passes is to hold onto memory for the entire duration of their
- // lifetime (which is the entire compile time). For pipelined passes, this
- // is not a big deal because that memory gets recycled every time the pass is
- // invoked on another program unit. For IP passes, it is more important to
- // free memory when it is unused.
- //
- // Optionally implement this function to release pass memory when it is no
- // longer used.
- //
+ /// releaseMemory() - This member can be implemented by a pass if it wants to
+ /// be able to release its memory when it is no longer needed. The default
+ /// behavior of passes is to hold onto memory for the entire duration of their
+ /// lifetime (which is the entire compile time). For pipelined passes, this
+ /// is not a big deal because that memory gets recycled every time the pass is
+ /// invoked on another program unit. For IP passes, it is more important to
+ /// free memory when it is unused.
+ ///
+ /// Optionally implement this function to release pass memory when it is no
+ /// longer used.
+ ///
virtual void releaseMemory() {}
// dumpPassStructure - Implement the -debug-passes=PassStructure option
@@ -121,10 +121,10 @@ public:
protected:
- // getAnalysis<AnalysisType>() - This function is used by subclasses to get to
- // the analysis information that they claim to use by overriding the
- // getAnalysisUsage function.
- //
+ /// getAnalysis<AnalysisType>() - This function is used by subclasses to get
+ /// to the analysis information that they claim to use by overriding the
+ /// getAnalysisUsage function.
+ ///
template<typename AnalysisType>
AnalysisType &getAnalysis() {
assert(Resolver && "Pass has not been inserted into a PassManager object!");
@@ -149,12 +149,12 @@ protected:
return *(AnalysisType*)Resolver->getAnalysis(PI);
}
- // getAnalysisToUpdate<AnalysisType>() - This function is used by subclasses
- // to get to the analysis information that might be around that needs to be
- // updated. This is different than getAnalysis in that it can fail (ie the
- // analysis results haven't been computed), so should only be used if you
- // provide the capability to update an analysis that exists.
- //
+ /// getAnalysisToUpdate<AnalysisType>() - This function is used by subclasses
+ /// to get to the analysis information that might be around that needs to be
+ /// updated. This is different than getAnalysis in that it can fail (ie the
+ /// analysis results haven't been computed), so should only be used if you
+ /// provide the capability to update an analysis that exists.
+ ///
template<typename AnalysisType>
AnalysisType *getAnalysisToUpdate() {
assert(Resolver && "Pass not resident in a PassManager object!");
@@ -176,37 +176,38 @@ inline std::ostream &operator<<(std::ostream &OS, const Pass &P) {
}
//===----------------------------------------------------------------------===//
-// FunctionPass class - This class is used to implement most global
-// optimizations. Optimizations should subclass this class if they meet the
-// following constraints:
-//
-// 1. Optimizations are organized globally, ie a function at a time
-// 2. Optimizing a function does not cause the addition or removal of any
-// functions in the module
-//
+/// FunctionPass class - This class is used to implement most global
+/// optimizations. Optimizations should subclass this class if they meet the
+/// following constraints:
+///
+/// 1. Optimizations are organized globally, ie a function at a time
+/// 2. Optimizing a function does not cause the addition or removal of any
+/// functions in the module
+///
struct FunctionPass : public Pass {
- // doInitialization - Virtual method overridden by subclasses to do
- // any neccesary per-module initialization.
- //
+ /// doInitialization - Virtual method overridden by subclasses to do
+ /// any neccesary per-module initialization.
+ ///
virtual bool doInitialization(Module &M) { return false; }
- // runOnFunction - Virtual method overriden by subclasses to do the
- // per-function processing of the pass.
- //
+ /// runOnFunction - Virtual method overriden by subclasses to do the
+ /// per-function processing of the pass.
+ ///
virtual bool runOnFunction(Function &F) = 0;
- // doFinalization - Virtual method overriden by subclasses to do any post
- // processing needed after all passes have run.
- //
+ /// doFinalization - Virtual method overriden by subclasses to do any post
+ /// processing needed after all passes have run.
+ ///
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.
- //
+ /// run - On a module, we run this pass by initializing, ronOnFunction'ing
+ /// once for every function in the module, then by finalizing.
+ ///