summaryrefslogtreecommitdiff
path: root/lib/Transforms
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2002-04-27 07:27:19 +0000
committerChris Lattner <sabre@nondot.org>2002-04-27 07:27:19 +0000
commit483e14ee0412a98db1fb0121528d8d621ae3dfdb (patch)
treeac49b8e451a1a70cfebad3a753f5999ac06f4d06 /lib/Transforms
parent3b743f9fb3dc95aabc54d17cafe1b393b76b943c (diff)
downloadllvm-483e14ee0412a98db1fb0121528d8d621ae3dfdb.tar.gz
llvm-483e14ee0412a98db1fb0121528d8d621ae3dfdb.tar.bz2
llvm-483e14ee0412a98db1fb0121528d8d621ae3dfdb.tar.xz
s/Method/Function
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2336 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms')
-rw-r--r--lib/Transforms/IPO/InlineSimple.cpp2
-rw-r--r--lib/Transforms/Instrumentation/ProfilePaths/ProfilePaths.cpp73
-rw-r--r--lib/Transforms/Utils/CloneFunction.cpp2
-rw-r--r--lib/Transforms/Utils/UnifyFunctionExitNodes.cpp6
4 files changed, 41 insertions, 42 deletions
diff --git a/lib/Transforms/IPO/InlineSimple.cpp b/lib/Transforms/IPO/InlineSimple.cpp
index fcb1e4fa40..1581323bea 100644
--- a/lib/Transforms/IPO/InlineSimple.cpp
+++ b/lib/Transforms/IPO/InlineSimple.cpp
@@ -18,7 +18,7 @@
//
//===----------------------------------------------------------------------===//
-#include "llvm/Transforms/MethodInlining.h"
+#include "llvm/Transforms/FunctionInlining.h"
#include "llvm/Module.h"
#include "llvm/Function.h"
#include "llvm/Pass.h"
diff --git a/lib/Transforms/Instrumentation/ProfilePaths/ProfilePaths.cpp b/lib/Transforms/Instrumentation/ProfilePaths/ProfilePaths.cpp
index 860119e206..b967db64c6 100644
--- a/lib/Transforms/Instrumentation/ProfilePaths/ProfilePaths.cpp
+++ b/lib/Transforms/Instrumentation/ProfilePaths/ProfilePaths.cpp
@@ -25,7 +25,7 @@
//===----------------------------------------------------------------------===//
#include "llvm/Transforms/Instrumentation/ProfilePaths.h"
-#include "llvm/Transforms/UnifyMethodExitNodes.h"
+#include "llvm/Transforms/UnifyFunctionExitNodes.h"
#include "llvm/Support/CFG.h"
#include "llvm/Function.h"
#include "llvm/BasicBlock.h"
@@ -45,7 +45,7 @@ class ProfilePaths: public FunctionPass {
// entry and only one exit node for the function in the CFG of the function
//
void ProfilePaths::getAnalysisUsage(AnalysisUsage &AU) const {
- AU.addRequired(UnifyMethodExitNodes::ID);
+ AU.addRequired(UnifyFunctionExitNodes::ID);
}
};
@@ -67,20 +67,19 @@ static Node *findBB(std::set<Node *> &st, BasicBlock *BB){
//Per function pass for inserting counters and trigger code
bool ProfilePaths::runOnFunction(Function *M){
- //Transform the cfg s.t. we have just one exit node
- BasicBlock *ExitNode =
- getAnalysis<UnifyMethodExitNodes>().getExitNode();
+ // Transform the cfg s.t. we have just one exit node
+ BasicBlock *ExitNode = getAnalysis<UnifyFunctionExitNodes>().getExitNode();
- //iterating over BBs and making graph
+ // iterating over BBs and making graph
std::set<Node *> nodes;
std::set<Edge> edges;
Node *tmp;
Node *exitNode, *startNode;
- //The nodes must be uniquesly identified:
- //That is, no two nodes must hav same BB*
+ // The nodes must be uniquesly identified:
+ // That is, no two nodes must hav same BB*
- //First enter just nodes: later enter edges
+ // First enter just nodes: later enter edges
for (Function::iterator BB = M->begin(), BE=M->end(); BB != BE; ++BB){
Node *nd=new Node(*BB);
nodes.insert(nd);
@@ -90,7 +89,7 @@ bool ProfilePaths::runOnFunction(Function *M){
startNode=nd;
}
- //now do it againto insert edges
+ // now do it againto insert edges
for (Function::iterator BB = M->begin(), BE=M->end(); BB != BE; ++BB){
Node *nd=findBB(nodes, *BB);
assert(nd && "No node for this edge!");
@@ -111,39 +110,39 @@ bool ProfilePaths::runOnFunction(Function *M){
BasicBlock *fr=M->front();
- //If only one BB, don't instrument
+ // If only one BB, don't instrument
if (M->getBasicBlocks().size() == 1) {
- //The graph is made acyclic: this is done
- //by removing back edges for now, and adding them later on
+ // The graph is made acyclic: this is done
+ // by removing back edges for now, and adding them later on
vector<Edge> be;
g.getBackEdges(be);
#ifdef DEBUG_PATH_PROFILES
cerr<<"Backedges:"<<be.size()<<endl;
#endif
- //Now we need to reflect the effect of back edges
- //This is done by adding dummy edges
- //If a->b is a back edge
- //Then we add 2 back edges for it:
- //1. from root->b (in vector stDummy)
- //and 2. from a->exit (in vector exDummy)
+ // Now we need to reflect the effect of back edges
+ // This is done by adding dummy edges
+ // If a->b is a back edge
+ // Then we add 2 back edges for it:
+ // 1. from root->b (in vector stDummy)
+ // and 2. from a->exit (in vector exDummy)
vector<Edge> stDummy;
vector<Edge> exDummy;
addDummyEdges(stDummy, exDummy, g, be);
- //Now, every edge in the graph is assigned a weight
- //This weight later adds on to assign path
- //numbers to different paths in the graph
- // All paths for now are acyclic,
- //since no back edges in the graph now
- //numPaths is the number of acyclic paths in the graph
+ // Now, every edge in the graph is assigned a weight
+ // This weight later adds on to assign path
+ // numbers to different paths in the graph
+ // All paths for now are acyclic,
+ // since no back edges in the graph now
+ // numPaths is the number of acyclic paths in the graph
int numPaths=valueAssignmentToEdges(g);
- //create instruction allocation r and count
- //r is the variable that'll act like an accumulator
- //all along the path, we just add edge values to r
- //and at the end, r reflects the path number
- //count is an array: count[x] would store
- //the number of executions of path numbered x
+ // create instruction allocation r and count
+ // r is the variable that'll act like an accumulator
+ // all along the path, we just add edge values to r
+ // and at the end, r reflects the path number
+ // count is an array: count[x] would store
+ // the number of executions of path numbered x
Instruction *rVar=new
AllocaInst(PointerType::get(Type::IntTy),
ConstantUInt::get(Type::UIntTy,1),"R");
@@ -152,14 +151,14 @@ bool ProfilePaths::runOnFunction(Function *M){
AllocaInst(PointerType::get(Type::IntTy),
ConstantUInt::get(Type::UIntTy, numPaths), "Count");
- //insert initialization code in first (entry) BB
- //this includes initializing r and count
+ // insert initialization code in first (entry) BB
+ // this includes initializing r and count
insertInTopBB(M->getEntryNode(),numPaths, rVar, countVar);
- //now process the graph: get path numbers,
- //get increments along different paths,
- //and assign "increments" and "updates" (to r and count)
- //"optimally". Finally, insert llvm code along various edges
+ // now process the graph: get path numbers,
+ // get increments along different paths,
+ // and assign "increments" and "updates" (to r and count)
+ // "optimally". Finally, insert llvm code along various edges
processGraph(g, rVar, countVar, be, stDummy, exDummy);
}
diff --git a/lib/Transforms/Utils/CloneFunction.cpp b/lib/Transforms/Utils/CloneFunction.cpp
index aa627979fb..808ea48e67 100644
--- a/lib/Transforms/Utils/CloneFunction.cpp
+++ b/lib/Transforms/Utils/CloneFunction.cpp
@@ -7,7 +7,7 @@
#include "llvm/Instruction.h"
#include <map>
-// FIXME: This should be merged with MethodInlining
+// FIXME: This should be merged with FunctionInlining
// RemapInstruction - Convert the instruction operands from referencing the
// current values into those specified by ValueMap.
diff --git a/lib/Transforms/Utils/UnifyFunctionExitNodes.cpp b/lib/Transforms/Utils/UnifyFunctionExitNodes.cpp
index 9a3b52c49c..0fa87f8e8d 100644
--- a/lib/Transforms/Utils/UnifyFunctionExitNodes.cpp
+++ b/lib/Transforms/Utils/UnifyFunctionExitNodes.cpp
@@ -5,7 +5,7 @@
//
//===----------------------------------------------------------------------===//
-#include "llvm/Transforms/UnifyMethodExitNodes.h"
+#include "llvm/Transforms/UnifyFunctionExitNodes.h"
#include "llvm/BasicBlock.h"
#include "llvm/Function.h"
#include "llvm/iTerminators.h"
@@ -13,7 +13,7 @@
#include "llvm/Type.h"
using std::vector;
-AnalysisID UnifyMethodExitNodes::ID(AnalysisID::create<UnifyMethodExitNodes>());
+AnalysisID UnifyFunctionExitNodes::ID(AnalysisID::create<UnifyFunctionExitNodes>());
// UnifyAllExitNodes - Unify all exit nodes of the CFG by creating a new
@@ -22,7 +22,7 @@ AnalysisID UnifyMethodExitNodes::ID(AnalysisID::create<UnifyMethodExitNodes>());
//
// If there are no return stmts in the Function, a null pointer is returned.
//
-bool UnifyMethodExitNodes::doit(Function *M, BasicBlock *&ExitNode) {
+bool UnifyFunctionExitNodes::doit(Function *M, BasicBlock *&ExitNode) {
// Loop over all of the blocks in a function, tracking all of the blocks that
// return.
//