mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 19:23:23 +01:00
Removed #include <iostream> and used the llvm_cerr/DOUT streams instead.
llvm-svn: 31922
This commit is contained in:
parent
02b497f15a
commit
f2fadcee85
@ -19,7 +19,6 @@
|
||||
#include "llvm/ADT/STLExtras.h"
|
||||
#include "llvm/Support/Debug.h"
|
||||
#include <algorithm>
|
||||
#include <iostream>
|
||||
using namespace llvm;
|
||||
|
||||
static bool OperandConvertibleToType(User *U, Value *V, const Type *Ty,
|
||||
@ -205,7 +204,7 @@ Value *llvm::ConvertExpressionToType(Value *V, const Type *Ty,
|
||||
return VMCI->second;
|
||||
}
|
||||
|
||||
DEBUG(std::cerr << "CETT: " << (void*)V << " " << *V);
|
||||
DOUT << "CETT: " << (void*)V << " " << *V;
|
||||
|
||||
Instruction *I = dyn_cast<Instruction>(V);
|
||||
if (I == 0) {
|
||||
@ -384,8 +383,8 @@ Value *llvm::ConvertExpressionToType(Value *V, const Type *Ty,
|
||||
if (NumUses == OldSize) ++It;
|
||||
}
|
||||
|
||||
DEBUG(std::cerr << "ExpIn: " << (void*)I << " " << *I
|
||||
<< "ExpOut: " << (void*)Res << " " << *Res);
|
||||
DOUT << "ExpIn: " << (void*)I << " " << *I
|
||||
<< "ExpOut: " << (void*)Res << " " << *Res;
|
||||
|
||||
return Res;
|
||||
}
|
||||
@ -708,7 +707,7 @@ static void ConvertOperandToType(User *U, Value *OldVal, Value *NewVal,
|
||||
I->setName("");
|
||||
Instruction *Res; // Result of conversion
|
||||
|
||||
//std::cerr << endl << endl << "Type:\t" << Ty << "\nInst: " << I
|
||||
//llvm_cerr << endl << endl << "Type:\t" << Ty << "\nInst: " << I
|
||||
// << "BB Before: " << BB << endl;
|
||||
|
||||
// Prevent I from being removed...
|
||||
@ -930,9 +929,9 @@ static void ConvertOperandToType(User *U, Value *OldVal, Value *NewVal,
|
||||
assert(It != BB->end() && "Instruction not in own basic block??");
|
||||
BB->getInstList().insert(It, Res); // Keep It pointing to old instruction
|
||||
|
||||
DEBUG(std::cerr << "COT CREATED: " << (void*)Res << " " << *Res
|
||||
<< "In: " << (void*)I << " " << *I << "Out: " << (void*)Res
|
||||
<< " " << *Res);
|
||||
DOUT << "COT CREATED: " << (void*)Res << " " << *Res
|
||||
<< "In: " << (void*)I << " " << *I << "Out: " << (void*)Res
|
||||
<< " " << *Res;
|
||||
|
||||
// Add the instruction to the expression map
|
||||
VMC.ExprMap[I] = Res;
|
||||
@ -955,13 +954,13 @@ static void ConvertOperandToType(User *U, Value *OldVal, Value *NewVal,
|
||||
|
||||
ValueHandle::ValueHandle(ValueMapCache &VMC, Value *V)
|
||||
: Instruction(Type::VoidTy, UserOp1, &Op, 1, ""), Op(V, this), Cache(VMC) {
|
||||
//DEBUG(std::cerr << "VH AQUIRING: " << (void*)V << " " << V);
|
||||
//DOUT << "VH AQUIRING: " << (void*)V << " " << V;
|
||||
}
|
||||
|
||||
ValueHandle::ValueHandle(const ValueHandle &VH)
|
||||
: Instruction(Type::VoidTy, UserOp1, &Op, 1, ""),
|
||||
Op(VH.Op, this), Cache(VH.Cache) {
|
||||
//DEBUG(std::cerr << "VH AQUIRING: " << (void*)V << " " << V);
|
||||
//DOUT << "VH AQUIRING: " << (void*)V << " " << V;
|
||||
}
|
||||
|
||||
static void RecursiveDelete(ValueMapCache &Cache, Instruction *I) {
|
||||
@ -969,7 +968,7 @@ static void RecursiveDelete(ValueMapCache &Cache, Instruction *I) {
|
||||
|
||||
assert(I->getParent() && "Inst not in basic block!");
|
||||
|
||||
//DEBUG(std::cerr << "VH DELETING: " << (void*)I << " " << I);
|
||||
//DOUT << "VH DELETING: " << (void*)I << " " << I;
|
||||
|
||||
for (User::op_iterator OI = I->op_begin(), OE = I->op_end();
|
||||
OI != OE; ++OI)
|
||||
@ -996,8 +995,7 @@ ValueHandle::~ValueHandle() {
|
||||
//
|
||||
RecursiveDelete(Cache, dyn_cast<Instruction>(V));
|
||||
} else {
|
||||
//DEBUG(std::cerr << "VH RELEASING: " << (void*)Operands[0].get() << " "
|
||||
// << Operands[0]->getNumUses() << " " << Operands[0]);
|
||||
//DOUT << "VH RELEASING: " << (void*)Operands[0].get() << " "
|
||||
// << Operands[0]->getNumUses() << " " << Operands[0];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -16,8 +16,8 @@
|
||||
#include "llvm/Function.h"
|
||||
#include "llvm/ADT/StringExtras.h"
|
||||
#include "llvm/Support/SlowOperationInformer.h"
|
||||
#include "llvm/Support/Streams.h"
|
||||
#include "llvm/ADT/Statistic.h"
|
||||
#include <iostream>
|
||||
using namespace llvm;
|
||||
|
||||
namespace {
|
||||
@ -30,7 +30,7 @@ namespace {
|
||||
HelloCounter++;
|
||||
std::string fname = F.getName();
|
||||
EscapeString(fname);
|
||||
std::cerr << "Hello: " << fname << "\n";
|
||||
llvm_cerr << "Hello: " << fname << "\n";
|
||||
return false;
|
||||
}
|
||||
};
|
||||
@ -43,7 +43,7 @@ namespace {
|
||||
HelloCounter++;
|
||||
std::string fname = F.getName();
|
||||
EscapeString(fname);
|
||||
std::cerr << "Hello: " << fname << "\n";
|
||||
llvm_cerr << "Hello: " << fname << "\n";
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -23,11 +23,10 @@
|
||||
#include "llvm/DerivedTypes.h"
|
||||
#include "llvm/Module.h"
|
||||
#include "llvm/Pass.h"
|
||||
#include "llvm/Support/Streams.h"
|
||||
#include "llvm/Transforms/Instrumentation.h"
|
||||
#include "RSProfiling.h"
|
||||
#include "ProfilingUtils.h"
|
||||
#include <iostream>
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
namespace {
|
||||
@ -48,7 +47,7 @@ ModulePass *llvm::createFunctionProfilerPass() {
|
||||
bool FunctionProfiler::runOnModule(Module &M) {
|
||||
Function *Main = M.getMainFunction();
|
||||
if (Main == 0) {
|
||||
std::cerr << "WARNING: cannot insert function profiling into a module"
|
||||
llvm_cerr << "WARNING: cannot insert function profiling into a module"
|
||||
<< " with no main function!\n";
|
||||
return false; // No main, no instrumentation!
|
||||
}
|
||||
@ -91,7 +90,7 @@ ModulePass *llvm::createBlockProfilerPass() { return new BlockProfiler(); }
|
||||
bool BlockProfiler::runOnModule(Module &M) {
|
||||
Function *Main = M.getMainFunction();
|
||||
if (Main == 0) {
|
||||
std::cerr << "WARNING: cannot insert block profiling into a module"
|
||||
llvm_cerr << "WARNING: cannot insert block profiling into a module"
|
||||
<< " with no main function!\n";
|
||||
return false; // No main, no instrumentation!
|
||||
}
|
||||
|
@ -21,10 +21,10 @@
|
||||
#include "llvm/DerivedTypes.h"
|
||||
#include "llvm/Module.h"
|
||||
#include "llvm/Pass.h"
|
||||
#include "llvm/Support/Streams.h"
|
||||
#include "llvm/Transforms/Utils/BasicBlockUtils.h"
|
||||
#include "llvm/Transforms/Instrumentation.h"
|
||||
#include "ProfilingUtils.h"
|
||||
#include <iostream>
|
||||
#include <set>
|
||||
using namespace llvm;
|
||||
|
||||
@ -42,7 +42,7 @@ ModulePass *llvm::createEdgeProfilerPass() { return new EdgeProfiler(); }
|
||||
bool EdgeProfiler::runOnModule(Module &M) {
|
||||
Function *Main = M.getMainFunction();
|
||||
if (Main == 0) {
|
||||
std::cerr << "WARNING: cannot insert edge profiling into a module"
|
||||
llvm_cerr << "WARNING: cannot insert edge profiling into a module"
|
||||
<< " with no main function!\n";
|
||||
return false; // No main, no instrumentation!
|
||||
}
|
||||
|
@ -45,13 +45,10 @@
|
||||
#include "llvm/Transforms/Instrumentation.h"
|
||||
//#include "ProfilingUtils.h"
|
||||
#include "RSProfiling.h"
|
||||
|
||||
#include <set>
|
||||
#include <map>
|
||||
#include <queue>
|
||||
#include <list>
|
||||
#include <iostream>
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
namespace {
|
||||
@ -628,7 +625,7 @@ static void getBackEdges(Function& F, T& BackEdges) {
|
||||
std::map<BasicBlock*, int> finish;
|
||||
int time = 0;
|
||||
recBackEdge(&F.getEntryBlock(), BackEdges, color, depth, finish, time);
|
||||
DEBUG(std::cerr << F.getName() << " " << BackEdges.size() << "\n");
|
||||
DOUT << F.getName() << " " << BackEdges.size() << "\n";
|
||||
}
|
||||
|
||||
|
||||
|
@ -23,7 +23,6 @@
|
||||
#include "ProfilingUtils.h"
|
||||
#include "llvm/Support/Debug.h"
|
||||
#include <set>
|
||||
#include <iostream>
|
||||
using namespace llvm;
|
||||
|
||||
namespace {
|
||||
@ -43,8 +42,8 @@ ModulePass *llvm::createTraceBasicBlockPass()
|
||||
static void InsertInstrumentationCall (BasicBlock *BB,
|
||||
const std::string FnName,
|
||||
unsigned BBNumber) {
|
||||
DEBUG (std::cerr << "InsertInstrumentationCall (\"" << BB->getName ()
|
||||
<< "\", \"" << FnName << "\", " << BBNumber << ")\n");
|
||||
DOUT << "InsertInstrumentationCall (\"" << BB->getName ()
|
||||
<< "\", \"" << FnName << "\", " << BBNumber << ")\n";
|
||||
Module &M = *BB->getParent ()->getParent ();
|
||||
Function *InstrFn = M.getOrInsertFunction (FnName, Type::VoidTy,
|
||||
Type::UIntTy, (Type *)0);
|
||||
@ -62,7 +61,7 @@ static void InsertInstrumentationCall (BasicBlock *BB,
|
||||
bool TraceBasicBlocks::runOnModule(Module &M) {
|
||||
Function *Main = M.getMainFunction();
|
||||
if (Main == 0) {
|
||||
std::cerr << "WARNING: cannot insert basic-block trace instrumentation"
|
||||
llvm_cerr << "WARNING: cannot insert basic-block trace instrumentation"
|
||||
<< " into a module with no main function!\n";
|
||||
return false; // No main, no instrumentation!
|
||||
}
|
||||
|
@ -24,7 +24,6 @@
|
||||
#include "llvm/ADT/Statistic.h"
|
||||
#include "llvm/ADT/STLExtras.h"
|
||||
#include <algorithm>
|
||||
#include <iostream>
|
||||
using namespace llvm;
|
||||
|
||||
// StartInst - This enables the -raise-start-inst=foo option to cause the level
|
||||
@ -54,7 +53,7 @@ static Statistic<>
|
||||
NumVarargCallChanges("raise", "Number of vararg call peepholes");
|
||||
|
||||
#define PRINT_PEEPHOLE(ID, NUM, I) \
|
||||
DEBUG(std::cerr << "Inst P/H " << ID << "[" << NUM << "] " << I)
|
||||
DOUT << "Inst P/H " << ID << "[" << NUM << "] " << I
|
||||
|
||||
#define PRINT_PEEPHOLE1(ID, I1) do { PRINT_PEEPHOLE(ID, 0, I1); } while (0)
|
||||
#define PRINT_PEEPHOLE2(ID, I1, I2) \
|
||||
@ -140,7 +139,7 @@ bool RPR::PeepholeOptimize(BasicBlock *BB, BasicBlock::iterator &BI) {
|
||||
if (ExpressionConvertibleToType(Src, DestTy, ConvertedTypes, TD)) {
|
||||
PRINT_PEEPHOLE3("CAST-SRC-EXPR-CONV:in ", *Src, *CI, *BB->getParent());
|
||||
|
||||
DEBUG(std::cerr << "\nCONVERTING SRC EXPR TYPE:\n");
|
||||
DOUT << "\nCONVERTING SRC EXPR TYPE:\n";
|
||||
{ // ValueMap must be destroyed before function verified!
|
||||
ValueMapCache ValueMap;
|
||||
Value *E = ConvertExpressionToType(Src, DestTy, ValueMap, TD);
|
||||
@ -149,8 +148,8 @@ bool RPR::PeepholeOptimize(BasicBlock *BB, BasicBlock::iterator &BI) {
|
||||
CI->replaceAllUsesWith(CPV);
|
||||
|
||||
PRINT_PEEPHOLE1("CAST-SRC-EXPR-CONV:out", *E);
|
||||
DEBUG(std::cerr << "DONE CONVERTING SRC EXPR TYPE: \n"
|
||||
<< *BB->getParent());
|
||||
DOUT << "DONE CONVERTING SRC EXPR TYPE: \n"
|
||||
<< *BB->getParent();
|
||||
}
|
||||
|
||||
BI = BB->begin(); // Rescan basic block. BI might be invalidated.
|
||||
@ -168,15 +167,14 @@ bool RPR::PeepholeOptimize(BasicBlock *BB, BasicBlock::iterator &BI) {
|
||||
//PRINT_PEEPHOLE3("CAST-DEST-EXPR-CONV:in ", *Src, *CI,
|
||||
// *BB->getParent());
|
||||
|
||||
DEBUG(std::cerr << "\nCONVERTING EXPR TYPE:\n");
|
||||
DOUT << "\nCONVERTING EXPR TYPE:\n";
|
||||
{ // ValueMap must be destroyed before function verified!
|
||||
ValueMapCache ValueMap;
|
||||
ConvertValueToNewType(CI, Src, ValueMap, TD); // This will delete CI!
|
||||
}
|
||||
|
||||
PRINT_PEEPHOLE1("CAST-DEST-EXPR-CONV:out", *Src);
|
||||
DEBUG(std::cerr << "DONE CONVERTING EXPR TYPE: \n\n" <<
|
||||
*BB->getParent());
|
||||
DOUT << "DONE CONVERTING EXPR TYPE: \n\n" << *BB->getParent();
|
||||
|
||||
BI = BB->begin(); // Rescan basic block. BI might be invalidated.
|
||||
++NumExprTreesConv;
|
||||
@ -402,11 +400,11 @@ bool RPR::DoRaisePass(Function &F) {
|
||||
bool Changed = false;
|
||||
for (Function::iterator BB = F.begin(), BBE = F.end(); BB != BBE; ++BB)
|
||||
for (BasicBlock::iterator BI = BB->begin(); BI != BB->end();) {
|
||||
DEBUG(std::cerr << "LevelRaising: " << *BI);
|
||||
DOUT << "LevelRaising: " << *BI;
|
||||
if (dceInstruction(BI) || doConstantPropagation(BI)) {
|
||||
Changed = true;
|
||||
++NumDCEorCP;
|
||||
DEBUG(std::cerr << "***\t\t^^-- Dead code eliminated!\n");
|
||||
DOUT << "***\t\t^^-- Dead code eliminated!\n";
|
||||
} else if (PeepholeOptimize(BB, BI)) {
|
||||
Changed = true;
|
||||
} else {
|
||||
@ -420,8 +418,7 @@ bool RPR::DoRaisePass(Function &F) {
|
||||
|
||||
// runOnFunction - Raise a function representation to a higher level.
|
||||
bool RPR::runOnFunction(Function &F) {
|
||||
DEBUG(std::cerr << "\n\n\nStarting to work on Function '" << F.getName()
|
||||
<< "'\n");
|
||||
DOUT << "\n\n\nStarting to work on Function '" << F.getName() << "'\n";
|
||||
|
||||
// Insert casts for all incoming pointer pointer values that are treated as
|
||||
// arrays...
|
||||
@ -443,7 +440,7 @@ bool RPR::runOnFunction(Function &F) {
|
||||
}
|
||||
|
||||
do {
|
||||
DEBUG(std::cerr << "Looping: \n" << F);
|
||||
DOUT << "Looping: \n" << F;
|
||||
|
||||
// Iterate over the function, refining it, until it converges on a stable
|
||||
// state
|
||||
|
Loading…
Reference in New Issue
Block a user