Change over to use new style pass mechanism, now passes only expose small

creation functions in their public header file, unless they can help it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1816 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner
2002-02-26 21:46:54 +00:00
parent 3b2541424f
commit bd0ef77cde
32 changed files with 528 additions and 512 deletions

View File

@ -17,44 +17,8 @@
#ifndef LLVM_TRANSFORMS_CONSTANTMERGE_H
#define LLVM_TRANSFORMS_CONSTANTMERGE_H
#include "llvm/Pass.h"
class Constant;
class GlobalVariable;
// FIXME: ConstantMerge should not be a methodPass!!!
class ConstantMerge : public MethodPass {
protected:
std::map<Constant*, GlobalVariable*> Constants;
unsigned LastConstantSeen;
public:
inline ConstantMerge() : LastConstantSeen(0) {}
// mergeDuplicateConstants - Static accessor for clients that don't want to
// deal with passes.
//
static bool mergeDuplicateConstants(Module *M);
// doInitialization - For this pass, process all of the globals in the
// module, eliminating duplicate constants.
//
bool doInitialization(Module *M);
bool runOnMethod(Method*) { return false; }
// doFinalization - Clean up internal state for this module
//
bool doFinalization(Module *M) {
LastConstantSeen = 0;
Constants.clear();
return false;
}
};
struct DynamicConstantMerge : public ConstantMerge {
// doPerMethodWork - Check to see if any globals have been added to the
// global list for the module. If so, eliminate them.
//
bool runOnMethod(Method *M);
};
class Pass;
Pass *createConstantMergePass();
Pass *createDynamicConstantMergePass();
#endif

View File

@ -7,25 +7,7 @@
#ifndef LLVM_TRANSFORM_IPO_GLOBALDCE_H
#define LLVM_TRANSFORM_IPO_GLOBALDCE_H
#include "llvm/Pass.h"
namespace cfg { class CallGraph; }
class Module;
struct GlobalDCE : public Pass {
// run - Do the GlobalDCE pass on the specified module, optionally updating
// the specified callgraph to reflect the changes.
//
bool run(Module *M);
// getAnalysisUsageInfo - This function works on the call graph of a module.
// It is capable of updating the call graph to reflect the new state of the
// module.
//
virtual void getAnalysisUsageInfo(Pass::AnalysisSet &Required,
Pass::AnalysisSet &Destroyed,
Pass::AnalysisSet &Provided);
};
class Pass;
Pass *createGlobalDCEPass();
#endif

View File

@ -8,30 +8,8 @@
#ifndef LLVM_TRANSFORMS_SIMPLESTRUCTMUTATION_H
#define LLVM_TRANSFORMS_SIMPLESTRUCTMUTATION_H
#include "llvm/Transforms/IPO/MutateStructTypes.h"
class SimpleStructMutation : public MutateStructTypes {
public:
enum Transform { SwapElements, SortElements } CurrentXForm;
SimpleStructMutation(enum Transform XForm) : CurrentXForm(XForm) {}
virtual bool run(Module *M) {
setTransforms(getTransforms(M, CurrentXForm));
bool Changed = MutateStructTypes::run(M);
clearTransforms();
return Changed;
}
// 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);
private:
TransformsType getTransforms(Module *M, enum Transform);
};
class Pass;
Pass *createSwapElementsPass();
Pass *createSortElementsPass();
#endif