2001-06-30 04:34:07 +00:00
|
|
|
//===-- InductionVars.h - Induction Variable Recognition ---------*- C++ -*--=//
|
|
|
|
//
|
|
|
|
// This family of functions is useful for Induction variable recognition,
|
|
|
|
// removal and optimizations.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#ifndef LLVM_OPT_INDUCTION_VARS_H
|
|
|
|
#define LLVM_OPT_INDUCTION_VARS_H
|
|
|
|
|
2001-10-18 01:31:58 +00:00
|
|
|
#include "llvm/Transforms/Pass.h"
|
2001-06-30 04:34:07 +00:00
|
|
|
#include "llvm/Module.h"
|
|
|
|
|
|
|
|
namespace opt {
|
|
|
|
|
|
|
|
// DoInductionVariableCannonicalize - Simplify induction variables in loops
|
|
|
|
//
|
|
|
|
bool DoInductionVariableCannonicalize(Method *M);
|
|
|
|
static inline bool DoInductionVariableCannonicalize(Module *M) {
|
|
|
|
return M->reduceApply(DoInductionVariableCannonicalize);
|
|
|
|
}
|
|
|
|
|
2001-10-18 01:31:58 +00:00
|
|
|
struct InductionVariableCannonicalize :
|
|
|
|
public StatelessPass<InductionVariableCannonicalize> {
|
|
|
|
inline static bool doPerMethodWork(Method *M) {
|
|
|
|
return DoInductionVariableCannonicalize(M);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2001-06-30 04:34:07 +00:00
|
|
|
} // end namespace opt
|
|
|
|
|
|
|
|
#endif
|