Convert to using llvm streams instead of iostreams.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31989 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Bill Wendling
2006-11-28 23:33:06 +00:00
parent d96662360f
commit a5b31ca856
9 changed files with 64 additions and 61 deletions

View File

@@ -745,7 +745,7 @@ BasicAliasAnalysis::CheckGEPInstructions(
assert(Offset1<Offset2 && "There is at least one different constant here!");
if ((uint64_t)(Offset2-Offset1) >= SizeMax) {
//std::cerr << "Determined that these two GEP's don't alias ["
//llvm_cerr << "Determined that these two GEP's don't alias ["
// << SizeMax << " bytes]: \n" << *GEP1 << *GEP2;
return NoAlias;
}

View File

@@ -13,6 +13,7 @@
// applications like alias analysis.
//
//===----------------------------------------------------------------------===//
#define DEBUG_TYPE "bu_dsa"
#include "llvm/Analysis/DataStructure/DataStructure.h"
#include "llvm/Analysis/DataStructure/DSGraph.h"
@@ -22,7 +23,6 @@
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/Timer.h"
#include <iostream>
using namespace llvm;
namespace {
@@ -501,7 +501,7 @@ DSGraph &BUDataStructures::CreateGraphForExternalFunction(const Function &Fn) {
DSG->getNodeForValue(F->arg_begin()).mergeWith(N);
} else {
std::cerr << "Unrecognized external function: " << F->getName() << "\n";
llvm_cerr << "Unrecognized external function: " << F->getName() << "\n";
abort();
}
@@ -588,21 +588,21 @@ void BUDataStructures::calculateGraph(DSGraph &Graph) {
++NumBUInlines;
} else {
if (!Printed)
std::cerr << "In Fns: " << Graph.getFunctionNames() << "\n";
std::cerr << " calls " << CalledFuncs.size()
llvm_cerr << "In Fns: " << Graph.getFunctionNames() << "\n";
llvm_cerr << " calls " << CalledFuncs.size()
<< " fns from site: " << CS.getCallSite().getInstruction()
<< " " << *CS.getCallSite().getInstruction();
std::cerr << " Fns =";
llvm_cerr << " Fns =";
unsigned NumPrinted = 0;
for (std::vector<Function*>::iterator I = CalledFuncs.begin(),
E = CalledFuncs.end(); I != E; ++I) {
if (NumPrinted++ < 8) std::cerr << " " << (*I)->getName();
if (NumPrinted++ < 8) llvm_cerr << " " << (*I)->getName();
// Add the call edges to the call graph.
ActualCallees.insert(std::make_pair(TheCall, *I));
}
std::cerr << "\n";
llvm_cerr << "\n";
// See if we already computed a graph for this set of callees.
std::sort(CalledFuncs.begin(), CalledFuncs.end());
@@ -645,7 +645,7 @@ void BUDataStructures::calculateGraph(DSGraph &Graph) {
// Clean up the final graph!
GI->removeDeadNodes(DSGraph::KeepUnreachableGlobals);
} else {
std::cerr << "***\n*** RECYCLED GRAPH ***\n***\n";
llvm_cerr << "***\n*** RECYCLED GRAPH ***\n***\n";
}
GI = IndCallGraph.first;
@@ -685,7 +685,7 @@ void BUDataStructures::calculateGraph(DSGraph &Graph) {
E = MainSM.global_end(); I != E; ++I)
RC.getClonedNH(MainSM[*I]);
//Graph.writeGraphToFile(std::cerr, "bu_" + F.getName());
//Graph.writeGraphToFile(llvm_cerr, "bu_" + F.getName());
}
static const Function *getFnForValue(const Value *V) {
@@ -746,8 +746,8 @@ void BUDataStructures::copyValue(Value *From, Value *To) {
return;
}
std::cerr << *From;
std::cerr << *To;
llvm_cerr << *From;
llvm_cerr << *To;
assert(0 && "Do not know how to copy this yet!");
abort();
}

View File

@@ -23,9 +23,9 @@
#include "llvm/Analysis/DataStructure/DSGraph.h"
#include "llvm/Analysis/DataStructure/CallTargets.h"
#include "llvm/ADT/Statistic.h"
#include <iostream>
#include "llvm/Support/Streams.h"
#include <ostream>
#include "llvm/Constants.h"
using namespace llvm;
namespace {
@@ -58,7 +58,7 @@ void CallTargetFinder::findIndTargets(Module &M)
}
if (N->isComplete() && !IndMap[cs].size()) {
++CompleteEmpty;
std::cerr << "Call site empty: '"
llvm_cerr << "Call site empty: '"
<< cs.getInstruction()->getName()
<< "' In '"
<< cs.getInstruction()->getParent()->getParent()->getName()

View File

@@ -25,6 +25,7 @@
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SCCIterator.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/Support/Streams.h"
#include "llvm/Support/Timer.h"
#include <iostream>
#include <algorithm>
@@ -1262,7 +1263,7 @@ DSGraph::~DSGraph() {
}
// dump - Allow inspection of graph in a debugger.
void DSGraph::dump() const { print(std::cerr); }
void DSGraph::dump() const { print(llvm_cerr); }
/// remapLinks - Change all of the Links in the current node according to the

View File

@@ -17,8 +17,9 @@
#include "llvm/Instructions.h"
#include "llvm/Pass.h"
#include "llvm/Support/InstVisitor.h"
#include "llvm/Support/Streams.h"
#include "llvm/ADT/Statistic.h"
#include <iostream>
#include <ostream>
using namespace llvm;
namespace {
@@ -91,7 +92,7 @@ void DSGraphStats::countCallees(const Function& F) {
totalNumCallees += Callees.size();
++numIndirectCalls;
} else
std::cerr << "WARNING: No callee in Function '" << F.getName()
llvm_cerr << "WARNING: No callee in Function '" << F.getName()
<< "' at call: \n"
<< *I->getCallSite().getInstruction();
}
@@ -100,7 +101,7 @@ void DSGraphStats::countCallees(const Function& F) {
NumIndirectCalls += numIndirectCalls;
if (numIndirectCalls)
std::cout << " In function " << F.getName() << ": "
llvm_cout << " In function " << F.getName() << ": "
<< (totalNumCallees / (double) numIndirectCalls)
<< " average callees per indirect call\n";
}

View File

@@ -26,7 +26,6 @@
#include "llvm/ADT/Statistic.h"
#include "llvm/ADT/EquivalenceClasses.h"
#include "llvm/ADT/STLExtras.h"
#include <iostream>
using namespace llvm;
namespace {
@@ -91,7 +90,7 @@ bool EquivClassGraphs::runOnModule(Module &M) {
if (MainFunc && !MainFunc->isExternal()) {
processSCC(getOrCreateGraph(*MainFunc), Stack, NextID, ValMap);
} else {
std::cerr << "Fold Graphs: No 'main' function found!\n";
llvm_cerr << "Fold Graphs: No 'main' function found!\n";
}
for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I)
@@ -173,8 +172,8 @@ void EquivClassGraphs::buildIndirectFunctionSets(Module &M) {
FuncECs.insert(I->second); // -- Make sure function has equiv class
FirstFunc = I->second; // -- First callee at this site
} else { // Else indirect call
// DEBUG(std::cerr << "CALLEE: " << I->second->getName()
// << " from : " << I->first);
// DOUT << "CALLEE: " << I->second->getName()
// << " from : " << I->first;
if (I->first != LastInst) {
// This is the first callee from this call site.
LastInst = I->first;

View File

@@ -26,10 +26,9 @@
#include "llvm/Analysis/DataStructure/DataStructure.h"
#include "llvm/Analysis/DataStructure/DSGraph.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Streams.h"
#include "llvm/Value.h"
#include <iostream>
#include <set>
using namespace llvm;
namespace {
@@ -85,7 +84,7 @@ FunctionPass *llvm::createDataStructureGraphCheckerPass() {
DSGC::DSGC() {
if (!AbortIfAnyCollapsed && AbortIfCollapsed.empty() &&
CheckFlags.empty() && AbortIfMerged.empty()) {
std::cerr << "The -datastructure-gc is useless if you don't specify any"
llvm_cerr << "The -datastructure-gc is useless if you don't specify any"
" -dsgc-* options. See the -help-hidden output for a list.\n";
abort();
}
@@ -124,8 +123,8 @@ void DSGC::verify(const DSGraph &G) {
for (DSGraph::node_const_iterator I = G.node_begin(), E = G.node_end();
I != E; ++I)
if (I->isNodeCompletelyFolded()) {
std::cerr << "Node is collapsed: ";
I->print(std::cerr, &G);
llvm_cerr << "Node is collapsed: ";
I->print(llvm_cerr, &G);
abort();
}
}
@@ -143,7 +142,7 @@ void DSGC::verify(const DSGraph &G) {
E = CheckFlags.end(); I != E; ++I) {
std::string::size_type ColonPos = I->rfind(':');
if (ColonPos == std::string::npos) {
std::cerr << "Error: '" << *I
llvm_cerr << "Error: '" << *I
<< "' is an invalid value for the --dsgc-check-flags option!\n";
abort();
}
@@ -159,7 +158,7 @@ void DSGC::verify(const DSGraph &G) {
case 'M': Flags |= DSNode::Modified; break;
case 'R': Flags |= DSNode::Read; break;
case 'A': Flags |= DSNode::Array; break;
default: std::cerr << "Invalid DSNode flag!\n"; abort();
default: llvm_cerr << "Invalid DSNode flag!\n"; abort();
}
CheckFlagsM[std::string(I->begin(), I->begin()+ColonPos)] = Flags;
}
@@ -177,25 +176,25 @@ void DSGC::verify(const DSGraph &G) {
// Verify it is not collapsed if it is not supposed to be...
if (N->isNodeCompletelyFolded() && AbortIfCollapsedS.count(Name)) {
std::cerr << "Node for value '%" << Name << "' is collapsed: ";
N->print(std::cerr, &G);
llvm_cerr << "Node for value '%" << Name << "' is collapsed: ";
N->print(llvm_cerr, &G);
abort();
}
if (CheckFlagsM.count(Name) && CheckFlagsM[Name] != N->getNodeFlags()) {
std::cerr << "Node flags are not as expected for node: " << Name
llvm_cerr << "Node flags are not as expected for node: " << Name
<< " (" << CheckFlagsM[Name] << ":" <<N->getNodeFlags()
<< ")\n";
N->print(std::cerr, &G);
N->print(llvm_cerr, &G);
abort();
}
// Verify that it is not merged if it is not supposed to be...
if (AbortIfMergedS.count(Name)) {
if (AbortIfMergedNodes.count(N)) {
std::cerr << "Nodes for values '%" << Name << "' and '%"
llvm_cerr << "Nodes for values '%" << Name << "' and '%"
<< AbortIfMergedNodes[N] << "' is merged: ";
N->print(std::cerr, &G);
N->print(llvm_cerr, &G);
abort();
}
AbortIfMergedNodes[N] = Name;