aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2002-04-27 06:56:12 +0000
committerChris Lattner <sabre@nondot.org>2002-04-27 06:56:12 +0000
commitf57b845547302d24ecb6a9e79d7bc386f761a6c9 (patch)
tree369bc5be013a3a6d0373dbf26820d701e01c5297
parentf2361c5e5c2917e6f19a55927b221d8671753a40 (diff)
* Rename MethodPass class to FunctionPass
- Rename runOnMethod to runOnFunction * Transform getAnalysisUsageInfo into getAnalysisUsage - Method is now const - It now takes one AnalysisUsage object to fill in instead of 3 vectors to fill in - Pass's now specify which other passes they _preserve_ not which ones they modify (be conservative!) - A pass can specify that it preserves all analyses (because it never modifies the underlying program) * s/Method/Function/g in other random places as well git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2333 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/llvm/Analysis/CallGraph.h9
-rw-r--r--include/llvm/Analysis/DataStructure.h9
-rw-r--r--include/llvm/Analysis/DataStructure/DataStructure.h9
-rw-r--r--include/llvm/Analysis/Dominators.h83
-rw-r--r--include/llvm/Analysis/FindUnsafePointerTypes.h17
-rw-r--r--include/llvm/Analysis/FindUsedTypes.h9
-rw-r--r--include/llvm/Analysis/IntervalPartition.h23
-rw-r--r--include/llvm/Analysis/LiveVar/FunctionLiveVarInfo.h25
-rw-r--r--include/llvm/Analysis/LoopInfo.h15
-rw-r--r--include/llvm/Assembly/PrintModulePass.h17
-rw-r--r--include/llvm/CodeGen/FunctionLiveVarInfo.h25
-rw-r--r--include/llvm/CodeGen/InstrScheduling.h4
-rw-r--r--include/llvm/CodeGen/RegisterAllocation.h3
-rw-r--r--include/llvm/Pass.h133
-rw-r--r--include/llvm/Transforms/FunctionInlining.h18
-rw-r--r--include/llvm/Transforms/Instrumentation/TraceValues.h4
-rw-r--r--include/llvm/Transforms/MutateStructTypes.h19
-rw-r--r--include/llvm/Transforms/Scalar/InductionVars.h12
-rw-r--r--include/llvm/Transforms/Utils/UnifyFunctionExitNodes.h25
-rw-r--r--lib/Analysis/IPA/FindUnsafePointerTypes.cpp8
-rw-r--r--lib/Analysis/IPA/FindUsedTypes.cpp8
-rw-r--r--lib/Analysis/IntervalPartition.cpp10
-rw-r--r--lib/Analysis/LiveVar/FunctionLiveVarInfo.cpp12
-rw-r--r--lib/Analysis/LoopInfo.cpp11
-rw-r--r--lib/Analysis/PostDominators.cpp17
-rw-r--r--lib/CodeGen/InstrSched/InstrScheduling.cpp19
-rw-r--r--lib/CodeGen/RegAlloc/PhyRegAlloc.cpp17
-rw-r--r--lib/Target/SparcV9/InstrSched/InstrScheduling.cpp19
-rw-r--r--lib/Target/SparcV9/LiveVar/FunctionLiveVarInfo.cpp12
-rw-r--r--lib/Target/SparcV9/RegAlloc/PhyRegAlloc.cpp17
-rw-r--r--lib/Target/SparcV9/SparcV9AsmPrinter.cpp14
-rw-r--r--lib/Target/SparcV9/SparcV9Internals.h34
-rw-r--r--lib/Target/SparcV9/SparcV9PrologEpilogInserter.cpp4
-rw-r--r--lib/Target/SparcV9/SparcV9TargetMachine.cpp14
-rw-r--r--lib/Transforms/HoistPHIConstants.cpp4
-rw-r--r--lib/Transforms/IPO/ConstantMerge.cpp10
-rw-r--r--lib/Transforms/IPO/DeadTypeElimination.cpp17
-rw-r--r--lib/Transforms/IPO/GlobalDCE.cpp11
-rw-r--r--lib/Transforms/IPO/InlineSimple.cpp20
-rw-r--r--lib/Transforms/IPO/MutateStructTypes.cpp26
-rw-r--r--lib/Transforms/IPO/OldPoolAllocate.cpp7
-rw-r--r--lib/Transforms/IPO/SimpleStructMutation.cpp14
-rw-r--r--lib/Transforms/Instrumentation/ProfilePaths/ProfilePaths.cpp12
-rw-r--r--lib/Transforms/Instrumentation/TraceValues.cpp6
-rw-r--r--lib/Transforms/LevelRaise.cpp8
-rw-r--r--lib/Transforms/Scalar/ADCE.cpp32
-rw-r--r--lib/Transforms/Scalar/ConstantProp.cpp4
-rw-r--r--lib/Transforms/Scalar/DCE.cpp16
-rw-r--r--lib/Transforms/Scalar/DecomposeMultiDimRefs.cpp14
-rw-r--r--lib/Transforms/Scalar/IndVarSimplify.cpp12
-rw-r--r--lib/Transforms/Scalar/InductionVars.cpp15
-rw-r--r--lib/Transforms/Scalar/InstructionCombining.cpp6
-rw-r--r--lib/Transforms/Scalar/SCCP.cpp20
-rw-r--r--lib/Transforms/Scalar/SymbolStripping.cpp4
-rw-r--r--lib/Transforms/Utils/PromoteMemoryToRegister.cpp14
-rw-r--r--lib/VMCore/Dominators.cpp17
-rw-r--r--lib/VMCore/Pass.cpp61
-rw-r--r--lib/VMCore/PassManagerT.h133
-rw-r--r--lib/VMCore/Verifier.cpp4
-rw-r--r--tools/analyze/analyze.cpp55
-rw-r--r--tools/llc/llc.cpp2
-rw-r--r--tools/opt/opt.cpp40
62 files changed, 609 insertions, 650 deletions
diff --git a/include/llvm/Analysis/CallGraph.h b/include/llvm/Analysis/CallGraph.h
index 3c8b2c4107..61693876c4 100644
--- a/include/llvm/Analysis/CallGraph.h
+++ b/include/llvm/Analysis/CallGraph.h
@@ -118,11 +118,10 @@ public:
// run - Compute the call graph for the specified module.
virtual bool run(Module *TheModule);
- // getAnalysisUsageInfo - This obviously provides a call graph
- virtual void getAnalysisUsageInfo(AnalysisSet &Required,
- AnalysisSet &Destroyed,
- AnalysisSet &Provided) {
- Provided.push_back(ID);
+ // getAnalysisUsage - This obviously provides a call graph
+ virtual void getAnalysisUsage(AnalysisUsage &AU) const {
+ AU.setPreservesAll();
+ AU.addProvided(ID);
}
// releaseMemory - Data structures can be large, so free memory agressively.
diff --git a/include/llvm/Analysis/DataStructure.h b/include/llvm/Analysis/DataStructure.h
index 2d21545aeb..90a4b5df23 100644
--- a/include/llvm/Analysis/DataStructure.h
+++ b/include/llvm/Analysis/DataStructure.h
@@ -485,11 +485,10 @@ public:
// If the pass pipeline is done with this pass, we can release our memory...
virtual void releaseMemory();
- // getAnalysisUsageInfo - This obviously provides a call graph
- virtual void getAnalysisUsageInfo(AnalysisSet &Required,
- AnalysisSet &Destroyed,
- AnalysisSet &Provided) {
- Provided.push_back(ID);
+ // getAnalysisUsage - This obviously provides a call graph
+ virtual void getAnalysisUsage(AnalysisUsage &AU) const {
+ AU.setPreservesAll();
+ AU.addProvided(ID);
}
};
diff --git a/include/llvm/Analysis/DataStructure/DataStructure.h b/include/llvm/Analysis/DataStructure/DataStructure.h
index 2d21545aeb..90a4b5df23 100644
--- a/include/llvm/Analysis/DataStructure/DataStructure.h
+++ b/include/llvm/Analysis/DataStructure/DataStructure.h
@@ -485,11 +485,10 @@ public:
// If the pass pipeline is done with this pass, we can release our memory...
virtual void releaseMemory();
- // getAnalysisUsageInfo - This obviously provides a call graph
- virtual void getAnalysisUsageInfo(AnalysisSet &Required,
- AnalysisSet &Destroyed,
- AnalysisSet &Provided) {
- Provided.push_back(ID);
+ // getAnalysisUsage - This obviously provides a call graph
+ virtual void getAnalysisUsage(AnalysisUsage &AU) const {
+ AU.setPreservesAll();
+ AU.addProvided(ID);
}
};
diff --git a/include/llvm/Analysis/Dominators.h b/include/llvm/Analysis/Dominators.h
index d860ec5504..1f35331b92 100644
--- a/include/llvm/Analysis/Dominators.h
+++ b/include/llvm/Analysis/Dominators.h
@@ -1,13 +1,13 @@
//===- llvm/Analysis/Dominators.h - Dominator Info Calculation ---*- C++ -*--=//
//
// This file defines the following classes:
-// 1. DominatorSet: Calculates the [reverse] dominator set for a method
+// 1. DominatorSet: Calculates the [reverse] dominator set for a function
// 2. ImmediateDominators: Calculates and holds a mapping between BasicBlocks
// and their immediate dominator.
// 3. DominatorTree: Represent the ImmediateDominator as an explicit tree
// structure.
// 4. DominanceFrontier: Calculate and hold the dominance frontier for a
-// method.
+// function.
//
// These data structures are listed in increasing order of complexity. It
// takes longer to calculate the dominator frontier, for example, than the
@@ -28,7 +28,7 @@ namespace cfg {
// DominatorBase - Base class that other, more interesting dominator analyses
// inherit from.
//
-class DominatorBase : public MethodPass {
+class DominatorBase : public FunctionPass {
protected:
BasicBlock *Root;
const bool IsPostDominators;
@@ -45,7 +45,7 @@ public:
//===----------------------------------------------------------------------===//
//
// DominatorSet - Maintain a set<const BasicBlock*> for every basic block in a
-// method, that represents the blocks that dominate the block.
+// function, that represents the blocks that dominate the block.
//
class DominatorSet : public DominatorBase {
public:
@@ -59,14 +59,14 @@ private:
void calcPostDominatorSet(Function *F);
public:
// DominatorSet ctor - Build either the dominator set or the post-dominator
- // set for a method...
+ // set for a function...
//
static AnalysisID ID; // Build dominator set
static AnalysisID PostDomID; // Build postdominator set
DominatorSet(AnalysisID id) : DominatorBase(id == PostDomID) {}
- virtual bool runOnMethod(Function *F);
+ virtual bool runOnFunction(Function *F);
// Accessor interface:
typedef DomSetMapType::const_iterator const_iterator;
@@ -83,7 +83,7 @@ public:
//
inline const DomSetType &getDominators(const BasicBlock *BB) const {
const_iterator I = find(BB);
- assert(I != end() && "BB not in method!");
+ assert(I != end() && "BB not in function!");
return I->second;
}
@@ -93,19 +93,17 @@ public:
return getDominators(B).count(A) != 0;
}
- // getAnalysisUsageInfo - This obviously provides a dominator set, but it also
- // uses the UnifyMethodExitNode pass if building post-dominators
+ // getAnalysisUsage - This obviously provides a dominator set, but it also
+ // uses the UnifyFunctionExitNode pass if building post-dominators
//
- virtual void getAnalysisUsageInfo(Pass::AnalysisSet &Requires,
- Pass::AnalysisSet &Destroyed,
- Pass::AnalysisSet &Provided);
+ virtual void getAnalysisUsage(AnalysisUsage &AU) const;
};
//===----------------------------------------------------------------------===//
//
// ImmediateDominators - Calculate the immediate dominator for each node in a
-// method.
+// function.
//
class ImmediateDominators : public DominatorBase {
std::map<const BasicBlock*, const BasicBlock*> IDoms;
@@ -113,14 +111,14 @@ class ImmediateDominators : public DominatorBase {
public:
// ImmediateDominators ctor - Calculate the idom or post-idom mapping,
- // for a method...
+ // for a function...
//
static AnalysisID ID; // Build immediate dominators
static AnalysisID PostDomID; // Build immediate postdominators
ImmediateDominators(AnalysisID id) : DominatorBase(id == PostDomID) {}
- virtual bool runOnMethod(Function *F) {
+ virtual bool runOnFunction(Function *F) {
IDoms.clear(); // Reset from the last time we were run...
DominatorSet *DS;
if (isPostDominator())
@@ -149,18 +147,17 @@ public:
return I != IDoms.end() ? I->second : 0;
}
- // getAnalysisUsageInfo - This obviously provides a dominator tree, but it
+ // getAnalysisUsage - This obviously provides a dominator tree, but it
// can only do so with the input of dominator sets
//
- virtual void getAnalysisUsageInfo(Pass::AnalysisSet &Requires,
- Pass::AnalysisSet &Destroyed,
- Pass::AnalysisSet &Provided) {
+ virtual void getAnalysisUsage(AnalysisUsage &AU) const {
+ AU.setPreservesAll();
if (isPostDominator()) {
- Requires.push_back(DominatorSet::PostDomID);
- Provided.push_back(PostDomID);
+ AU.addRequired(DominatorSet::PostDomID);
+ AU.addProvided(PostDomID);
} else {
- Requires.push_back(DominatorSet::ID);
- Provided.push_back(ID);
+ AU.addRequired(DominatorSet::ID);
+ AU.addProvided(ID);
}
}
};
@@ -168,7 +165,7 @@ public:
//===----------------------------------------------------------------------===//
//
-// DominatorTree - Calculate the immediate dominator tree for a method.
+// DominatorTree - Calculate the immediate dominator tree for a function.
//
class DominatorTree : public DominatorBase {
class Node2;
@@ -213,7 +210,7 @@ public:
DominatorTree(AnalysisID id) : DominatorBase(id == PostDomID) {}
~DominatorTree() { reset(); }
- virtual bool runOnMethod(Function *F) {
+ virtual bool runOnFunction(Function *F) {
reset();
DominatorSet *DS;
if (isPostDominator())
@@ -230,18 +227,17 @@ public:
return (i != Nodes.end()) ? i->second : 0;
}
- // getAnalysisUsageInfo - This obviously provides a dominator tree, but it
+ // getAnalysisUsage - This obviously provides a dominator tree, but it
// uses dominator sets
//
- virtual void getAnalysisUsageInfo(Pass::AnalysisSet &Requires,
- Pass::AnalysisSet &Destroyed,
- Pass::AnalysisSet &Provided) {
+ virtual void getAnalysisUsage(AnalysisUsage &AU) const {
+ AU.setPreservesAll();
if (isPostDominator()) {
- Requires.push_back(DominatorSet::PostDomID);
- Provided.push_back(PostDomID);
+ AU.addRequired(DominatorSet::PostDomID);
+ AU.addProvided(PostDomID);
} else {
- Requires.push_back(DominatorSet::ID);
- Provided.push_back(ID);
+ AU.addRequired(DominatorSet::ID);
+ AU.addProvided(ID);
}
}
};
@@ -249,7 +245,7 @@ public:
//===----------------------------------------------------------------------===//
//
-// DominanceFrontier - Calculate the dominance frontiers for a method.
+// DominanceFrontier - Calculate the dominance frontiers for a function.
//
class DominanceFrontier : public DominatorBase {
public:
@@ -263,14 +259,14 @@ private:
const DominatorTree::Node *Node);
public:
- // DominatorFrontier ctor - Compute dominator frontiers for a method
+ // DominatorFrontier ctor - Compute dominator frontiers for a function
//
static AnalysisID ID; // Build dominator frontier
static AnalysisID PostDomID; // Build postdominator frontier
DominanceFrontier(AnalysisID id) : DominatorBase(id == PostDomID) {}
- virtual bool runOnMethod(Function *) {
+ virtual bool runOnFunction(Function *) {
Frontiers.clear();
DominatorTree *DT;
if (isPostDominator())
@@ -292,18 +288,17 @@ public:
inline const_iterator end() const { return Frontiers.end(); }
inline const_iterator find(const BasicBlock* B) const { return Frontiers.find(B); }
- // getAnalysisUsageInfo - This obviously provides a dominator tree, but it
+ // getAnalysisUsage - This obviously provides the dominance frontier, but it
// uses dominator sets
//
- virtual void getAnalysisUsageInfo(Pass::AnalysisSet &Requires,
- Pass::AnalysisSet &Destroyed,
- Pass::AnalysisSet &Provided) {
+ virtual void getAnalysisUsage(AnalysisUsage &AU) const {
+ AU.setPreservesAll();
if (isPostDominator()) {
- Requires.push_back(DominatorTree::PostDomID);
- Provided.push_back(PostDomID);
+ AU.addRequired(DominatorTree::PostDomID);
+ AU.addProvided(PostDomID);
} else {
- Requires.push_back(DominatorTree::ID);
- Provided.push_back(ID);
+ AU.addRequired(DominatorTree::ID);
+ AU.addProvided(ID);
}
}
};
diff --git a/include/llvm/Analysis/FindUnsafePointerTypes.h b/include/llvm/Analysis/FindUnsafePointerTypes.h
index cd34676727..82cc28a06f 100644
--- a/include/llvm/Analysis/FindUnsafePointerTypes.h
+++ b/include/llvm/Analysis/FindUnsafePointerTypes.h
@@ -1,4 +1,4 @@
-//===- llvm/Analysis/SafePointerAccess.h - Check pointer safety ---*- C++ -*-=//
+//===- llvm/Analysis/FindUnsafePointerTypes.h - Unsafe pointers ---*- C++ -*-=//
//
// This file defines a pass that can be used to determine, interprocedurally,
// which pointer types are accessed unsafely in a program. If there is an
@@ -10,12 +10,12 @@
//
// Additionally, this analysis exports a hidden command line argument that (when
// enabled) prints out the reasons a type was determined to be unsafe. Just add
-// -unsafeptrinst to the command line of the tool you want to get it.
+// -printunsafeptrinst to the command line of the tool you want to get it.
//
//===----------------------------------------------------------------------===//
-#ifndef LLVM_ANALYSIS_SAFEPOINTERACCESS_H
-#define LLVM_ANALYSIS_SAFEPOINTERACCESS_H
+#ifndef LLVM_ANALYSIS_UNSAFEPOINTERTYPES_H
+#define LLVM_ANALYSIS_UNSAFEPOINTERTYPES_H
#include "llvm/Pass.h"
#include <set>
@@ -46,11 +46,12 @@ public:
//
void printResults(const Module *Mod, std::ostream &o) const;
- // getAnalysisUsageInfo - This function needs FindUsedTypes to do its job...
+ // getAnalysisUsage - Of course, we provide ourself...
//
- virtual void getAnalysisUsageInfo(Pass::AnalysisSet &Required,
- Pass::AnalysisSet &Destroyed,
- Pass::AnalysisSet &Provided);
+ virtual void getAnalysisUsage(AnalysisUsage &AU) const {
+ AU.setPreservesAll();
+ AU.addProvided(ID);
+ }
};
#endif
diff --git a/include/llvm/Analysis/FindUsedTypes.h b/include/llvm/Analysis/FindUsedTypes.h
index bbaf8dff6b..5c02b2cc5f 100644
--- a/include/llvm/Analysis/FindUsedTypes.h
+++ b/include/llvm/Analysis/FindUsedTypes.h
@@ -52,11 +52,12 @@ public:
//
bool run(Module *M);
- // getAnalysisUsageInfo - This function needs FindUsedTypes to do its job...
+ // getAnalysisUsage - Of course, we provide ourself...
//
- virtual void getAnalysisUsageInfo(Pass::AnalysisSet &Required,
- Pass::AnalysisSet &Destroyed,
- Pass::AnalysisSet &Provided);
+ virtual void getAnalysisUsage(AnalysisUsage &AU) const {
+ AU.setPreservesAll();
+ AU.addProvided(ID);
+ }
};
#endif
diff --git a/include/llvm/Analysis/IntervalPartition.h b/include/llvm/Analysis/IntervalPartition.h
index 10f53173bc..d31b5fd750 100644
--- a/include/llvm/Analysis/IntervalPartition.h
+++ b/include/llvm/Analysis/IntervalPartition.h
@@ -1,7 +1,7 @@
//===- IntervalPartition.h - Interval partition Calculation ------*- C++ -*--=//
//
// This file contains the declaration of the cfg::IntervalPartition class, which
-// calculates and represents the interval partition of a method, or a
+// calculates and represents the interval partition of a function, or a
// preexisting interval partition.
//
// In this way, the interval partition may be used to reduce a flow graph down
@@ -24,12 +24,12 @@ namespace cfg {
//===----------------------------------------------------------------------===//
//
// IntervalPartition - This class builds and holds an "interval partition" for
-// a method. This partition divides the control flow graph into a set of
+// a function. This partition divides the control flow graph into a set of
// maximal intervals, as defined with the properties above. Intuitively, a
// BasicBlock is a (possibly nonexistent) loop with a "tail" of non looping
// nodes following it.
//
-class IntervalPartition : public MethodPass, public std::vector<Interval*> {
+class IntervalPartition : public FunctionPass, public std::vector<Interval*> {
typedef std::map<BasicBlock*, Interval*> IntervalMapTy;
IntervalMapTy IntervalMap;
@@ -41,8 +41,8 @@ public:
IntervalPartition(AnalysisID AID) : RootInterval(0) { assert(AID == ID); }
- // run - Calculate the interval partition for this method
- virtual bool runOnMethod(Function *F);
+ // run - Calculate the interval partition for this function
+ virtual bool runOnFunction(Function *F);
// IntervalPartition ctor - Build a reduced interval partition from an
// existing interval graph. This takes an additional boolean parameter to
@@ -54,7 +54,7 @@ public:
~IntervalPartition() { destroy(); }
// getRootInterval() - Return the root interval that contains the starting
- // block of the method.
+ // block of the function.
inline Interval *getRootInterval() { return RootInterval; }
// isDegeneratePartition() - Returns true if the interval partition contains
@@ -69,15 +69,14 @@ public:
return I != IntervalMap.end() ? I->second : 0;
}
- // getAnalysisUsageInfo - Implement the Pass API
- virtual void getAnalysisUsageInfo(AnalysisSet &Required,
- AnalysisSet &Destroyed,
- AnalysisSet &Provided) {
- Provided.push_back(ID);
+ // getAnalysisUsage - Implement the Pass API
+ virtual void getAnalysisUsage(AnalysisUsage &AU) const {
+ AU.setPreservesAll();
+ AU.addProvided(ID);
}
private:
- // destroy - Reset state back to before method was analyzed
+ // destroy - Reset state back to before function was analyzed
void destroy();
// addIntervalToPartition - Add an interval to the internal list of intervals,
diff --git a/include/llvm/Analysis/LiveVar/FunctionLiveVarInfo.h b/include/llvm/Analysis/LiveVar/FunctionLiveVarInfo.h
index 435f177045..eabae4bddc 100644
--- a/include/llvm/Analysis/LiveVar/FunctionLiveVarInfo.h
+++ b/include/llvm/Analysis/LiveVar/FunctionLiveVarInfo.h
@@ -1,15 +1,15 @@
-/* Title: MethodLiveVarInfo.h -*- C++ -*-
+/* Title: FunctionLiveVarInfo.h -*- C++ -*-
Author: Ruchira Sasanka
Date: Jun 30, 01
Purpose:
- This is the interface for live variable info of a method that is required
+ This is the interface for live variable info of a function that is required
by any other part of the compiler
It must be called like:
- MethodLiveVarInfo MLVI(Function *); // initializes data structures
- MLVI.analyze(); // do the actural live variable anal
+ FunctionLiveVarInfo FLVI(Function *); // initializes data structures
+ FLVI.analyze(); // do the actural live variable anal
After the analysis, getInSetOfBB or getOutSetofBB can be called to get
live var info of a BB.
@@ -79,7 +79,7 @@ enum LiveVarDebugLevel_t {
extern cl::Enum<LiveVarDebugLevel_t> DEBUG_LV;
-class MethodLiveVarInfo : public MethodPass {
+class MethodLiveVarInfo : public FunctionPass {
// Machine Instr to LiveVarSet Map for providing LVset BEFORE each inst
std::map<const MachineInstr *, const ValueSet *> MInst2LVSetBI;