aboutsummaryrefslogtreecommitdiffstats
path: root/include/llvm/Function.h
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2002-09-06 20:47:31 +0000
committerChris Lattner <sabre@nondot.org>2002-09-06 20:47:31 +0000
commita42414bcf6c04da34da107dd20c88f6f1965ad40 (patch)
tree44b18213ffdd46d2b3d8d3a9438a77ca251b6803 /include/llvm/Function.h
parent482701563a2ff76815d2cd19856469319e7c2d88 (diff)
downloadexternal_llvm-a42414bcf6c04da34da107dd20c88f6f1965ad40.zip
external_llvm-a42414bcf6c04da34da107dd20c88f6f1965ad40.tar.gz
external_llvm-a42414bcf6c04da34da107dd20c88f6f1965ad40.tar.bz2
* Clean up indentation a bit
* Fix broken comments (copy and pasto) * Remove irrelevant comment * Add extra argument to function that causes it to get inserted into a module automatically. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3601 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Function.h')
-rw-r--r--include/llvm/Function.h36
1 files changed, 21 insertions, 15 deletions
diff --git a/include/llvm/Function.h b/include/llvm/Function.h
index 81dcf82..5976745 100644
--- a/include/llvm/Function.h
+++ b/include/llvm/Function.h
@@ -1,11 +1,10 @@
-//===-- llvm/Function.h - Class to represent a single VM function -*- C++ -*-=//
+//===-- llvm/Function.h - Class to represent a single function --*- C++ -*-===//
//
// This file contains the declaration of the Function class, which represents a
-// single function/procedure in the VM.
+// single function/procedure in LLVM.
//
-// Note that BasicBlock's in the Function are Value's, because they are
-// referenced by instructions like calls and can go into virtual function tables
-// and stuff.
+// A function basically consists of a list of basic blocks, a list of arguments,
+// and a symbol table.
//
//===----------------------------------------------------------------------===//
@@ -55,7 +54,7 @@ public:
private:
// Important things that make up a function!
- BasicBlockListType BasicBlocks; // The basic blocks
+ BasicBlockListType BasicBlocks; // The basic blocks
ArgumentListType ArgumentList; // The formal arguments
SymbolTable *SymTab, *ParentSymTab;
@@ -68,7 +67,12 @@ private:
void setPrev(Function *N) { Prev = N; }
public:
- Function(const FunctionType *Ty, bool isInternal, const std::string &N = "");
+ /// Function ctor - If the (optional) Module argument is specified, the
+ /// function is automatically inserted into the end of the function list for
+ /// the module.
+ ///
+ Function(const FunctionType *Ty, bool isInternal, const std::string &N = "",
+ Module *M = 0);
~Function();
// Specialize setName to handle symbol table majik...
@@ -83,8 +87,10 @@ public:
///
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.
+ // getNext/Prev - Return the next or previous function in the list. These
+ // methods should never be used directly, and are only used to implement the
+ // function list as part of the module.
+ //
Function *getNext() { return Next; }
const Function *getNext() const { return Next; }
Function *getPrev() { return Prev; }
@@ -156,12 +162,12 @@ public:
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(); }
+ 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;