llvm.org GIT mirror llvm / 6f81b51
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 Bill Wendling 13 years ago
12 changed file(s) with 151 addition(s) and 97 deletion(s). Raw diff Collapse all Expand all
1616 #include "llvm/Analysis/AliasAnalysis.h"
1717 #include "llvm/Assembly/Writer.h"
1818 #include "llvm/Support/CommandLine.h"
19 #include "llvm/Support/Streams.h"
1920 #include
2021 using namespace llvm;
2122
3738 }
3839
3940 void printLine(const char *Desc, unsigned Val, unsigned Sum) {
40 std::cerr << " " << Val << " " << Desc << " responses ("
41 llvm_cerr << " " << Val << " " << Desc << " responses ("
4142 << Val*100/Sum << "%)\n";
4243 }
4344 ~AliasAnalysisCounter() {
4445 unsigned AASum = No+May+Must;
4546 unsigned MRSum = NoMR+JustRef+JustMod+MR;
4647 if (AASum + MRSum) { // Print a report if any counted queries occurred...
47 std::cerr
48 llvm_cerr
4849 << "\n===== Alias Analysis Counter Report =====\n"
4950 << " Analysis counted: " << Name << "\n"
5051 << " " << AASum << " Total Alias Queries Performed\n";
5253 printLine("no alias", No, AASum);
5354 printLine("may alias", May, AASum);
5455 printLine("must alias", Must, AASum);
55 std::cerr
56 llvm_cerr
5657 << " Alias Analysis Counter Summary: " << No*100/AASum << "%/"
5758 << May*100/AASum << "%/" << Must*100/AASum<<"%\n\n";
5859 }
5960
60 std::cerr
61 llvm_cerr
6162 << " " << MRSum << " Total Mod/Ref Queries Performed\n";
6263 if (MRSum) {
6364 printLine("no mod/ref", NoMR, MRSum);
6465 printLine("ref", JustRef, MRSum);
6566 printLine("mod", JustMod, MRSum);
6667 printLine("mod/ref", MR, MRSum);
67 std::cerr
68 llvm_cerr
6869 << " Mod/Ref Analysis Counter Summary: " << NoMR*100/MRSum<< "%/"
6970 << JustRef*100/MRSum << "%/" << JustMod*100/MRSum << "%/"
7071 << MR*100/MRSum <<"%\n\n";
131132 }
132133
133134 if (PrintAll || (PrintAllFailures && R == MayAlias)) {
134 std::cerr << AliasString << ":\t";
135 std::cerr << "[" << V1Size << "B] ";
135 llvm_cerr << AliasString << ":\t";
136 llvm_cerr << "[" << V1Size << "B] ";
136137 WriteAsOperand(std::cerr, V1, true, true, M) << ", ";
137 std::cerr << "[" << V2Size << "B] ";
138 llvm_cerr << "[" << V2Size << "B] ";
138139 WriteAsOperand(std::cerr, V2, true, true, M) << "\n";
139140 }
140141
155156 }
156157
157158 if (PrintAll || (PrintAllFailures && R == ModRef)) {
158 std::cerr << MRString << ": Ptr: ";
159 std::cerr << "[" << Size << "B] ";
159 llvm_cerr << MRString << ": Ptr: ";
160 llvm_cerr << "[" << Size << "B] ";
160161 WriteAsOperand(std::cerr, P, true, true, M);
161 std::cerr << "\t<->" << *CS.getInstruction();
162 llvm_cerr << "\t<->" << *CS.getInstruction();
162163 }
163164 return R;
164165 }
2727 #include "llvm/Target/TargetData.h"
2828 #include "llvm/Support/InstIterator.h"
2929 #include "llvm/Support/CommandLine.h"
30 #include "llvm/Support/Streams.h"
3031 #include
3132 #include
32
3333 using namespace llvm;
3434
3535 namespace {
7878 static inline void PrintResults(const char *Msg, bool P, Value *V1, Value *V2,
7979 Module *M) {
8080 if (P) {
81 std::cerr << " " << Msg << ":\t";
81 llvm_cerr << " " << Msg << ":\t";
8282 WriteAsOperand(std::cerr, V1, true, true, M) << ", ";
8383 WriteAsOperand(std::cerr, V2, true, true, M) << "\n";
8484 }
8888 PrintModRefResults(const char *Msg, bool P, Instruction *I, Value *Ptr,
8989 Module *M) {
9090 if (P) {
91 std::cerr << " " << Msg << ": Ptr: ";
91 llvm_cerr << " " << Msg << ": Ptr: ";
9292 WriteAsOperand(std::cerr, Ptr, true, true, M);
93 std::cerr << "\t<->" << *I;
93 llvm_cerr << "\t<->" << *I;
9494 }
9595 }
9696
124124
125125 if (PrintNoAlias || PrintMayAlias || PrintMustAlias ||
126126 PrintNoModRef || PrintMod || PrintRef || PrintModRef)
127 std::cerr << "Function: " << F.getName() << ": " << Pointers.size()
127 llvm_cerr << "Function: " << F.getName() << ": " << Pointers.size()
128128 << " pointers, " << CallSites.size() << " call sites\n";
129129
130130 // iterate over the worklist, and run the full (n^2)/2 disambiguations
150150 PrintResults("MustAlias", PrintMustAlias, *I1, *I2, F.getParent());
151151 ++MustAlias; break;
152152 default:
153 std::cerr << "Unknown alias query result!\n";
153 llvm_cerr << "Unknown alias query result!\n";
154154 }
155155 }
156156 }
180180 PrintModRefResults(" ModRef", PrintModRef, I, *V, F.getParent());
181181 ++ModRef; break;
182182 default:
183 std::cerr << "Unknown alias query result!\n";
183 llvm_cerr << "Unknown alias query result!\n";
184184 }
185185 }
186186 }
189189 }
190190
191191 static void PrintPercent(unsigned Num, unsigned Sum) {
192 std::cerr << "(" << Num*100ULL/Sum << "."
192 llvm_cerr << "(" << Num*100ULL/Sum << "."
193193 << ((Num*1000ULL/Sum) % 10) << "%)\n";
194194 }
195195
196196 bool AAEval::doFinalization(Module &M) {
197197 unsigned AliasSum = NoAlias + MayAlias + MustAlias;
198 std::cerr << "===== Alias Analysis Evaluator Report =====\n";
198 llvm_cerr << "===== Alias Analysis Evaluator Report =====\n";
199199 if (AliasSum == 0) {
200 std::cerr << " Alias Analysis Evaluator Summary: No pointers!\n";
200 llvm_cerr << " Alias Analysis Evaluator Summary: No pointers!\n";
201201 } else {
202 std::cerr << " " << AliasSum << " Total Alias Queries Performed\n";
203 std::cerr << " " << NoAlias << " no alias responses ";
202 llvm_cerr << " " << AliasSum << " Total Alias Queries Performed\n";
203 llvm_cerr << " " << NoAlias << " no alias responses ";
204204 PrintPercent(NoAlias, AliasSum);
205 std::cerr << " " << MayAlias << " may alias responses ";
205 llvm_cerr << " " << MayAlias << " may alias responses ";
206206 PrintPercent(MayAlias, AliasSum);
207 std::cerr << " " << MustAlias << " must alias responses ";
207 llvm_cerr << " " << MustAlias << " must alias responses ";
208208 PrintPercent(MustAlias, AliasSum);
209 std::cerr << " Alias Analysis Evaluator Pointer Alias Summary: "
209 llvm_cerr << " Alias Analysis Evaluator Pointer Alias Summary: "
210210 << NoAlias*100/AliasSum << "%/" << MayAlias*100/AliasSum << "%/"
211211 << MustAlias*100/AliasSum << "%\n";
212212 }
214214 // Display the summary for mod/ref analysis
215215 unsigned ModRefSum = NoModRef + Mod + Ref + ModRef;
216216 if (ModRefSum == 0) {
217 std::cerr << " Alias Analysis Mod/Ref Evaluator Summary: no mod/ref!\n";
217 llvm_cerr << " Alias Analysis Mod/Ref Evaluator Summary: no mod/ref!\n";
218218 } else {
219 std::cerr << " " << ModRefSum << " Total ModRef Queries Performed\n";
220 std::cerr << " " << NoModRef << " no mod/ref responses ";
219 llvm_cerr << " " << ModRefSum << " Total ModRef Queries Performed\n";
220 llvm_cerr << " " << NoModRef << " no mod/ref responses ";
221221 PrintPercent(NoModRef, ModRefSum);
222 std::cerr << " " << Mod << " mod responses ";
222 llvm_cerr << " " << Mod << " mod responses ";
223223 PrintPercent(Mod, ModRefSum);
224 std::cerr << " " << Ref << " ref responses ";
224 llvm_cerr << " " << Ref << " ref responses ";
225225 PrintPercent(Ref, ModRefSum);
226 std::cerr << " " << ModRef << " mod & ref responses ";
226 llvm_cerr << " " << ModRef << " mod & ref responses ";
227227 PrintPercent(ModRef, ModRefSum);
228 std::cerr << " Alias Analysis Evaluator Mod/Ref Summary: "
228 llvm_cerr << " Alias Analysis Evaluator Mod/Ref Summary: "
229229 << NoModRef*100/ModRefSum << "%/" << Mod*100/ModRefSum << "%/"
230230 << Ref*100/ModRefSum << "%/" << ModRef*100/ModRefSum << "%\n";
231231 }
1818 #include "llvm/Target/TargetData.h"
1919 #include "llvm/Assembly/Writer.h"
2020 #include "llvm/Support/InstIterator.h"
21 #include
21 #include "llvm/Support/Streams.h"
2222 using namespace llvm;
2323
2424 /// mergeSetIn - Merge the specified alias set into this alias set.
542542 OS << "\n";
543543 }
544544
545 void AliasSet::dump() const { print (std::cerr); }
546 void AliasSetTracker::dump() const { print(std::cerr); }
545 void AliasSet::dump() const { print (llvm_cerr); }
546 void AliasSetTracker::dump() const { print(llvm_cerr); }
547547
548548 //===----------------------------------------------------------------------===//
549549 // AliasSetPrinter Pass
563563
564564 for (inst_iterator I = inst_begin(F), E = inst_end(F); I != E; ++I)
565565 Tracker->add(&*I);
566 Tracker->print(std::cerr);
566 Tracker->print(llvm_cerr);
567567 delete Tracker;
568568 return false;
569569 }
2424 #include "llvm/Support/CFG.h"
2525 #include "llvm/Support/GraphWriter.h"
2626 #include "llvm/Config/config.h"
27 #include tream>
27 #include fwd>
2828 #include
2929 #include
3030 using namespace llvm;
9191 struct CFGPrinter : public FunctionPass {
9292 virtual bool runOnFunction(Function &F) {
9393 std::string Filename = "cfg." + F.getName() + ".dot";
94 std::cerr << "Writing '" << Filename << "'...";
94 llvm_cerr << "Writing '" << Filename << "'...";
9595 std::ofstream File(Filename.c_str());
9696
9797 if (File.good())
9898 WriteGraph(File, (const Function*)&F);
9999 else
100 std::cerr << " error opening file for writing!";
101 std::cerr << "\n";
100 llvm_cerr << " error opening file for writing!";
101 llvm_cerr << "\n";
102102 return false;
103103 }
104104
2424 #include "llvm/Constants.h"
2525 #include "llvm/Instruction.h"
2626 #include "llvm/Type.h"
27 #include
28
27 #include "llvm/Support/Streams.h"
28 #include
2929 using namespace llvm;
3030
3131 static ConstantIntegral *Next(ConstantIntegral *CI) {
4848 assert(isa(C) && "Constant folding of integrals not impl??");
4949 return cast(C)->getValue();
5050 }
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
5177
5278 static bool GT(ConstantIntegral *A, ConstantIntegral *B) { return LT(B, A); }
5379
327353 /// dump - Allow printing from a debugger easily...
328354 ///
329355 void ConstantRange::dump() const {
330 print(std::cerr);
331 }
356 print(llvm_cerr);
357 }
1414 #include "llvm/Pass.h"
1515 #include "llvm/Function.h"
1616 #include "llvm/Support/InstVisitor.h"
17 #include "llvm/Support/Streams.h"
1718 #include "llvm/ADT/Statistic.h"
18 #include <iostream>
19 #include <ostream>
1920 using namespace llvm;
2021
2122 namespace {
4142 #include "llvm/Instruction.def"
4243
4344 void visitInstruction(Instruction &I) {
44 std::cerr << "Instruction Count does not know about " << I;
45 llvm_cerr << "Instruction Count does not know about " << I;
4546 abort();
4647 }
4748 public:
1919 #include "llvm/Analysis/Dominators.h"
2020 #include "llvm/Assembly/Writer.h"
2121 #include "llvm/Support/CFG.h"
22 #include "llvm/Support/Streams.h"
2223 #include "llvm/ADT/DepthFirstIterator.h"
2324 #include
24 #include <iostream>
25 #include <ostream>
2526 using namespace llvm;
2627
2728 static RegisterPass
7879 }
7980
8081 void Loop::dump() const {
81 print(std::cerr);
82 print(llvm_cerr);
8283 }
8384
8485
1515 #include "llvm/Analysis/ProfileInfoTypes.h"
1616 #include "llvm/Module.h"
1717 #include "llvm/InstrTypes.h"
18 #include "llvm/Support/Streams.h"
1819 #include
19 #include
2020 #include
21
2221 using namespace llvm;
2322
2423 // ByteSwap - Byteswap 'Var' if 'Really' is true.
3736 // Read the number of entries...
3837 unsigned NumEntries;
3938 if (fread(&NumEntries, sizeof(unsigned), 1, F) != 1) {
40 std::cerr << ToolName << ": data packet truncated!\n";
39 llvm_cerr << ToolName << ": data packet truncated!\n";
4140 perror(0);
4241 exit(1);
4342 }
4847
4948 // Read in the block of data...
5049 if (fread(&TempSpace[0], sizeof(unsigned)*NumEntries, 1, F) != 1) {
51 std::cerr << ToolName << ": data packet truncated!\n";
50 llvm_cerr << ToolName << ": data packet truncated!\n";
5251 perror(0);
5352 exit(1);
5453 }
7574 Module &TheModule) : M(TheModule) {
7675 FILE *F = fopen(Filename.c_str(), "r");
7776 if (F == 0) {
78 std::cerr << ToolName << ": Error opening '" << Filename << "': ";
77 llvm_cerr << ToolName << ": Error opening '" << Filename << "': ";
7978 perror(0);
8079 exit(1);
8180 }
9392 case ArgumentInfo: {
9493 unsigned ArgLength;
9594 if (fread(&ArgLength, sizeof(unsigned), 1, F) != 1) {
96 std::cerr << ToolName << ": arguments packet truncated!\n";
95 llvm_cerr << ToolName << ": arguments packet truncated!\n";
9796 perror(0);
9897 exit(1);
9998 }
104103
105104 if (ArgLength)
106105 if (fread(&Chars[0], (ArgLength+3) & ~3, 1, F) != 1) {
107 std::cerr << ToolName << ": arguments packet truncated!\n";
106 llvm_cerr << ToolName << ": arguments packet truncated!\n";
108107 perror(0);
109108 exit(1);
110109 }
129128 break;
130129
131130 default:
132 std::cerr << ToolName << ": Unknown packet type #" << PacketType << "!\n";
131 llvm_cerr << ToolName << ": Unknown packet type #" << PacketType << "!\n";
133132 exit(1);
134133 }
135134 }
156155 Counts.push_back(std::make_pair(BlockCounts[i].first->getParent(),
157156 BlockCounts[i].second));
158157 } else {
159 std::cerr << "Function counts are not available!\n";
158 llvm_cerr << "Function counts are not available!\n";
160159 }
161160 return;
162161 }
200199 if (SuccNum >= TI->getNumSuccessors()) {
201200 static bool Warned = false;
202201 if (!Warned) {
203 std::cerr << "WARNING: profile info doesn't seem to match"
202 llvm_cerr << "WARNING: profile info doesn't seem to match"
204203 << " the program!\n";
205204 Warned = true;
206205 }
226225 }
227226
228227 } else {
229 std::cerr << "Block counts are not available!\n";
228 llvm_cerr << "Block counts are not available!\n";
230229 }
231230 return;
232231 }
247246 void ProfileInfoLoader::getEdgeCounts(std::vector
248247 unsigned> > &Counts) {
249248 if (EdgeCounts.empty()) {
250 std::cerr << "Edge counts not available, and no synthesis "
249 llvm_cerr << "Edge counts not available, and no synthesis "
251250 << "is implemented yet!\n";
252251 return;
253252 }
268267 //
269268 void ProfileInfoLoader::getBBTrace(std::vector &Trace) {
270269 if (BBTrace.empty ()) {
271 std::cerr << "Basic block trace is not available!\n";
272 return;
273 }
274 std::cerr << "Basic block trace loading is not implemented yet!\n";
275 }
276
270 llvm_cerr << "Basic block trace is not available!\n";
271 return;
272 }
273 llvm_cerr << "Basic block trace loading is not implemented yet!\n";
274 }
275
1818 #include "llvm/Analysis/ProfileInfo.h"
1919 #include "llvm/Analysis/ProfileInfoLoader.h"
2020 #include "llvm/Support/CommandLine.h"
21 #include
22
21 #include "llvm/Support/Streams.h"
2322 using namespace llvm;
2423
2524 namespace {
7675 TerminatorInst *TI = BB->getTerminator();
7776 if (SuccNum >= TI->getNumSuccessors()) {
7877 if (!PrintedWarning) {
79 std::cerr << "WARNING: profile information is inconsistent with "
78 llvm_cerr << "WARNING: profile information is inconsistent with "
8079 << "the current program!\n";
8180 PrintedWarning = true;
8281 }
7373 #include "llvm/Support/ConstantRange.h"
7474 #include "llvm/Support/InstIterator.h"
7575 #include "llvm/Support/ManagedStatic.h"
76 #include "llvm/Support/Streams.h"
7677 #include "llvm/ADT/Statistic.h"
77 #include <iostream>
78 #include <ostream>
7879 #include
7980 using namespace llvm;
8081
115116 //
116117 SCEV::~SCEV() {}
117118 void SCEV::dump() const {
118 print(std::cerr);
119 print(llvm_cerr);
119120 }
120121
121122 /// getValueRange - Return the tightest constant bounds that this value is
15521553 break;
15531554 default:
15541555 #if 0
1555 std::cerr << "ComputeIterationCount ";
1556 llvm_cerr << "ComputeIterationCount ";
15561557 if (ExitCond->getOperand(0)->getType()->isUnsigned())
1557 std::cerr << "[unsigned] ";
1558 std::cerr << *LHS << " "
1558 llvm_cerr << "[unsigned] ";
1559 llvm_cerr << *LHS << " "
15591560 << Instruction::getOpcodeName(Cond) << " " << *RHS << "\n";
15601561 #endif
15611562 break;
16721673 if (!isa(Result)) break; // Couldn't decide for sure
16731674 if (cast(Result)->getValue() == false) {
16741675 #if 0
1675 std::cerr << "\n***\n*** Computed loop count " << *ItCst
1676 llvm_cerr << "\n***\n*** Computed loop count " << *ItCst
16761677 << "\n*** From global " << *GV << "*** BB: " << *L->getHeader()
16771678 << "***\n";
16781679 #endif
21412142 SCEVConstant *R2 = dyn_cast(Roots.second);
21422143 if (R1) {
21432144 #if 0
2144 std::cerr << "HFTZ: " << *V << " - sol#1: " << *R1
2145 llvm_cerr << "HFTZ: " << *V << " - sol#1: " << *R1
21452146 << " sol#2: " << *R2 << "\n";
21462147 #endif
21472148 // Pick the smallest positive root value.
22702271 default: break;
22712272 }
22722273
2273 //std::cerr << "Computed Loop Trip Count as: " <<
2274 //llvm_cerr << "Computed Loop Trip Count as: " <<
22742275 // *SCEV::getMinusSCEV(RHS, AddRec->getOperand(0)) << "\n";
22752276 return SCEV::getMinusSCEV(RHS, AddRec->getOperand(0));
22762277 }
24862487 for (Loop::iterator I = L->begin(), E = L->end(); I != E; ++I)
24872488 PrintLoopInfo(OS, SE, *I);
24882489
2489 std::cerr << "Loop " << L->getHeader()->getName() << ": ";
2490 llvm_cerr << "Loop " << L->getHeader()->getName() << ": ";
24902491
24912492 std::vector ExitBlocks;
24922493 L->getExitBlocks(ExitBlocks);
24932494 if (ExitBlocks.size() != 1)
2494 std::cerr << " ";
2495 llvm_cerr << " ";
24952496
24962497 if (SE->hasLoopInvariantIterationCount(L)) {
2497 std::cerr << *SE->getIterationCount(L) << " iterations! ";
2498 llvm_cerr << *SE->getIterationCount(L) << " iterations! ";
24982499 } else {
2499 std::cerr << "Unpredictable iteration count. ";
2500 }
2501
2502 std::cerr << "\n";
2500 llvm_cerr << "Unpredictable iteration count. ";
2501 }
2502
2503 llvm_cerr << "\n";
25032504 }
25042505
25052506 void ScalarEvolution::print(std::ostream &OS, const Module* ) const {
1717 #include "llvm/Analysis/Trace.h"
1818 #include "llvm/Function.h"
1919 #include "llvm/Assembly/Writer.h"
20 #include
21
20 #include "llvm/Support/Streams.h"
2221 using namespace llvm;
2322
2423 Function *Trace::getFunction() const {
3231
3332 /// print - Write trace to output stream.
3433 ///
35 void Trace::print (std::ostream &O) const {
34 void Trace::print(llvm_ostream &O) const {
3635 Function *F = getFunction ();
37 O << "; Trace from function " << F->getName () << ", blocks:\n";
38 for (const_iterator i = begin (), e = end (); i != e; ++i) {
36 O << "; Trace from function " << F->getName() << ", blocks:\n";
37 for (const_iterator i = begin(), e = end(); i != e; ++i) {
3938 O << "; ";
40 WriteAsOperand (O, *i, true, true, getModule ());
39 if (O.stream())
40 WriteAsOperand(*O.stream(), *i, true, true, getModule());
4141 O << "\n";
4242 }
4343 O << "; Trace parent function: \n" << *F;
4646 /// dump - Debugger convenience method; writes trace to standard error
4747 /// output stream.
4848 ///
49 void Trace::dump () const {
50 print (std::cerr);
49 void Trace::dump() const {
50 print(llvm_cerr);
5151 }
2424 #include "llvm/Constants.h"
2525 #include "llvm/Instruction.h"
2626 #include "llvm/Type.h"
27 #include
28
27 #include "llvm/Support/Streams.h"
28 #include
2929 using namespace llvm;
3030
3131 static ConstantIntegral *Next(ConstantIntegral *CI) {
4848 assert(isa(C) && "Constant folding of integrals not impl??");
4949 return cast(C)->getValue();
5050 }
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
5177
5278 static bool GT(ConstantIntegral *A, ConstantIntegral *B) { return LT(B, A); }
5379
327353 /// dump - Allow printing from a debugger easily...
328354 ///
329355 void ConstantRange::dump() const {
330 print(std::cerr);
331 }
356 print(llvm_cerr);
357 }