* Standardize how analysis results/passes as printed with the print() virtual
methods
* Eliminate AnalysisID: Now it is just a typedef for const PassInfo*
* Simplify how AnalysisID's are initialized
* Eliminate Analysis/Writer.cpp/.h: incorporate printing functionality into
the analyses themselves.
llvm-svn: 3116
diff --git a/llvm/lib/Analysis/InductionVariable.cpp b/llvm/lib/Analysis/InductionVariable.cpp
index f7b72e5..485586a 100644
--- a/llvm/lib/Analysis/InductionVariable.cpp
+++ b/llvm/lib/Analysis/InductionVariable.cpp
@@ -23,6 +23,7 @@
#include "llvm/InstrTypes.h"
#include "llvm/Type.h"
#include "llvm/Constants.h"
+#include "llvm/Assembly/Writer.h"
using analysis::ExprType;
@@ -154,3 +155,24 @@
// Classify the induction variable type now...
InductionType = InductionVariable::Classify(Start, Step, L);
}
+
+void InductionVariable::print(std::ostream &o) const {
+ switch (InductionType) {
+ case InductionVariable::Cannonical: o << "Cannonical "; break;
+ case InductionVariable::SimpleLinear: o << "SimpleLinear "; break;
+ case InductionVariable::Linear: o << "Linear "; break;
+ case InductionVariable::Unknown: o << "Unrecognized "; break;
+ }
+ o << "Induction Variable";
+ if (Phi) {
+ WriteAsOperand(o, Phi);
+ o << ":\n" << Phi;
+ } else {
+ o << "\n";
+ }
+ if (InductionType == InductionVariable::Unknown) return;
+
+ o << " Start ="; WriteAsOperand(o, Start);
+ o << " Step =" ; WriteAsOperand(o, Step);
+ o << "\n";
+}