* 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
This commit is contained in:
Chris Lattner
2002-04-27 06:56:12 +00:00
parent f2361c5e5c
commit f57b845547
62 changed files with 608 additions and 649 deletions

View File

@@ -1,19 +1,19 @@
//===-- MethodInlining.h - Functions that perform Inlining -------*- C++ -*--=//
//===-- FunctionInlining.h - Functions that perform Inlining -----*- C++ -*--=//
//
// This family of functions is useful for performing method inlining.
// This family of functions is useful for performing function inlining.
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_TRANSFORMS_METHOD_INLINING_H
#define LLVM_TRANSFORMS_METHOD_INLINING_H
#ifndef LLVM_TRANSFORMS_FUNCTION_INLINING_H
#define LLVM_TRANSFORMS_FUNCTION_INLINING_H
#include "llvm/BasicBlock.h"
class CallInst;
class Pass;
Pass *createMethodInliningPass();
Pass *createFunctionInliningPass();
// InlineMethod - This function forcibly inlines the called method into the
// InlineFunction - This function forcibly inlines the called function into the
// basic block of the caller. This returns true if it is not possible to inline
// this call. The program is still in a well defined state if this occurs
// though.
@@ -21,9 +21,9 @@ Pass *createMethodInliningPass();
// Note that this only does one level of inlining. For example, if the
// instruction 'call B' is inlined, and 'B' calls 'C', then the call to 'C' now
// exists in the instruction stream. Similiarly this will inline a recursive
// method by one level.
// function by one level.
//
bool InlineMethod(CallInst *C);
bool InlineMethod(BasicBlock::iterator CI); // *CI must be CallInst
bool InlineFunction(CallInst *C);
bool InlineFunction(BasicBlock::iterator CI); // *CI must be CallInst
#endif

View File

@@ -1,6 +1,6 @@
//===- llvm/Transforms/Instrumentation/TraceValues.h - Tracing ---*- C++ -*--=//
//
// Support for inserting LLVM code to print values at basic block and method
// Support for inserting LLVM code to print values at basic block and function
// exits.
//
//===----------------------------------------------------------------------===//
@@ -9,7 +9,7 @@
#define LLVM_TRANSFORMS_INSTRUMENTATION_TRACEVALUES_H
class Pass;
Pass *createTraceValuesPassForMethod(); // Just trace methods
Pass *createTraceValuesPassForFunction(); // Just trace function entry/exit
Pass *createTraceValuesPassForBasicBlocks(); // Trace BB's and methods
#endif

View File

@@ -41,7 +41,7 @@ class MutateStructTypes : public Pass {
// Mapping from global value of old type, to a global value of the new type...
std::map<const GlobalValue*, GlobalValue*> GlobalMap;
// Mapping from intra method value to intra method value
// Mapping from intra function value to intra function value
std::map<const Value*, Value*> LocalValueMap;
public:
@@ -60,13 +60,6 @@ public:
// run - do the transformation
virtual bool run(Module *M);
// getAnalysisUsageInfo - This function needs the results of the
// FindUsedTypes and FindUnsafePointerTypes analysis passes...
//
virtual void getAnalysisUsageInfo(Pass::AnalysisSet &Required,
Pass::AnalysisSet &Destroyed,
Pass::AnalysisSet &Provided);
protected:
// Alternatively, it is valid to subclass this class and provide transforms
@@ -80,17 +73,17 @@ private:
// processGlobals - This loops over global constants defined in the
// module, converting them to their new type. Also this creates placeholder
// methods for methods than need to be copied because they have a new
// functions for functions than need to be copied because they have a new
// signature type.
//
void processGlobals(Module *M);
// transformMethod - This transforms the instructions of the method to use the
// new types.
// transformFunction - This transforms the instructions of the function to use
// the new types.
//
void transformMethod(Function *F);
void transformFunction(Function *F);
// removeDeadGlobals - This removes the old versions of methods that are no
// removeDeadGlobals - This removes the old versions of functions that are no
// longer needed.
//
void removeDeadGlobals(Module *M);

View File

@@ -11,17 +11,15 @@
#include "llvm/Pass.h"
namespace cfg { class IntervalPartition; }
struct InductionVariableCannonicalize : public MethodPass {
struct InductionVariableCannonicalize : public FunctionPass {
// doInductionVariableCannonicalize - Simplify induction variables in loops
//
static bool doIt(Function *M, cfg::IntervalPartition &IP);
static bool doIt(Function *F, cfg::IntervalPartition &IP);
virtual bool runOnMethod(Function *M);
virtual bool runOnFunction(Function *F);
// getAnalysisUsageInfo - Declare that we need IntervalPartitions
void getAnalysisUsageInfo(Pass::AnalysisSet &Required,
Pass::AnalysisSet &Destroyed,
Pass::AnalysisSet &Provided);
// getAnalysisUsage - Declare that we need IntervalPartitions
void getAnalysisUsage(AnalysisUsage &AU) const;
};
#endif

View File

@@ -1,17 +1,17 @@
//===-- UnifyMethodExitNodes.h - Ensure methods have one return --*- C++ -*--=//
//===-- UnifyFunctionExitNodes.h - Ensure fn's have one return ---*- C++ -*--=//
//
// This pass is used to ensure that methods have at most one return instruction
// in them. It also holds onto the return instruction of the last unified
// method.
// This pass is used to ensure that functions have at most one return
// instruction in them. It also holds onto the return instruction of the last
// unified function.
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_XFORMS_UNIFY_METHOD_EXIT_NODES_H
#define LLVM_XFORMS_UNIFY_METHOD_EXIT_NODES_H
#ifndef LLVM_XFORMS_UNIFY_FUNCTION_EXIT_NODES_H
#define LLVM_XFORMS_UNIFY_FUNCTION_EXIT_NODES_H
#include "llvm/Pass.h"
struct UnifyMethodExitNodes : public MethodPass {
struct UnifyMethodExitNodes : public FunctionPass {
BasicBlock *ExitNode;
public:
static AnalysisID ID; // Pass ID
@@ -21,22 +21,19 @@ public:
// BasicBlock, and converting all returns to unconditional branches to this
// new basic block. The singular exit node is returned in ExitNode.
//
// If there are no return stmts in the Method, a null pointer is returned.
// If there are no return stmts in the function, a null pointer is returned.
//
static bool doit(Function *F, BasicBlock *&ExitNode);
virtual bool runOnMethod(Function *F) {
virtual bool runOnFunction(Function *F) {
return doit(F, ExitNode);
}
BasicBlock *getExitNode() const { return ExitNode; }
virtual void getAnalysisUsageInfo(Pass::AnalysisSet &Required,
Pass::AnalysisSet &Destroyed,
Pass::AnalysisSet &Provided) {
// FIXME: Should invalidate CFG
Provided.push_back(ID); // Provide self!
virtual void getAnalysisUsage(AnalysisUsage &AU) const {
AU.addProvided(ID); // Provide self!
}
};