X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=lib%2FAnalysis%2FAliasAnalysisEvaluator.cpp;h=c7a86d3506fc3e92a9dadf80409692f2aa3111a8;hb=002ec1482c83003c6aef841395271aa5993d916a;hp=d8182d0eec886e09abd13f0b8e56a7095a20fff3;hpb=4ee451de366474b9c228b4e5fa573795a715216d;p=oota-llvm.git diff --git a/lib/Analysis/AliasAnalysisEvaluator.cpp b/lib/Analysis/AliasAnalysisEvaluator.cpp index d8182d0eec8..c7a86d3506f 100644 --- a/lib/Analysis/AliasAnalysisEvaluator.cpp +++ b/lib/Analysis/AliasAnalysisEvaluator.cpp @@ -31,27 +31,28 @@ #include "llvm/Support/Compiler.h" #include "llvm/Support/Streams.h" #include +#include using namespace llvm; -namespace { - cl::opt PrintAll("print-all-alias-modref-info", cl::ReallyHidden); +static cl::opt PrintAll("print-all-alias-modref-info", cl::ReallyHidden); - cl::opt PrintNoAlias("print-no-aliases", cl::ReallyHidden); - cl::opt PrintMayAlias("print-may-aliases", cl::ReallyHidden); - cl::opt PrintMustAlias("print-must-aliases", cl::ReallyHidden); +static cl::opt PrintNoAlias("print-no-aliases", cl::ReallyHidden); +static cl::opt PrintMayAlias("print-may-aliases", cl::ReallyHidden); +static cl::opt PrintMustAlias("print-must-aliases", cl::ReallyHidden); - cl::opt PrintNoModRef("print-no-modref", cl::ReallyHidden); - cl::opt PrintMod("print-mod", cl::ReallyHidden); - cl::opt PrintRef("print-ref", cl::ReallyHidden); - cl::opt PrintModRef("print-modref", cl::ReallyHidden); +static cl::opt PrintNoModRef("print-no-modref", cl::ReallyHidden); +static cl::opt PrintMod("print-mod", cl::ReallyHidden); +static cl::opt PrintRef("print-ref", cl::ReallyHidden); +static cl::opt PrintModRef("print-modref", cl::ReallyHidden); +namespace { class VISIBILITY_HIDDEN AAEval : public FunctionPass { unsigned NoAlias, MayAlias, MustAlias; unsigned NoModRef, Mod, Ref, ModRef; public: static char ID; // Pass identification, replacement for typeid - AAEval() : FunctionPass((intptr_t)&ID) {} + AAEval() : FunctionPass(&ID) {} virtual void getAnalysisUsage(AnalysisUsage &AU) const { AU.addRequired(); @@ -72,20 +73,26 @@ namespace { bool runOnFunction(Function &F); bool doFinalization(Module &M); }; - - char AAEval::ID = 0; - RegisterPass - X("aa-eval", "Exhaustive Alias Analysis Precision Evaluator"); } +char AAEval::ID = 0; +static RegisterPass +X("aa-eval", "Exhaustive Alias Analysis Precision Evaluator", false, true); + FunctionPass *llvm::createAAEvalPass() { return new AAEval(); } -static inline void PrintResults(const char *Msg, bool P, Value *V1, Value *V2, - Module *M) { +static void PrintResults(const char *Msg, bool P, const Value *V1, const Value *V2, + const Module *M) { if (P) { - cerr << " " << Msg << ":\t"; - WriteAsOperand(*cerr.stream(), V1, true, M) << ", "; - WriteAsOperand(*cerr.stream(), V2, true, M) << "\n"; + std::stringstream s1, s2; + WriteAsOperand(s1, V1, true, M); + WriteAsOperand(s2, V2, true, M); + std::string o1(s1.str()), o2(s2.str()); + if (o2 < o1) + std::swap(o1, o2); + cerr << " " << Msg << ":\t" + << o1 << ", " + << o2 << "\n"; } }