#ifndef LLVM_TRANSFORMS_CLEANUPGCCOUTPUT_H
#define LLVM_TRANSFORMS_CLEANUPGCCOUTPUT_H
-#include "llvm/Analysis/FindUsedTypes.h"
-
-class CleanupGCCOutput : public MethodPass {
- FindUsedTypes FUT; // Use FUT to eliminate type names that are never used
-public:
+#include "llvm/Pass.h"
+struct CleanupGCCOutput : public MethodPass {
// PatchUpMethodReferences - This is a part of the functionality exported by
// the CleanupGCCOutput pass. This causes functions with different signatures
// to be linked together if they have the same name.
// doPassFinalization - Strip out type names that are unused by the program
bool doFinalization(Module *M);
+
+ // getAnalysisUsageInfo - This function needs FindUsedTypes to do its job...
+ //
+ virtual void getAnalysisUsageInfo(Pass::AnalysisSet &Required,
+ Pass::AnalysisSet &Destroyed,
+ Pass::AnalysisSet &Provided);
};
#endif
#define LLVM_TRANSFORMS_CONSTANTMERGE_H
#include "llvm/Pass.h"
-#include <map>
class Constant;
class GlobalVariable;
// 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);
};
#endif
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:
- static TransformsType getTransforms(Module *M, enum Transform);
+ TransformsType getTransforms(Module *M, enum Transform);
};
#endif
#define LLVM_TRANSFORMS_MUTATESTRUCTTYPES_H
#include "llvm/Pass.h"
-#include <map>
+#include "llvm/AbstractTypeUser.h"
+class Value;
+class Type;
class StructType;
class CompositeType;
class GlobalValue;
// 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
//
//===----------------------------------------------------------------------===//
-#ifndef LLVM_OPT_CONSTANT_PROPOGATION_H
-#define LLVM_OPT_CONSTANT_PROPOGATION_H
+#ifndef LLVM_TRANSFORMS_SCALAR_CONSTANT_PROPOGATION_H
+#define LLVM_TRANSFORMS_SCALAR_CONSTANT_PROPOGATION_H
#include "llvm/Pass.h"
+#include "llvm/BasicBlock.h"
class TerminatorInst;
struct ConstantPropogation : public MethodPass {
#define LLVM_OPT_DCE_H
#include "llvm/Pass.h"
-#include "llvm/BasicBlock.h"
+#include "llvm/Method.h"
//===----------------------------------------------------------------------===//
// DeadInstElimination - This pass quickly removes trivially dead instructions
// it more successful are removing non-obviously dead instructions.
//
struct AgressiveDCE : public MethodPass {
- // DoADCE - Execute the Agressive Dead Code Elimination Algorithm
- //
- static bool doADCE(Method *M); // Defined in ADCE.cpp
+ virtual bool runOnMethod(Method *M);
- virtual bool runOnMethod(Method *M) {
- return doADCE(M);
- }
+ // getAnalysisUsageInfo - We require post dominance frontiers (aka Control
+ // Dependence Graph)
+ virtual void getAnalysisUsageInfo(Pass::AnalysisSet &Requires,
+ Pass::AnalysisSet &Destroyed,
+ Pass::AnalysisSet &Provided);
};
#include "llvm/Pass.h"
+namespace cfg { class LoopInfo; }
+
struct InductionVariableSimplify : public MethodPass {
- static bool doit(Method *M);
+ static bool doit(Method *M, cfg::LoopInfo &Loops);
+
+ virtual bool runOnMethod(Method *M);
- virtual bool runOnMethod(Method *M) { return doit(M); }
+ virtual void getAnalysisUsageInfo(Pass::AnalysisSet &Required,
+ Pass::AnalysisSet &Destroyed,
+ Pass::AnalysisSet &Provided);
};
#endif
#define LLVM_OPT_INDUCTION_VARS_H
#include "llvm/Pass.h"
+namespace cfg { class IntervalPartition; }
struct InductionVariableCannonicalize : public MethodPass {
// doInductionVariableCannonicalize - Simplify induction variables in loops
//
- static bool doIt(Method *M);
+ static bool doIt(Method *M, cfg::IntervalPartition &IP);
- virtual bool runOnMethod(Method *M) {
- return doIt(M);
- }
+ virtual bool runOnMethod(Method *M);
+
+ // getAnalysisUsageInfo - Declare that we need IntervalPartitions
+ void getAnalysisUsageInfo(Pass::AnalysisSet &Required,
+ Pass::AnalysisSet &Destroyed,
+ Pass::AnalysisSet &Provided);
};
#endif
#define LLVM_TRANSFORMS_SCALAR_INSTRUCTIONCOMBINING_H
#include "llvm/Pass.h"
+class Instruction;
struct InstructionCombining : public MethodPass {
static bool doit(Method *M);
--- /dev/null
+//===-- UnifyMethodExitNodes.h - Ensure methods 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.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_XFORMS_UNIFY_METHOD_EXIT_NODES_H
+#define LLVM_XFORMS_UNIFY_METHOD_EXIT_NODES_H
+
+#include "llvm/Pass.h"
+#include "llvm/Analysis/SimplifyCFG.h" // FIXME!!
+
+struct UnifyMethodExitNodes : public MethodPass {
+ BasicBlock *ExitNode;
+public:
+ static AnalysisID ID; // Pass ID
+ UnifyMethodExitNodes(AnalysisID id) : ExitNode(0) { assert(ID == id); }
+
+ virtual bool runOnMethod(Method *M) {
+ ExitNode = cfg::UnifyAllExitNodes(M);
+
+ return true; // FIXME: This should return a correct code!!!
+ }
+
+ 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!
+ }
+};
+
+#endif