From 6f81b510217bd87f265cca054c5d9885250d8525 Mon Sep 17 00:00:00 2001 From: Bill Wendling Date: Tue, 28 Nov 2006 22:46:12 +0000 Subject: [PATCH] Removed some of the iostream #includes. Moved towards converting to using llvm streams git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31983 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Analysis/AliasAnalysisCounter.cpp | 23 ++++++------- lib/Analysis/AliasAnalysisEvaluator.cpp | 44 ++++++++++++------------- lib/Analysis/AliasSetTracker.cpp | 8 ++--- lib/Analysis/CFGPrinter.cpp | 8 ++--- lib/Analysis/ConstantRange.cpp | 32 ++++++++++++++++-- lib/Analysis/InstCount.cpp | 5 +-- lib/Analysis/LoopInfo.cpp | 5 +-- lib/Analysis/ProfileInfoLoader.cpp | 27 ++++++++------- lib/Analysis/ProfileInfoLoaderPass.cpp | 5 ++- lib/Analysis/ScalarEvolution.cpp | 27 +++++++-------- lib/Analysis/Trace.cpp | 16 ++++----- lib/Support/ConstantRange.cpp | 32 ++++++++++++++++-- 12 files changed, 143 insertions(+), 89 deletions(-) diff --git a/lib/Analysis/AliasAnalysisCounter.cpp b/lib/Analysis/AliasAnalysisCounter.cpp index 25ace732e2d..6412dbbad66 100644 --- a/lib/Analysis/AliasAnalysisCounter.cpp +++ b/lib/Analysis/AliasAnalysisCounter.cpp @@ -17,6 +17,7 @@ #include "llvm/Analysis/AliasAnalysis.h" #include "llvm/Assembly/Writer.h" #include "llvm/Support/CommandLine.h" +#include "llvm/Support/Streams.h" #include using namespace llvm; @@ -38,14 +39,14 @@ namespace { } void printLine(const char *Desc, unsigned Val, unsigned Sum) { - std::cerr << " " << Val << " " << Desc << " responses (" + llvm_cerr << " " << Val << " " << Desc << " responses (" << Val*100/Sum << "%)\n"; } ~AliasAnalysisCounter() { unsigned AASum = No+May+Must; unsigned MRSum = NoMR+JustRef+JustMod+MR; if (AASum + MRSum) { // Print a report if any counted queries occurred... - std::cerr + llvm_cerr << "\n===== Alias Analysis Counter Report =====\n" << " Analysis counted: " << Name << "\n" << " " << AASum << " Total Alias Queries Performed\n"; @@ -53,19 +54,19 @@ namespace { printLine("no alias", No, AASum); printLine("may alias", May, AASum); printLine("must alias", Must, AASum); - std::cerr + llvm_cerr << " Alias Analysis Counter Summary: " << No*100/AASum << "%/" << May*100/AASum << "%/" << Must*100/AASum<<"%\n\n"; } - std::cerr + llvm_cerr << " " << MRSum << " Total Mod/Ref Queries Performed\n"; if (MRSum) { printLine("no mod/ref", NoMR, MRSum); printLine("ref", JustRef, MRSum); printLine("mod", JustMod, MRSum); printLine("mod/ref", MR, MRSum); - std::cerr + llvm_cerr << " Mod/Ref Analysis Counter Summary: " << NoMR*100/MRSum<< "%/" << JustRef*100/MRSum << "%/" << JustMod*100/MRSum << "%/" << MR*100/MRSum <<"%\n\n"; @@ -132,10 +133,10 @@ AliasAnalysisCounter::alias(const Value *V1, unsigned V1Size, } if (PrintAll || (PrintAllFailures && R == MayAlias)) { - std::cerr << AliasString << ":\t"; - std::cerr << "[" << V1Size << "B] "; + llvm_cerr << AliasString << ":\t"; + llvm_cerr << "[" << V1Size << "B] "; WriteAsOperand(std::cerr, V1, true, true, M) << ", "; - std::cerr << "[" << V2Size << "B] "; + llvm_cerr << "[" << V2Size << "B] "; WriteAsOperand(std::cerr, V2, true, true, M) << "\n"; } @@ -156,10 +157,10 @@ AliasAnalysisCounter::getModRefInfo(CallSite CS, Value *P, unsigned Size) { } if (PrintAll || (PrintAllFailures && R == ModRef)) { - std::cerr << MRString << ": Ptr: "; - std::cerr << "[" << Size << "B] "; + llvm_cerr << MRString << ": Ptr: "; + llvm_cerr << "[" << Size << "B] "; WriteAsOperand(std::cerr, P, true, true, M); - std::cerr << "\t<->" << *CS.getInstruction(); + llvm_cerr << "\t<->" << *CS.getInstruction(); } return R; } diff --git a/lib/Analysis/AliasAnalysisEvaluator.cpp b/lib/Analysis/AliasAnalysisEvaluator.cpp index 9f5a46df10f..946a2ddc9ce 100644 --- a/lib/Analysis/AliasAnalysisEvaluator.cpp +++ b/lib/Analysis/AliasAnalysisEvaluator.cpp @@ -28,9 +28,9 @@ #include "llvm/Target/TargetData.h" #include "llvm/Support/InstIterator.h" #include "llvm/Support/CommandLine.h" +#include "llvm/Support/Streams.h" #include #include - using namespace llvm; namespace { @@ -79,7 +79,7 @@ FunctionPass *llvm::createAAEvalPass() { return new AAEval(); } static inline void PrintResults(const char *Msg, bool P, Value *V1, Value *V2, Module *M) { if (P) { - std::cerr << " " << Msg << ":\t"; + llvm_cerr << " " << Msg << ":\t"; WriteAsOperand(std::cerr, V1, true, true, M) << ", "; WriteAsOperand(std::cerr, V2, true, true, M) << "\n"; } @@ -89,9 +89,9 @@ static inline void PrintModRefResults(const char *Msg, bool P, Instruction *I, Value *Ptr, Module *M) { if (P) { - std::cerr << " " << Msg << ": Ptr: "; + llvm_cerr << " " << Msg << ": Ptr: "; WriteAsOperand(std::cerr, Ptr, true, true, M); - std::cerr << "\t<->" << *I; + llvm_cerr << "\t<->" << *I; } } @@ -125,7 +125,7 @@ bool AAEval::runOnFunction(Function &F) { if (PrintNoAlias || PrintMayAlias || PrintMustAlias || PrintNoModRef || PrintMod || PrintRef || PrintModRef) - std::cerr << "Function: " << F.getName() << ": " << Pointers.size() + llvm_cerr << "Function: " << F.getName() << ": " << Pointers.size() << " pointers, " << CallSites.size() << " call sites\n"; // iterate over the worklist, and run the full (n^2)/2 disambiguations @@ -151,7 +151,7 @@ bool AAEval::runOnFunction(Function &F) { PrintResults("MustAlias", PrintMustAlias, *I1, *I2, F.getParent()); ++MustAlias; break; default: - std::cerr << "Unknown alias query result!\n"; + llvm_cerr << "Unknown alias query result!\n"; } } } @@ -181,7 +181,7 @@ bool AAEval::runOnFunction(Function &F) { PrintModRefResults(" ModRef", PrintModRef, I, *V, F.getParent()); ++ModRef; break; default: - std::cerr << "Unknown alias query result!\n"; + llvm_cerr << "Unknown alias query result!\n"; } } } @@ -190,24 +190,24 @@ bool AAEval::runOnFunction(Function &F) { } static void PrintPercent(unsigned Num, unsigned Sum) { - std::cerr << "(" << Num*100ULL/Sum << "." + llvm_cerr << "(" << Num*100ULL/Sum << "." << ((Num*1000ULL/Sum) % 10) << "%)\n"; } bool AAEval::doFinalization(Module &M) { unsigned AliasSum = NoAlias + MayAlias + MustAlias; - std::cerr << "===== Alias Analysis Evaluator Report =====\n"; + llvm_cerr << "===== Alias Analysis Evaluator Report =====\n"; if (AliasSum == 0) { - std::cerr << " Alias Analysis Evaluator Summary: No pointers!\n"; + llvm_cerr << " Alias Analysis Evaluator Summary: No pointers!\n"; } else { - std::cerr << " " << AliasSum << " Total Alias Queries Performed\n"; - std::cerr << " " << NoAlias << " no alias responses "; + llvm_cerr << " " << AliasSum << " Total Alias Queries Performed\n"; + llvm_cerr << " " << NoAlias << " no alias responses "; PrintPercent(NoAlias, AliasSum); - std::cerr << " " << MayAlias << " may alias responses "; + llvm_cerr << " " << MayAlias << " may alias responses "; PrintPercent(MayAlias, AliasSum); - std::cerr << " " << MustAlias << " must alias responses "; + llvm_cerr << " " << MustAlias << " must alias responses "; PrintPercent(MustAlias, AliasSum); - std::cerr << " Alias Analysis Evaluator Pointer Alias Summary: " + llvm_cerr << " Alias Analysis Evaluator Pointer Alias Summary: " << NoAlias*100/AliasSum << "%/" << MayAlias*100/AliasSum << "%/" << MustAlias*100/AliasSum << "%\n"; } @@ -215,18 +215,18 @@ bool AAEval::doFinalization(Module &M) { // Display the summary for mod/ref analysis unsigned ModRefSum = NoModRef + Mod + Ref + ModRef; if (ModRefSum == 0) { - std::cerr << " Alias Analysis Mod/Ref Evaluator Summary: no mod/ref!\n"; + llvm_cerr << " Alias Analysis Mod/Ref Evaluator Summary: no mod/ref!\n"; } else { - std::cerr << " " << ModRefSum << " Total ModRef Queries Performed\n"; - std::cerr << " " << NoModRef << " no mod/ref responses "; + llvm_cerr << " " << ModRefSum << " Total ModRef Queries Performed\n"; + llvm_cerr << " " << NoModRef << " no mod/ref responses "; PrintPercent(NoModRef, ModRefSum); - std::cerr << " " << Mod << " mod responses "; + llvm_cerr << " " << Mod << " mod responses "; PrintPercent(Mod, ModRefSum); - std::cerr << " " << Ref << " ref responses "; + llvm_cerr << " " << Ref << " ref responses "; PrintPercent(Ref, ModRefSum); - std::cerr << " " << ModRef << " mod & ref responses "; + llvm_cerr << " " << ModRef << " mod & ref responses "; PrintPercent(ModRef, ModRefSum); - std::cerr << " Alias Analysis Evaluator Mod/Ref Summary: " + llvm_cerr << " Alias Analysis Evaluator Mod/Ref Summary: " << NoModRef*100/ModRefSum << "%/" << Mod*100/ModRefSum << "%/" << Ref*100/ModRefSum << "%/" << ModRef*100/ModRefSum << "%\n"; } diff --git a/lib/Analysis/AliasSetTracker.cpp b/lib/Analysis/AliasSetTracker.cpp index 852def0b767..f07ff6f8675 100644 --- a/lib/Analysis/AliasSetTracker.cpp +++ b/lib/Analysis/AliasSetTracker.cpp @@ -19,7 +19,7 @@ #include "llvm/Target/TargetData.h" #include "llvm/Assembly/Writer.h" #include "llvm/Support/InstIterator.h" -#include +#include "llvm/Support/Streams.h" using namespace llvm; /// mergeSetIn - Merge the specified alias set into this alias set. @@ -543,8 +543,8 @@ void AliasSetTracker::print(std::ostream &OS) const { OS << "\n"; } -void AliasSet::dump() const { print (std::cerr); } -void AliasSetTracker::dump() const { print(std::cerr); } +void AliasSet::dump() const { print (llvm_cerr); } +void AliasSetTracker::dump() const { print(llvm_cerr); } //===----------------------------------------------------------------------===// // AliasSetPrinter Pass @@ -564,7 +564,7 @@ namespace { for (inst_iterator I = inst_begin(F), E = inst_end(F); I != E; ++I) Tracker->add(&*I); - Tracker->print(std::cerr); + Tracker->print(llvm_cerr); delete Tracker; return false; } diff --git a/lib/Analysis/CFGPrinter.cpp b/lib/Analysis/CFGPrinter.cpp index 9dc4ba639c7..3f6846e1f6e 100644 --- a/lib/Analysis/CFGPrinter.cpp +++ b/lib/Analysis/CFGPrinter.cpp @@ -25,7 +25,7 @@ #include "llvm/Support/CFG.h" #include "llvm/Support/GraphWriter.h" #include "llvm/Config/config.h" -#include +#include #include #include using namespace llvm; @@ -92,14 +92,14 @@ namespace { struct CFGPrinter : public FunctionPass { virtual bool runOnFunction(Function &F) { std::string Filename = "cfg." + F.getName() + ".dot"; - std::cerr << "Writing '" << Filename << "'..."; + llvm_cerr << "Writing '" << Filename << "'..."; std::ofstream File(Filename.c_str()); if (File.good()) WriteGraph(File, (const Function*)&F); else - std::cerr << " error opening file for writing!"; - std::cerr << "\n"; + llvm_cerr << " error opening file for writing!"; + llvm_cerr << "\n"; return false; } diff --git a/lib/Analysis/ConstantRange.cpp b/lib/Analysis/ConstantRange.cpp index 9e12c9343db..21eabe2aca6 100644 --- a/lib/Analysis/ConstantRange.cpp +++ b/lib/Analysis/ConstantRange.cpp @@ -25,8 +25,8 @@ #include "llvm/Constants.h" #include "llvm/Instruction.h" #include "llvm/Type.h" -#include - +#include "llvm/Support/Streams.h" +#include using namespace llvm; static ConstantIntegral *Next(ConstantIntegral *CI) { @@ -50,6 +50,32 @@ static bool LTE(ConstantIntegral *A, ConstantIntegral *B) { return cast(C)->getValue(); } + + + + + + + + + + + + + + + + + + + + + + + + + + static bool GT(ConstantIntegral *A, ConstantIntegral *B) { return LT(B, A); } static ConstantIntegral *Min(ConstantIntegral *A, ConstantIntegral *B) { @@ -328,5 +354,5 @@ void ConstantRange::print(std::ostream &OS) const { /// dump - Allow printing from a debugger easily... /// void ConstantRange::dump() const { - print(std::cerr); + print(llvm_cerr); } diff --git a/lib/Analysis/InstCount.cpp b/lib/Analysis/InstCount.cpp index 72bc2c72387..80f8bd88180 100644 --- a/lib/Analysis/InstCount.cpp +++ b/lib/Analysis/InstCount.cpp @@ -15,8 +15,9 @@ #include "llvm/Pass.h" #include "llvm/Function.h" #include "llvm/Support/InstVisitor.h" +#include "llvm/Support/Streams.h" #include "llvm/ADT/Statistic.h" -#include +#include using namespace llvm; namespace { @@ -42,7 +43,7 @@ namespace { #include "llvm/Instruction.def" void visitInstruction(Instruction &I) { - std::cerr << "Instruction Count does not know about " << I; + llvm_cerr << "Instruction Count does not know about " << I; abort(); } public: diff --git a/lib/Analysis/LoopInfo.cpp b/lib/Analysis/LoopInfo.cpp index 9a6b5208d85..18957607ffe 100644 --- a/lib/Analysis/LoopInfo.cpp +++ b/lib/Analysis/LoopInfo.cpp @@ -20,9 +20,10 @@ #include "llvm/Analysis/Dominators.h" #include "llvm/Assembly/Writer.h" #include "llvm/Support/CFG.h" +#include "llvm/Support/Streams.h" #include "llvm/ADT/DepthFirstIterator.h" #include -#include +#include using namespace llvm; static RegisterPass @@ -79,7 +80,7 @@ void Loop::print(std::ostream &OS, unsigned Depth) const { } void Loop::dump() const { - print(std::cerr); + print(llvm_cerr); } diff --git a/lib/Analysis/ProfileInfoLoader.cpp b/lib/Analysis/ProfileInfoLoader.cpp index 15e9c1338c6..3c19f5e9b9f 100644 --- a/lib/Analysis/ProfileInfoLoader.cpp +++ b/lib/Analysis/ProfileInfoLoader.cpp @@ -16,10 +16,9 @@ #include "llvm/Analysis/ProfileInfoTypes.h" #include "llvm/Module.h" #include "llvm/InstrTypes.h" +#include "llvm/Support/Streams.h" #include -#include #include - using namespace llvm; // ByteSwap - Byteswap 'Var' if 'Really' is true. @@ -38,7 +37,7 @@ static void ReadProfilingBlock(const char *ToolName, FILE *F, // Read the number of entries... unsigned NumEntries; if (fread(&NumEntries, sizeof(unsigned), 1, F) != 1) { - std::cerr << ToolName << ": data packet truncated!\n"; + llvm_cerr << ToolName << ": data packet truncated!\n"; perror(0); exit(1); } @@ -49,7 +48,7 @@ static void ReadProfilingBlock(const char *ToolName, FILE *F, // Read in the block of data... if (fread(&TempSpace[0], sizeof(unsigned)*NumEntries, 1, F) != 1) { - std::cerr << ToolName << ": data packet truncated!\n"; + llvm_cerr << ToolName << ": data packet truncated!\n"; perror(0); exit(1); } @@ -76,7 +75,7 @@ ProfileInfoLoader::ProfileInfoLoader(const char *ToolName, Module &TheModule) : M(TheModule) { FILE *F = fopen(Filename.c_str(), "r"); if (F == 0) { - std::cerr << ToolName << ": Error opening '" << Filename << "': "; + llvm_cerr << ToolName << ": Error opening '" << Filename << "': "; perror(0); exit(1); } @@ -94,7 +93,7 @@ ProfileInfoLoader::ProfileInfoLoader(const char *ToolName, case ArgumentInfo: { unsigned ArgLength; if (fread(&ArgLength, sizeof(unsigned), 1, F) != 1) { - std::cerr << ToolName << ": arguments packet truncated!\n"; + llvm_cerr << ToolName << ": arguments packet truncated!\n"; perror(0); exit(1); } @@ -105,7 +104,7 @@ ProfileInfoLoader::ProfileInfoLoader(const char *ToolName, if (ArgLength) if (fread(&Chars[0], (ArgLength+3) & ~3, 1, F) != 1) { - std::cerr << ToolName << ": arguments packet truncated!\n"; + llvm_cerr << ToolName << ": arguments packet truncated!\n"; perror(0); exit(1); } @@ -130,7 +129,7 @@ ProfileInfoLoader::ProfileInfoLoader(const char *ToolName, break; default: - std::cerr << ToolName << ": Unknown packet type #" << PacketType << "!\n"; + llvm_cerr << ToolName << ": Unknown packet type #" << PacketType << "!\n"; exit(1); } } @@ -157,7 +156,7 @@ void ProfileInfoLoader::getFunctionCounts(std::vectorgetParent(), BlockCounts[i].second)); } else { - std::cerr << "Function counts are not available!\n"; + llvm_cerr << "Function counts are not available!\n"; } return; } @@ -201,7 +200,7 @@ void ProfileInfoLoader::getBlockCounts(std::vector= TI->getNumSuccessors()) { static bool Warned = false; if (!Warned) { - std::cerr << "WARNING: profile info doesn't seem to match" + llvm_cerr << "WARNING: profile info doesn't seem to match" << " the program!\n"; Warned = true; } @@ -227,7 +226,7 @@ void ProfileInfoLoader::getBlockCounts(std::vector > &Counts) { if (EdgeCounts.empty()) { - std::cerr << "Edge counts not available, and no synthesis " + llvm_cerr << "Edge counts not available, and no synthesis " << "is implemented yet!\n"; return; } @@ -269,9 +268,9 @@ void ProfileInfoLoader::getEdgeCounts(std::vector &Trace) { if (BBTrace.empty ()) { - std::cerr << "Basic block trace is not available!\n"; + llvm_cerr << "Basic block trace is not available!\n"; return; } - std::cerr << "Basic block trace loading is not implemented yet!\n"; + llvm_cerr << "Basic block trace loading is not implemented yet!\n"; } diff --git a/lib/Analysis/ProfileInfoLoaderPass.cpp b/lib/Analysis/ProfileInfoLoaderPass.cpp index b5cb95433fc..08a45c62c55 100644 --- a/lib/Analysis/ProfileInfoLoaderPass.cpp +++ b/lib/Analysis/ProfileInfoLoaderPass.cpp @@ -19,8 +19,7 @@ #include "llvm/Analysis/ProfileInfo.h" #include "llvm/Analysis/ProfileInfoLoader.h" #include "llvm/Support/CommandLine.h" -#include - +#include "llvm/Support/Streams.h" using namespace llvm; namespace { @@ -77,7 +76,7 @@ bool LoaderPass::runOnModule(Module &M) { TerminatorInst *TI = BB->getTerminator(); if (SuccNum >= TI->getNumSuccessors()) { if (!PrintedWarning) { - std::cerr << "WARNING: profile information is inconsistent with " + llvm_cerr << "WARNING: profile information is inconsistent with " << "the current program!\n"; PrintedWarning = true; } diff --git a/lib/Analysis/ScalarEvolution.cpp b/lib/Analysis/ScalarEvolution.cpp index 8c809f8c5ac..26d73fc0332 100644 --- a/lib/Analysis/ScalarEvolution.cpp +++ b/lib/Analysis/ScalarEvolution.cpp @@ -74,8 +74,9 @@ #include "llvm/Support/ConstantRange.h" #include "llvm/Support/InstIterator.h" #include "llvm/Support/ManagedStatic.h" +#include "llvm/Support/Streams.h" #include "llvm/ADT/Statistic.h" -#include +#include #include using namespace llvm; @@ -116,7 +117,7 @@ namespace { // SCEV::~SCEV() {} void SCEV::dump() const { - print(std::cerr); + print(llvm_cerr); } /// getValueRange - Return the tightest constant bounds that this value is @@ -1553,10 +1554,10 @@ SCEVHandle ScalarEvolutionsImpl::ComputeIterationCount(const Loop *L) { break; default: #if 0 - std::cerr << "ComputeIterationCount "; + llvm_cerr << "ComputeIterationCount "; if (ExitCond->getOperand(0)->getType()->isUnsigned()) - std::cerr << "[unsigned] "; - std::cerr << *LHS << " " + llvm_cerr << "[unsigned] "; + llvm_cerr << *LHS << " " << Instruction::getOpcodeName(Cond) << " " << *RHS << "\n"; #endif break; @@ -1673,7 +1674,7 @@ ComputeLoadConstantCompareIterationCount(LoadInst *LI, Constant *RHS, if (!isa(Result)) break; // Couldn't decide for sure if (cast(Result)->getValue() == false) { #if 0 - std::cerr << "\n***\n*** Computed loop count " << *ItCst + llvm_cerr << "\n***\n*** Computed loop count " << *ItCst << "\n*** From global " << *GV << "*** BB: " << *L->getHeader() << "***\n"; #endif @@ -2142,7 +2143,7 @@ SCEVHandle ScalarEvolutionsImpl::HowFarToZero(SCEV *V, const Loop *L) { SCEVConstant *R2 = dyn_cast(Roots.second); if (R1) { #if 0 - std::cerr << "HFTZ: " << *V << " - sol#1: " << *R1 + llvm_cerr << "HFTZ: " << *V << " - sol#1: " << *R1 << " sol#2: " << *R2 << "\n"; #endif // Pick the smallest positive root value. @@ -2271,7 +2272,7 @@ HowManyLessThans(SCEV *LHS, SCEV *RHS, const Loop *L) { default: break; } - //std::cerr << "Computed Loop Trip Count as: " << + //llvm_cerr << "Computed Loop Trip Count as: " << // *SCEV::getMinusSCEV(RHS, AddRec->getOperand(0)) << "\n"; return SCEV::getMinusSCEV(RHS, AddRec->getOperand(0)); } @@ -2487,20 +2488,20 @@ static void PrintLoopInfo(std::ostream &OS, const ScalarEvolution *SE, for (Loop::iterator I = L->begin(), E = L->end(); I != E; ++I) PrintLoopInfo(OS, SE, *I); - std::cerr << "Loop " << L->getHeader()->getName() << ": "; + llvm_cerr << "Loop " << L->getHeader()->getName() << ": "; std::vector ExitBlocks; L->getExitBlocks(ExitBlocks); if (ExitBlocks.size() != 1) - std::cerr << " "; + llvm_cerr << " "; if (SE->hasLoopInvariantIterationCount(L)) { - std::cerr << *SE->getIterationCount(L) << " iterations! "; + llvm_cerr << *SE->getIterationCount(L) << " iterations! "; } else { - std::cerr << "Unpredictable iteration count. "; + llvm_cerr << "Unpredictable iteration count. "; } - std::cerr << "\n"; + llvm_cerr << "\n"; } void ScalarEvolution::print(std::ostream &OS, const Module* ) const { diff --git a/lib/Analysis/Trace.cpp b/lib/Analysis/Trace.cpp index 9fc7b8a2c6a..91c7ffa7799 100644 --- a/lib/Analysis/Trace.cpp +++ b/lib/Analysis/Trace.cpp @@ -18,8 +18,7 @@ #include "llvm/Analysis/Trace.h" #include "llvm/Function.h" #include "llvm/Assembly/Writer.h" -#include - +#include "llvm/Support/Streams.h" using namespace llvm; Function *Trace::getFunction() const { @@ -33,12 +32,13 @@ Module *Trace::getModule() const { /// print - Write trace to output stream. /// -void Trace::print (std::ostream &O) const { +void Trace::print(llvm_ostream &O) const { Function *F = getFunction (); - O << "; Trace from function " << F->getName () << ", blocks:\n"; - for (const_iterator i = begin (), e = end (); i != e; ++i) { + O << "; Trace from function " << F->getName() << ", blocks:\n"; + for (const_iterator i = begin(), e = end(); i != e; ++i) { O << "; "; - WriteAsOperand (O, *i, true, true, getModule ()); + if (O.stream()) + WriteAsOperand(*O.stream(), *i, true, true, getModule()); O << "\n"; } O << "; Trace parent function: \n" << *F; @@ -47,6 +47,6 @@ void Trace::print (std::ostream &O) const { /// dump - Debugger convenience method; writes trace to standard error /// output stream. /// -void Trace::dump () const { - print (std::cerr); +void Trace::dump() const { + print(llvm_cerr); } diff --git a/lib/Support/ConstantRange.cpp b/lib/Support/ConstantRange.cpp index 9e12c9343db..21eabe2aca6 100644 --- a/lib/Support/ConstantRange.cpp +++ b/lib/Support/ConstantRange.cpp @@ -25,8 +25,8 @@ #include "llvm/Constants.h" #include "llvm/Instruction.h" #include "llvm/Type.h" -#include - +#include "llvm/Support/Streams.h" +#include using namespace llvm; static ConstantIntegral *Next(ConstantIntegral *CI) { @@ -50,6 +50,32 @@ static bool LTE(ConstantIntegral *A, ConstantIntegral *B) { return cast(C)->getValue(); } + + + + + + + + + + + + + + + + + + + + + + + + + + static bool GT(ConstantIntegral *A, ConstantIntegral *B) { return LT(B, A); } static ConstantIntegral *Min(ConstantIntegral *A, ConstantIntegral *B) { @@ -328,5 +354,5 @@ void ConstantRange::print(std::ostream &OS) const { /// dump - Allow printing from a debugger easily... /// void ConstantRange::dump() const { - print(std::cerr); + print(llvm_cerr); } -- 2.34.1