mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 20:51:52 +01:00
Convert to using llvm streams instead of iostreams.
llvm-svn: 31989
This commit is contained in:
parent
5def3648f4
commit
2477c0ac3d
@ -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;
|
||||
}
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -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()
|
||||
|
@ -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
|
||||
|
@ -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";
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -21,10 +21,11 @@
|
||||
#include "llvm/Bytecode/Reader.h"
|
||||
#include "llvm/Assembly/PrintModulePass.h"
|
||||
#include "llvm/Support/CommandLine.h"
|
||||
#include "llvm/Support/Streams.h"
|
||||
#include "llvm/System/Signals.h"
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <memory>
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
static cl::opt<std::string>
|
||||
@ -47,11 +48,11 @@ int main(int argc, char **argv) {
|
||||
|
||||
std::auto_ptr<Module> M(ParseBytecodeFile(InputFilename, &ErrorMessage));
|
||||
if (M.get() == 0) {
|
||||
std::cerr << argv[0] << ": ";
|
||||
llvm_cerr << argv[0] << ": ";
|
||||
if (ErrorMessage.size())
|
||||
std::cerr << ErrorMessage << "\n";
|
||||
llvm_cerr << ErrorMessage << "\n";
|
||||
else
|
||||
std::cerr << "bytecode didn't read correctly.\n";
|
||||
llvm_cerr << "bytecode didn't read correctly.\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -59,7 +60,7 @@ int main(int argc, char **argv) {
|
||||
if (OutputFilename != "-") { // Not stdout?
|
||||
if (!Force && std::ifstream(OutputFilename.c_str())) {
|
||||
// If force is not specified, make sure not to overwrite a file!
|
||||
std::cerr << argv[0] << ": error opening '" << OutputFilename
|
||||
llvm_cerr << argv[0] << ": error opening '" << OutputFilename
|
||||
<< "': file exists! Sending to standard output.\n";
|
||||
} else {
|
||||
Out = new std::ofstream(OutputFilename.c_str());
|
||||
@ -80,7 +81,7 @@ int main(int argc, char **argv) {
|
||||
|
||||
if (!Force && std::ifstream(OutputFilename.c_str())) {
|
||||
// If force is not specified, make sure not to overwrite a file!
|
||||
std::cerr << argv[0] << ": error opening '" << OutputFilename
|
||||
llvm_cerr << argv[0] << ": error opening '" << OutputFilename
|
||||
<< "': file exists! Sending to standard output.\n";
|
||||
} else {
|
||||
Out = new std::ofstream(OutputFilename.c_str());
|
||||
@ -93,14 +94,15 @@ int main(int argc, char **argv) {
|
||||
}
|
||||
|
||||
if (!Out->good()) {
|
||||
std::cerr << argv[0] << ": error opening " << OutputFilename
|
||||
llvm_cerr << argv[0] << ": error opening " << OutputFilename
|
||||
<< ": sending to stdout instead!\n";
|
||||
Out = &std::cout;
|
||||
}
|
||||
|
||||
// All that llvm-dis does is write the assembly to a file.
|
||||
PassManager Passes;
|
||||
Passes.add(new PrintModulePass(Out));
|
||||
llvm_ostream L(*Out);
|
||||
Passes.add(new PrintModulePass(&L));
|
||||
Passes.run(*M.get());
|
||||
|
||||
if (Out != &std::cout) {
|
||||
@ -109,9 +111,9 @@ int main(int argc, char **argv) {
|
||||
}
|
||||
return 0;
|
||||
} catch (const std::string& msg) {
|
||||
std::cerr << argv[0] << ": " << msg << "\n";
|
||||
llvm_cerr << argv[0] << ": " << msg << "\n";
|
||||
} catch (...) {
|
||||
std::cerr << argv[0] << ": Unexpected unknown exception occurred.\n";
|
||||
llvm_cerr << argv[0] << ": Unexpected unknown exception occurred.\n";
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include "llvm/Support/PassNameParser.h"
|
||||
#include "llvm/System/Signals.h"
|
||||
#include "llvm/Support/PluginLoader.h"
|
||||
#include "llvm/Support/Streams.h"
|
||||
#include "llvm/Support/SystemUtils.h"
|
||||
#include "llvm/Support/Timer.h"
|
||||
#include "llvm/LinkAllPasses.h"
|
||||
@ -84,9 +85,9 @@ struct ModulePassPrinter : public ModulePass {
|
||||
|
||||
virtual bool runOnModule(Module &M) {
|
||||
if (!Quiet) {
|
||||
std::cout << "Printing analysis '" << PassToPrint->getPassName()
|
||||
llvm_cout << "Printing analysis '" << PassToPrint->getPassName()
|
||||
<< "':\n";
|
||||
getAnalysisID<Pass>(PassToPrint).print(std::cout, &M);
|
||||
getAnalysisID<Pass>(PassToPrint).print(llvm_cout, &M);
|
||||
}
|
||||
|
||||
// Get and print pass...
|
||||
@ -107,11 +108,11 @@ struct FunctionPassPrinter : public FunctionPass {
|
||||
|
||||
virtual bool runOnFunction(Function &F) {
|
||||
if (!Quiet) {
|
||||
std::cout << "Printing analysis '" << PassToPrint->getPassName()
|
||||
llvm_cout << "Printing analysis '" << PassToPrint->getPassName()
|
||||
<< "' for function '" << F.getName() << "':\n";
|
||||
}
|
||||
// Get and print pass...
|
||||
getAnalysisID<Pass>(PassToPrint).print(std::cout, F.getParent());
|
||||
getAnalysisID<Pass>(PassToPrint).print(llvm_cout, F.getParent());
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -129,13 +130,13 @@ struct BasicBlockPassPrinter : public BasicBlockPass {
|
||||
|
||||
virtual bool runOnBasicBlock(BasicBlock &BB) {
|
||||
if (!Quiet) {
|
||||
std::cout << "Printing Analysis info for BasicBlock '" << BB.getName()
|
||||
llvm_cout << "Printing Analysis info for BasicBlock '" << BB.getName()
|
||||
<< "': Pass " << PassToPrint->getPassName() << ":\n";
|
||||
}
|
||||
|
||||
// Get and print pass...
|
||||
getAnalysisID<Pass>(PassToPrint).print(
|
||||
std::cout, BB.getParent()->getParent());
|
||||
llvm_cout, BB.getParent()->getParent());
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -168,11 +169,11 @@ int main(int argc, char **argv) {
|
||||
// Load the input module...
|
||||
std::auto_ptr<Module> M(ParseBytecodeFile(InputFilename, &ErrorMessage));
|
||||
if (M.get() == 0) {
|
||||
std::cerr << argv[0] << ": ";
|
||||
llvm_cerr << argv[0] << ": ";
|
||||
if (ErrorMessage.size())
|
||||
std::cerr << ErrorMessage << "\n";
|
||||
llvm_cerr << ErrorMessage << "\n";
|
||||
else
|
||||
std::cerr << "bytecode didn't read correctly.\n";
|
||||
llvm_cerr << "bytecode didn't read correctly.\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -182,7 +183,7 @@ int main(int argc, char **argv) {
|
||||
if (OutputFilename != "-") {
|
||||
if (!Force && std::ifstream(OutputFilename.c_str())) {
|
||||
// If force is not specified, make sure not to overwrite a file!
|
||||
std::cerr << argv[0] << ": error opening '" << OutputFilename
|
||||
llvm_cerr << argv[0] << ": error opening '" << OutputFilename
|
||||
<< "': file exists!\n"
|
||||
<< "Use -f command line argument to force output\n";
|
||||
return 1;
|
||||
@ -192,7 +193,7 @@ int main(int argc, char **argv) {
|
||||
Out = new std::ofstream(OutputFilename.c_str(), io_mode);
|
||||
|
||||
if (!Out->good()) {
|
||||
std::cerr << argv[0] << ": error opening " << OutputFilename << "!\n";
|
||||
llvm_cerr << argv[0] << ": error opening " << OutputFilename << "!\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -226,7 +227,7 @@ int main(int argc, char **argv) {
|
||||
assert(target.get() && "Could not allocate target machine!");
|
||||
P = PassInf->getTargetCtor()(*target.get());
|
||||
} else
|
||||
std::cerr << argv[0] << ": cannot create pass: "
|
||||
llvm_cerr << argv[0] << ": cannot create pass: "
|
||||
<< PassInf->getPassName() << "\n";
|
||||
if (P) {
|
||||
Passes.add(P);
|
||||
@ -242,7 +243,7 @@ int main(int argc, char **argv) {
|
||||
}
|
||||
|
||||
if (PrintEachXForm)
|
||||
Passes.add(new PrintModulePass(&std::cerr));
|
||||
Passes.add(new PrintModulePass(&llvm_cerr));
|
||||
}
|
||||
|
||||
// Check that the module is well formed on completion of optimization
|
||||
@ -259,9 +260,9 @@ int main(int argc, char **argv) {
|
||||
return 0;
|
||||
|
||||
} catch (const std::string& msg) {
|
||||
std::cerr << argv[0] << ": " << msg << "\n";
|
||||
llvm_cerr << argv[0] << ": " << msg << "\n";
|
||||
} catch (...) {
|
||||
std::cerr << argv[0] << ": Unexpected unknown exception occurred.\n";
|
||||
llvm_cerr << argv[0] << ": Unexpected unknown exception occurred.\n";
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user