remove a few DOUTs here and there.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79832 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2009-08-23 06:35:02 +00:00
parent 8142ce568d
commit bbbfa99d3d
19 changed files with 195 additions and 173 deletions

View File

@ -71,7 +71,7 @@ class scc_iterator
SCCNodeStack.push_back(N); SCCNodeStack.push_back(N);
MinVisitNumStack.push_back(visitNum); MinVisitNumStack.push_back(visitNum);
VisitStack.push_back(std::make_pair(N, GT::child_begin(N))); VisitStack.push_back(std::make_pair(N, GT::child_begin(N)));
//DOUT << "TarjanSCC: Node " << N << //errs() << "TarjanSCC: Node " << N <<
// " : visitNum = " << visitNum << "\n"; // " : visitNum = " << visitNum << "\n";
} }
@ -106,7 +106,7 @@ class scc_iterator
if (!MinVisitNumStack.empty() && MinVisitNumStack.back() > minVisitNum) if (!MinVisitNumStack.empty() && MinVisitNumStack.back() > minVisitNum)
MinVisitNumStack.back() = minVisitNum; MinVisitNumStack.back() = minVisitNum;
//DOUT << "TarjanSCC: Popped node " << visitingN << //errs() << "TarjanSCC: Popped node " << visitingN <<
// " : minVisitNum = " << minVisitNum << "; Node visit num = " << // " : minVisitNum = " << minVisitNum << "; Node visit num = " <<
// nodeVisitNumbers[visitingN] << "\n"; // nodeVisitNumbers[visitingN] << "\n";

View File

@ -1419,7 +1419,7 @@ void Andersens::ClumpAddressTaken() {
unsigned Pos = NewPos++; unsigned Pos = NewPos++;
Translate[i] = Pos; Translate[i] = Pos;
NewGraphNodes.push_back(GraphNodes[i]); NewGraphNodes.push_back(GraphNodes[i]);
DOUT << "Renumbering node " << i << " to node " << Pos << "\n"; DEBUG(errs() << "Renumbering node " << i << " to node " << Pos << "\n");
} }
// I believe this ends up being faster than making two vectors and splicing // I believe this ends up being faster than making two vectors and splicing
@ -1429,7 +1429,7 @@ void Andersens::ClumpAddressTaken() {
unsigned Pos = NewPos++; unsigned Pos = NewPos++;
Translate[i] = Pos; Translate[i] = Pos;
NewGraphNodes.push_back(GraphNodes[i]); NewGraphNodes.push_back(GraphNodes[i]);
DOUT << "Renumbering node " << i << " to node " << Pos << "\n"; DEBUG(errs() << "Renumbering node " << i << " to node " << Pos << "\n");
} }
} }
@ -1438,7 +1438,7 @@ void Andersens::ClumpAddressTaken() {
unsigned Pos = NewPos++; unsigned Pos = NewPos++;
Translate[i] = Pos; Translate[i] = Pos;
NewGraphNodes.push_back(GraphNodes[i]); NewGraphNodes.push_back(GraphNodes[i]);
DOUT << "Renumbering node " << i << " to node " << Pos << "\n"; DEBUG(errs() << "Renumbering node " << i << " to node " << Pos << "\n");
} }
} }
@ -1510,7 +1510,7 @@ void Andersens::ClumpAddressTaken() {
/// receive &D from E anyway. /// receive &D from E anyway.
void Andersens::HVN() { void Andersens::HVN() {
DOUT << "Beginning HVN\n"; DEBUG(errs() << "Beginning HVN\n");
// Build a predecessor graph. This is like our constraint graph with the // Build a predecessor graph. This is like our constraint graph with the
// edges going in the opposite direction, and there are edges for all the // edges going in the opposite direction, and there are edges for all the
// constraints, instead of just copy constraints. We also build implicit // constraints, instead of just copy constraints. We also build implicit
@ -1581,7 +1581,7 @@ void Andersens::HVN() {
Node2DFS.clear(); Node2DFS.clear();
Node2Deleted.clear(); Node2Deleted.clear();
Node2Visited.clear(); Node2Visited.clear();
DOUT << "Finished HVN\n"; DEBUG(errs() << "Finished HVN\n");
} }
@ -1705,7 +1705,7 @@ void Andersens::HVNValNum(unsigned NodeIndex) {
/// and is equivalent to value numbering the collapsed constraint graph /// and is equivalent to value numbering the collapsed constraint graph
/// including evaluating unions. /// including evaluating unions.
void Andersens::HU() { void Andersens::HU() {
DOUT << "Beginning HU\n"; DEBUG(errs() << "Beginning HU\n");
// Build a predecessor graph. This is like our constraint graph with the // Build a predecessor graph. This is like our constraint graph with the
// edges going in the opposite direction, and there are edges for all the // edges going in the opposite direction, and there are edges for all the
// constraints, instead of just copy constraints. We also build implicit // constraints, instead of just copy constraints. We also build implicit
@ -1785,7 +1785,7 @@ void Andersens::HU() {
} }
// PEClass nodes will be deleted by the deleting of N->PointsTo in our caller. // PEClass nodes will be deleted by the deleting of N->PointsTo in our caller.
Set2PEClass.clear(); Set2PEClass.clear();
DOUT << "Finished HU\n"; DEBUG(errs() << "Finished HU\n");
} }
@ -1963,12 +1963,12 @@ void Andersens::RewriteConstraints() {
// to anything. // to anything.
if (LHSLabel == 0) { if (LHSLabel == 0) {
DEBUG(PrintNode(&GraphNodes[LHSNode])); DEBUG(PrintNode(&GraphNodes[LHSNode]));
DOUT << " is a non-pointer, ignoring constraint.\n"; DEBUG(errs() << " is a non-pointer, ignoring constraint.\n");
continue; continue;
} }
if (RHSLabel == 0) { if (RHSLabel == 0) {
DEBUG(PrintNode(&GraphNodes[RHSNode])); DEBUG(PrintNode(&GraphNodes[RHSNode]));
DOUT << " is a non-pointer, ignoring constraint.\n"; DEBUG(errs() << " is a non-pointer, ignoring constraint.\n");
continue; continue;
} }
// This constraint may be useless, and it may become useless as we translate // This constraint may be useless, and it may become useless as we translate
@ -2016,19 +2016,19 @@ void Andersens::PrintLabels() const {
if (i < FirstRefNode) { if (i < FirstRefNode) {
PrintNode(&GraphNodes[i]); PrintNode(&GraphNodes[i]);
} else if (i < FirstAdrNode) { } else if (i < FirstAdrNode) {
DOUT << "REF("; DEBUG(errs() << "REF(");
PrintNode(&GraphNodes[i-FirstRefNode]); PrintNode(&GraphNodes[i-FirstRefNode]);
DOUT <<")"; DEBUG(errs() <<")");
} else { } else {
DOUT << "ADR("; DEBUG(errs() << "ADR(");
PrintNode(&GraphNodes[i-FirstAdrNode]); PrintNode(&GraphNodes[i-FirstAdrNode]);
DOUT <<")"; DEBUG(errs() <<")");
} }
DOUT << " has pointer label " << GraphNodes[i].PointerEquivLabel DEBUG(errs() << " has pointer label " << GraphNodes[i].PointerEquivLabel
<< " and SCC rep " << VSSCCRep[i] << " and SCC rep " << VSSCCRep[i]
<< " and is " << (GraphNodes[i].Direct ? "Direct" : "Not direct") << " and is " << (GraphNodes[i].Direct ? "Direct" : "Not direct")
<< "\n"; << "\n");
} }
} }
@ -2042,7 +2042,7 @@ void Andersens::PrintLabels() const {
/// operation are stored in SDT and are later used in SolveContraints() /// operation are stored in SDT and are later used in SolveContraints()
/// and UniteNodes(). /// and UniteNodes().
void Andersens::HCD() { void Andersens::HCD() {
DOUT << "Starting HCD.\n"; DEBUG(errs() << "Starting HCD.\n");
HCDSCCRep.resize(GraphNodes.size()); HCDSCCRep.resize(GraphNodes.size());
for (unsigned i = 0; i < GraphNodes.size(); ++i) { for (unsigned i = 0; i < GraphNodes.size(); ++i) {
@ -2091,7 +2091,7 @@ void Andersens::HCD() {
Node2Visited.clear(); Node2Visited.clear();
Node2Deleted.clear(); Node2Deleted.clear();
HCDSCCRep.clear(); HCDSCCRep.clear();
DOUT << "HCD complete.\n"; DEBUG(errs() << "HCD complete.\n");
} }
// Component of HCD: // Component of HCD:
@ -2163,7 +2163,7 @@ void Andersens::Search(unsigned Node) {
/// Optimize the constraints by performing offline variable substitution and /// Optimize the constraints by performing offline variable substitution and
/// other optimizations. /// other optimizations.
void Andersens::OptimizeConstraints() { void Andersens::OptimizeConstraints() {
DOUT << "Beginning constraint optimization\n"; DEBUG(errs() << "Beginning constraint optimization\n");
SDTActive = false; SDTActive = false;
@ -2247,7 +2247,7 @@ void Andersens::OptimizeConstraints() {
// HCD complete. // HCD complete.
DOUT << "Finished constraint optimization\n"; DEBUG(errs() << "Finished constraint optimization\n");
FirstRefNode = 0; FirstRefNode = 0;
FirstAdrNode = 0; FirstAdrNode = 0;
} }
@ -2255,7 +2255,7 @@ void Andersens::OptimizeConstraints() {
/// Unite pointer but not location equivalent variables, now that the constraint /// Unite pointer but not location equivalent variables, now that the constraint
/// graph is built. /// graph is built.
void Andersens::UnitePointerEquivalences() { void Andersens::UnitePointerEquivalences() {
DOUT << "Uniting remaining pointer equivalences\n"; DEBUG(errs() << "Uniting remaining pointer equivalences\n");
for (unsigned i = 0; i < GraphNodes.size(); ++i) { for (unsigned i = 0; i < GraphNodes.size(); ++i) {
if (GraphNodes[i].AddressTaken && GraphNodes[i].isRep()) { if (GraphNodes[i].AddressTaken && GraphNodes[i].isRep()) {
unsigned Label = GraphNodes[i].PointerEquivLabel; unsigned Label = GraphNodes[i].PointerEquivLabel;
@ -2264,7 +2264,7 @@ void Andersens::UnitePointerEquivalences() {
UniteNodes(i, PENLEClass2Node[Label]); UniteNodes(i, PENLEClass2Node[Label]);
} }
} }
DOUT << "Finished remaining pointer equivalences\n"; DEBUG(errs() << "Finished remaining pointer equivalences\n");
PENLEClass2Node.clear(); PENLEClass2Node.clear();
} }
@ -2420,7 +2420,7 @@ void Andersens::SolveConstraints() {
std::vector<unsigned int> RSV; std::vector<unsigned int> RSV;
#endif #endif
while( !CurrWL->empty() ) { while( !CurrWL->empty() ) {
DOUT << "Starting iteration #" << ++NumIters << "\n"; DEBUG(errs() << "Starting iteration #" << ++NumIters << "\n");
Node* CurrNode; Node* CurrNode;
unsigned CurrNodeIndex; unsigned CurrNodeIndex;
@ -2723,11 +2723,11 @@ unsigned Andersens::UniteNodes(unsigned First, unsigned Second,
SecondNode->OldPointsTo = NULL; SecondNode->OldPointsTo = NULL;
NumUnified++; NumUnified++;
DOUT << "Unified Node "; DEBUG(errs() << "Unified Node ");
DEBUG(PrintNode(FirstNode)); DEBUG(PrintNode(FirstNode));
DOUT << " and Node "; DEBUG(errs() << " and Node ");
DEBUG(PrintNode(SecondNode)); DEBUG(PrintNode(SecondNode));
DOUT << "\n"; DEBUG(errs() << "\n");
if (SDTActive) if (SDTActive)
if (SDT[Second] >= 0) { if (SDT[Second] >= 0) {

View File

@ -257,7 +257,7 @@ bool IVUsers::AddUsersIfInteresting(Instruction *I) {
const SCEV *NewStart = SE->getMinusSCEV(Start, Stride); const SCEV *NewStart = SE->getMinusSCEV(Start, Stride);
StrideUses->addUser(NewStart, User, I); StrideUses->addUser(NewStart, User, I);
StrideUses->Users.back().setIsUseOfPostIncrementedValue(true); StrideUses->Users.back().setIsUseOfPostIncrementedValue(true);
DOUT << " USING POSTINC SCEV, START=" << *NewStart<< "\n"; DEBUG(errs() << " USING POSTINC SCEV, START=" << *NewStart<< "\n");
} else { } else {
StrideUses->addUser(Start, User, I); StrideUses->addUser(Start, User, I);
} }

View File

@ -36,6 +36,7 @@
#include "llvm/Support/Debug.h" #include "llvm/Support/Debug.h"
#include "llvm/Support/ErrorHandling.h" #include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/MathExtras.h" #include "llvm/Support/MathExtras.h"
#include "llvm/Support/raw_ostream.h"
#include <algorithm> #include <algorithm>
#include <set> #include <set>
using namespace llvm; using namespace llvm;
@ -539,10 +540,12 @@ SDValue DAGCombiner::CombineTo(SDNode *N, const SDValue *To, unsigned NumTo,
bool AddTo) { bool AddTo) {
assert(N->getNumValues() == NumTo && "Broken CombineTo call!"); assert(N->getNumValues() == NumTo && "Broken CombineTo call!");
++NodesCombined; ++NodesCombined;
DOUT << "\nReplacing.1 "; DEBUG(N->dump(&DAG)); DEBUG(errs() << "\nReplacing.1 ";
DOUT << "\nWith: "; DEBUG(To[0].getNode()->dump(&DAG)); N->dump(&DAG);
DOUT << " and " << NumTo-1 << " other values\n"; errs() << "\nWith: ";
DEBUG(for (unsigned i = 0, e = NumTo; i != e; ++i) To[0].getNode()->dump(&DAG);
errs() << " and " << NumTo-1 << " other values\n";
for (unsigned i = 0, e = NumTo; i != e; ++i)
assert(N->getValueType(i) == To[i].getValueType() && assert(N->getValueType(i) == To[i].getValueType() &&
"Cannot combine value to value of different type!")); "Cannot combine value to value of different type!"));
WorkListRemover DeadNodes(*this); WorkListRemover DeadNodes(*this);
@ -614,9 +617,11 @@ bool DAGCombiner::SimplifyDemandedBits(SDValue Op, const APInt &Demanded) {
// Replace the old value with the new one. // Replace the old value with the new one.
++NodesCombined; ++NodesCombined;
DOUT << "\nReplacing.2 "; DEBUG(TLO.Old.getNode()->dump(&DAG)); DEBUG(errs() << "\nReplacing.2 ";
DOUT << "\nWith: "; DEBUG(TLO.New.getNode()->dump(&DAG)); TLO.Old.getNode()->dump(&DAG);
DOUT << '\n'; errs() << "\nWith: ";
TLO.New.getNode()->dump(&DAG);
errs() << '\n');
CommitTargetLoweringOpt(TLO); CommitTargetLoweringOpt(TLO);
return true; return true;
@ -682,9 +687,11 @@ void DAGCombiner::Run(CombineLevel AtLevel) {
RV.getNode()->getOpcode() != ISD::DELETED_NODE && RV.getNode()->getOpcode() != ISD::DELETED_NODE &&
"Node was deleted but visit returned new node!"); "Node was deleted but visit returned new node!");
DOUT << "\nReplacing.3 "; DEBUG(N->dump(&DAG)); DEBUG(errs() << "\nReplacing.3 ";
DOUT << "\nWith: "; DEBUG(RV.getNode()->dump(&DAG)); N->dump(&DAG);
DOUT << '\n'; errs() << "\nWith: ";
RV.getNode()->dump(&DAG);
errs() << '\n');
WorkListRemover DeadNodes(*this); WorkListRemover DeadNodes(*this);
if (N->getNumValues() == RV.getNode()->getNumValues()) if (N->getNumValues() == RV.getNode()->getNumValues())
DAG.ReplaceAllUsesWith(N, RV.getNode(), &DeadNodes); DAG.ReplaceAllUsesWith(N, RV.getNode(), &DeadNodes);
@ -4634,9 +4641,11 @@ bool DAGCombiner::CombineToPreIndexedLoadStore(SDNode *N) {
BasePtr, Offset, AM); BasePtr, Offset, AM);
++PreIndexedNodes; ++PreIndexedNodes;
++NodesCombined; ++NodesCombined;
DOUT << "\nReplacing.4 "; DEBUG(N->dump(&DAG)); DEBUG(errs() << "\nReplacing.4 ";
DOUT << "\nWith: "; DEBUG(Result.getNode()->dump(&DAG)); N->dump(&DAG);
DOUT << '\n'; errs() << "\nWith: ";
Result.getNode()->dump(&DAG);
errs() << '\n');
WorkListRemover DeadNodes(*this); WorkListRemover DeadNodes(*this);
if (isLoad) { if (isLoad) {
DAG.ReplaceAllUsesOfValueWith(SDValue(N, 0), Result.getValue(0), DAG.ReplaceAllUsesOfValueWith(SDValue(N, 0), Result.getValue(0),
@ -4766,9 +4775,11 @@ bool DAGCombiner::CombineToPostIndexedLoadStore(SDNode *N) {
BasePtr, Offset, AM); BasePtr, Offset, AM);
++PostIndexedNodes; ++PostIndexedNodes;
++NodesCombined; ++NodesCombined;
DOUT << "\nReplacing.5 "; DEBUG(N->dump(&DAG)); DEBUG(errs() << "\nReplacing.5 ";
DOUT << "\nWith: "; DEBUG(Result.getNode()->dump(&DAG)); N->dump(&DAG);
DOUT << '\n'; errs() << "\nWith: ";
Result.getNode()->dump(&DAG);
errs() << '\n');
WorkListRemover DeadNodes(*this); WorkListRemover DeadNodes(*this);
if (isLoad) { if (isLoad) {
DAG.ReplaceAllUsesOfValueWith(SDValue(N, 0), Result.getValue(0), DAG.ReplaceAllUsesOfValueWith(SDValue(N, 0), Result.getValue(0),
@ -4870,9 +4881,11 @@ SDValue DAGCombiner::visitLOAD(SDNode *N) {
// v3 = add v2, c // v3 = add v2, c
// Now we replace use of chain2 with chain1. This makes the second load // Now we replace use of chain2 with chain1. This makes the second load
// isomorphic to the one we are deleting, and thus makes this load live. // isomorphic to the one we are deleting, and thus makes this load live.
DOUT << "\nReplacing.6 "; DEBUG(N->dump(&DAG)); DEBUG(errs() << "\nReplacing.6 ";
DOUT << "\nWith chain: "; DEBUG(Chain.getNode()->dump(&DAG)); N->dump(&DAG);
DOUT << "\n"; errs() << "\nWith chain: ";
Chain.getNode()->dump(&DAG);
errs() << "\n");
WorkListRemover DeadNodes(*this); WorkListRemover DeadNodes(*this);
DAG.ReplaceAllUsesOfValueWith(SDValue(N, 1), Chain, &DeadNodes); DAG.ReplaceAllUsesOfValueWith(SDValue(N, 1), Chain, &DeadNodes);
@ -4888,9 +4901,11 @@ SDValue DAGCombiner::visitLOAD(SDNode *N) {
assert(N->getValueType(2) == MVT::Other && "Malformed indexed loads?"); assert(N->getValueType(2) == MVT::Other && "Malformed indexed loads?");
if (N->hasNUsesOfValue(0, 0) && N->hasNUsesOfValue(0, 1)) { if (N->hasNUsesOfValue(0, 0) && N->hasNUsesOfValue(0, 1)) {
SDValue Undef = DAG.getUNDEF(N->getValueType(0)); SDValue Undef = DAG.getUNDEF(N->getValueType(0));
DOUT << "\nReplacing.6 "; DEBUG(N->dump(&DAG)); DEBUG(errs() << "\nReplacing.6 ";
DOUT << "\nWith: "; DEBUG(Undef.getNode()->dump(&DAG)); N->dump(&DAG);
DOUT << " and 2 other values\n"; errs() << "\nWith: ";
Undef.getNode()->dump(&DAG);
errs() << " and 2 other values\n");
WorkListRemover DeadNodes(*this); WorkListRemover DeadNodes(*this);
DAG.ReplaceAllUsesOfValueWith(SDValue(N, 0), Undef, &DeadNodes); DAG.ReplaceAllUsesOfValueWith(SDValue(N, 0), Undef, &DeadNodes);
DAG.ReplaceAllUsesOfValueWith(SDValue(N, 1), DAG.ReplaceAllUsesOfValueWith(SDValue(N, 1),

View File

@ -25,6 +25,7 @@
#include "llvm/ADT/STLExtras.h" #include "llvm/ADT/STLExtras.h"
#include "llvm/Support/CommandLine.h" #include "llvm/Support/CommandLine.h"
#include "llvm/Support/ErrorHandling.h" #include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/raw_ostream.h"
using namespace llvm; using namespace llvm;
STATISTIC(NumUnfolds, "Number of nodes unfolded"); STATISTIC(NumUnfolds, "Number of nodes unfolded");
@ -109,7 +110,7 @@ private:
/// Schedule - Schedule the DAG using list scheduling. /// Schedule - Schedule the DAG using list scheduling.
void ScheduleDAGFast::Schedule() { void ScheduleDAGFast::Schedule() {
DOUT << "********** List Scheduling **********\n"; DEBUG(errs() << "********** List Scheduling **********\n");
NumLiveRegs = 0; NumLiveRegs = 0;
LiveRegDefs.resize(TRI->getNumRegs(), NULL); LiveRegDefs.resize(TRI->getNumRegs(), NULL);
@ -175,7 +176,7 @@ void ScheduleDAGFast::ReleasePredecessors(SUnit *SU, unsigned CurCycle) {
/// count of its predecessors. If a predecessor pending count is zero, add it to /// count of its predecessors. If a predecessor pending count is zero, add it to
/// the Available queue. /// the Available queue.
void ScheduleDAGFast::ScheduleNodeBottomUp(SUnit *SU, unsigned CurCycle) { void ScheduleDAGFast::ScheduleNodeBottomUp(SUnit *SU, unsigned CurCycle) {
DOUT << "*** Scheduling [" << CurCycle << "]: "; DEBUG(errs() << "*** Scheduling [" << CurCycle << "]: ");
DEBUG(SU->dump(this)); DEBUG(SU->dump(this));
assert(CurCycle >= SU->getHeight() && "Node scheduled below its height!"); assert(CurCycle >= SU->getHeight() && "Node scheduled below its height!");
@ -233,7 +234,7 @@ SUnit *ScheduleDAGFast::CopyAndMoveSuccessors(SUnit *SU) {
if (!TII->unfoldMemoryOperand(*DAG, N, NewNodes)) if (!TII->unfoldMemoryOperand(*DAG, N, NewNodes))
return NULL; return NULL;
DOUT << "Unfolding SU # " << SU->NodeNum << "\n"; DEBUG(errs() << "Unfolding SU # " << SU->NodeNum << "\n");
assert(NewNodes.size() == 2 && "Expected a load folding node!"); assert(NewNodes.size() == 2 && "Expected a load folding node!");
N = NewNodes[1]; N = NewNodes[1];
@ -343,7 +344,7 @@ SUnit *ScheduleDAGFast::CopyAndMoveSuccessors(SUnit *SU) {
SU = NewSU; SU = NewSU;
} }
DOUT << "Duplicating SU # " << SU->NodeNum << "\n"; DEBUG(errs() << "Duplicating SU # " << SU->NodeNum << "\n");
NewSU = Clone(SU); NewSU = Clone(SU);
// New SUnit has the exact same predecessors. // New SUnit has the exact same predecessors.
@ -550,16 +551,16 @@ void ScheduleDAGFast::ListScheduleBottomUp() {
// Issue copies, these can be expensive cross register class copies. // Issue copies, these can be expensive cross register class copies.
SmallVector<SUnit*, 2> Copies; SmallVector<SUnit*, 2> Copies;
InsertCopiesAndMoveSuccs(LRDef, Reg, DestRC, RC, Copies); InsertCopiesAndMoveSuccs(LRDef, Reg, DestRC, RC, Copies);
DOUT << "Adding an edge from SU # " << TrySU->NodeNum DEBUG(errs() << "Adding an edge from SU # " << TrySU->NodeNum
<< " to SU #" << Copies.front()->NodeNum << "\n"; << " to SU #" << Copies.front()->NodeNum << "\n");
AddPred(TrySU, SDep(Copies.front(), SDep::Order, /*Latency=*/1, AddPred(TrySU, SDep(Copies.front(), SDep::Order, /*Latency=*/1,
/*Reg=*/0, /*isNormalMemory=*/false, /*Reg=*/0, /*isNormalMemory=*/false,
/*isMustAlias=*/false, /*isArtificial=*/true)); /*isMustAlias=*/false, /*isArtificial=*/true));
NewDef = Copies.back(); NewDef = Copies.back();
} }
DOUT << "Adding an edge from SU # " << NewDef->NodeNum DEBUG(errs() << "Adding an edge from SU # " << NewDef->NodeNum
<< " to SU #" << TrySU->NodeNum << "\n"; << " to SU #" << TrySU->NodeNum << "\n");
LiveRegDefs[Reg] = NewDef; LiveRegDefs[Reg] = NewDef;
AddPred(NewDef, SDep(TrySU, SDep::Order, /*Latency=*/1, AddPred(NewDef, SDep(TrySU, SDep::Order, /*Latency=*/1,
/*Reg=*/0, /*isNormalMemory=*/false, /*Reg=*/0, /*isNormalMemory=*/false,

View File

@ -30,6 +30,7 @@
#include "llvm/Support/Debug.h" #include "llvm/Support/Debug.h"
#include "llvm/Support/Compiler.h" #include "llvm/Support/Compiler.h"
#include "llvm/Support/ErrorHandling.h" #include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/ADT/PriorityQueue.h" #include "llvm/ADT/PriorityQueue.h"
#include "llvm/ADT/Statistic.h" #include "llvm/ADT/Statistic.h"
#include <climits> #include <climits>
@ -87,7 +88,7 @@ private:
/// Schedule - Schedule the DAG using list scheduling. /// Schedule - Schedule the DAG using list scheduling.
void ScheduleDAGList::Schedule() { void ScheduleDAGList::Schedule() {
DOUT << "********** List Scheduling **********\n"; DEBUG(errs() << "********** List Scheduling **********\n");
// Build the scheduling graph. // Build the scheduling graph.
BuildSchedGraph(); BuildSchedGraph();
@ -141,7 +142,7 @@ void ScheduleDAGList::ReleaseSuccessors(SUnit *SU) {
/// count of its successors. If a successor pending count is zero, add it to /// count of its successors. If a successor pending count is zero, add it to
/// the Available queue. /// the Available queue.
void ScheduleDAGList::ScheduleNodeTopDown(SUnit *SU, unsigned CurCycle) { void ScheduleDAGList::ScheduleNodeTopDown(SUnit *SU, unsigned CurCycle) {
DOUT << "*** Scheduling [" << CurCycle << "]: "; DEBUG(errs() << "*** Scheduling [" << CurCycle << "]: ");
DEBUG(SU->dump(this)); DEBUG(SU->dump(this));
Sequence.push_back(SU); Sequence.push_back(SU);
@ -233,7 +234,7 @@ void ScheduleDAGList::ListScheduleTopDown() {
} else if (!HasNoopHazards) { } else if (!HasNoopHazards) {
// Otherwise, we have a pipeline stall, but no other problem, just advance // Otherwise, we have a pipeline stall, but no other problem, just advance
// the current cycle and try again. // the current cycle and try again.
DOUT << "*** Advancing cycle, no work to do\n"; DEBUG(errs() << "*** Advancing cycle, no work to do\n");
HazardRec->AdvanceCycle(); HazardRec->AdvanceCycle();
++NumStalls; ++NumStalls;
++CurCycle; ++CurCycle;
@ -241,7 +242,7 @@ void ScheduleDAGList::ListScheduleTopDown() {
// Otherwise, we have no instructions to issue and we have instructions // Otherwise, we have no instructions to issue and we have instructions
// that will fault if we don't do this right. This is the case for // that will fault if we don't do this right. This is the case for
// processors without pipeline interlocks and other cases. // processors without pipeline interlocks and other cases.
DOUT << "*** Emitting noop\n"; DEBUG(errs() << "*** Emitting noop\n");
HazardRec->EmitNoop(); HazardRec->EmitNoop();
Sequence.push_back(0); // NULL here means noop Sequence.push_back(0); // NULL here means noop
++NumNoops; ++NumNoops;

View File

@ -30,6 +30,7 @@
#include "llvm/ADT/SmallSet.h" #include "llvm/ADT/SmallSet.h"
#include "llvm/ADT/Statistic.h" #include "llvm/ADT/Statistic.h"
#include "llvm/ADT/STLExtras.h" #include "llvm/ADT/STLExtras.h"
#include "llvm/Support/raw_ostream.h"
#include <climits> #include <climits>
using namespace llvm; using namespace llvm;
@ -164,7 +165,7 @@ private:
/// Schedule - Schedule the DAG using list scheduling. /// Schedule - Schedule the DAG using list scheduling.
void ScheduleDAGRRList::Schedule() { void ScheduleDAGRRList::Schedule() {
DOUT << "********** List Scheduling **********\n"; DEBUG(errs() << "********** List Scheduling **********\n");
NumLiveRegs = 0; NumLiveRegs = 0;
LiveRegDefs.resize(TRI->getNumRegs(), NULL); LiveRegDefs.resize(TRI->getNumRegs(), NULL);
@ -238,7 +239,7 @@ void ScheduleDAGRRList::ReleasePredecessors(SUnit *SU, unsigned CurCycle) {
/// count of its predecessors. If a predecessor pending count is zero, add it to /// count of its predecessors. If a predecessor pending count is zero, add it to
/// the Available queue. /// the Available queue.
void ScheduleDAGRRList::ScheduleNodeBottomUp(SUnit *SU, unsigned CurCycle) { void ScheduleDAGRRList::ScheduleNodeBottomUp(SUnit *SU, unsigned CurCycle) {
DOUT << "*** Scheduling [" << CurCycle << "]: "; DEBUG(errs() << "*** Scheduling [" << CurCycle << "]: ");
DEBUG(SU->dump(this)); DEBUG(SU->dump(this));
assert(CurCycle >= SU->getHeight() && "Node scheduled below its height!"); assert(CurCycle >= SU->getHeight() && "Node scheduled below its height!");
@ -283,7 +284,7 @@ void ScheduleDAGRRList::CapturePred(SDep *PredEdge) {
/// UnscheduleNodeBottomUp - Remove the node from the schedule, update its and /// UnscheduleNodeBottomUp - Remove the node from the schedule, update its and
/// its predecessor states to reflect the change. /// its predecessor states to reflect the change.
void ScheduleDAGRRList::UnscheduleNodeBottomUp(SUnit *SU) { void ScheduleDAGRRList::UnscheduleNodeBottomUp(SUnit *SU) {
DOUT << "*** Unscheduling [" << SU->getHeight() << "]: "; DEBUG(errs() << "*** Unscheduling [" << SU->getHeight() << "]: ");
DEBUG(SU->dump(this)); DEBUG(SU->dump(this));
AvailableQueue->UnscheduledNode(SU); AvailableQueue->UnscheduledNode(SU);
@ -370,7 +371,7 @@ SUnit *ScheduleDAGRRList::CopyAndMoveSuccessors(SUnit *SU) {
if (!TII->unfoldMemoryOperand(*DAG, N, NewNodes)) if (!TII->unfoldMemoryOperand(*DAG, N, NewNodes))
return NULL; return NULL;
DOUT << "Unfolding SU # " << SU->NodeNum << "\n"; DEBUG(errs() << "Unfolding SU # " << SU->NodeNum << "\n");
assert(NewNodes.size() == 2 && "Expected a load folding node!"); assert(NewNodes.size() == 2 && "Expected a load folding node!");
N = NewNodes[1]; N = NewNodes[1];
@ -489,7 +490,7 @@ SUnit *ScheduleDAGRRList::CopyAndMoveSuccessors(SUnit *SU) {
SU = NewSU; SU = NewSU;
} }
DOUT << "Duplicating SU # " << SU->NodeNum << "\n"; DEBUG(errs() << "Duplicating SU # " << SU->NodeNum << "\n");
NewSU = CreateClone(SU); NewSU = CreateClone(SU);
// New SUnit has the exact same predecessors. // New SUnit has the exact same predecessors.
@ -770,8 +771,8 @@ void ScheduleDAGRRList::ListScheduleBottomUp() {
// Issue copies, these can be expensive cross register class copies. // Issue copies, these can be expensive cross register class copies.
SmallVector<SUnit*, 2> Copies; SmallVector<SUnit*, 2> Copies;
InsertCopiesAndMoveSuccs(LRDef, Reg, DestRC, RC, Copies); InsertCopiesAndMoveSuccs(LRDef, Reg, DestRC, RC, Copies);
DOUT << "Adding an edge from SU #" << TrySU->NodeNum DEBUG(errs() << "Adding an edge from SU #" << TrySU->NodeNum
<< " to SU #" << Copies.front()->NodeNum << "\n"; << " to SU #" << Copies.front()->NodeNum << "\n");
AddPred(TrySU, SDep(Copies.front(), SDep::Order, /*Latency=*/1, AddPred(TrySU, SDep(Copies.front(), SDep::Order, /*Latency=*/1,
/*Reg=*/0, /*isNormalMemory=*/false, /*Reg=*/0, /*isNormalMemory=*/false,
/*isMustAlias=*/false, /*isMustAlias=*/false,
@ -779,8 +780,8 @@ void ScheduleDAGRRList::ListScheduleBottomUp() {
NewDef = Copies.back(); NewDef = Copies.back();
} }
DOUT << "Adding an edge from SU #" << NewDef->NodeNum DEBUG(errs() << "Adding an edge from SU #" << NewDef->NodeNum
<< " to SU #" << TrySU->NodeNum << "\n"; << " to SU #" << TrySU->NodeNum << "\n");
LiveRegDefs[Reg] = NewDef; LiveRegDefs[Reg] = NewDef;
AddPred(NewDef, SDep(TrySU, SDep::Order, /*Latency=*/1, AddPred(NewDef, SDep(TrySU, SDep::Order, /*Latency=*/1,
/*Reg=*/0, /*isNormalMemory=*/false, /*Reg=*/0, /*isNormalMemory=*/false,
@ -857,7 +858,7 @@ void ScheduleDAGRRList::ReleaseSuccessors(SUnit *SU) {
/// count of its successors. If a successor pending count is zero, add it to /// count of its successors. If a successor pending count is zero, add it to
/// the Available queue. /// the Available queue.
void ScheduleDAGRRList::ScheduleNodeTopDown(SUnit *SU, unsigned CurCycle) { void ScheduleDAGRRList::ScheduleNodeTopDown(SUnit *SU, unsigned CurCycle) {
DOUT << "*** Scheduling [" << CurCycle << "]: "; DEBUG(errs() << "*** Scheduling [" << CurCycle << "]: ");
DEBUG(SU->dump(this)); DEBUG(SU->dump(this));
assert(CurCycle >= SU->getDepth() && "Node scheduled above its depth!"); assert(CurCycle >= SU->getDepth() && "Node scheduled above its depth!");
@ -1329,9 +1330,9 @@ void RegReductionPriorityQueue<SF>::PrescheduleNodesWithMultipleUses() {
// Ok, the transformation is safe and the heuristics suggest it is // Ok, the transformation is safe and the heuristics suggest it is
// profitable. Update the graph. // profitable. Update the graph.
DOUT << "Prescheduling SU # " << SU->NodeNum DEBUG(errs() << "Prescheduling SU # " << SU->NodeNum
<< " next to PredSU # " << PredSU->NodeNum << " next to PredSU # " << PredSU->NodeNum
<< " to guide scheduling in the presence of multiple uses\n"; << " to guide scheduling in the presence of multiple uses\n");
for (unsigned i = 0; i != PredSU->Succs.size(); ++i) { for (unsigned i = 0; i != PredSU->Succs.size(); ++i) {
SDep Edge = PredSU->Succs[i]; SDep Edge = PredSU->Succs[i];
assert(!Edge.isAssignedRegDep()); assert(!Edge.isAssignedRegDep());
@ -1419,8 +1420,8 @@ void RegReductionPriorityQueue<SF>::AddPseudoTwoAddrDeps() {
(hasCopyToRegUse(SU) && !hasCopyToRegUse(SuccSU)) || (hasCopyToRegUse(SU) && !hasCopyToRegUse(SuccSU)) ||
(!SU->isCommutable && SuccSU->isCommutable)) && (!SU->isCommutable && SuccSU->isCommutable)) &&
!scheduleDAG->IsReachable(SuccSU, SU)) { !scheduleDAG->IsReachable(SuccSU, SU)) {
DOUT << "Adding a pseudo-two-addr edge from SU # " << SU->NodeNum DEBUG(errs() << "Adding a pseudo-two-addr edge from SU # "
<< " to SU #" << SuccSU->NodeNum << "\n"; << SU->NodeNum << " to SU #" << SuccSU->NodeNum << "\n");
scheduleDAG->AddPred(SU, SDep(SuccSU, SDep::Order, /*Latency=*/0, scheduleDAG->AddPred(SU, SDep(SuccSU, SDep::Order, /*Latency=*/0,
/*Reg=*/0, /*isNormalMemory=*/false, /*Reg=*/0, /*isNormalMemory=*/false,
/*isMustAlias=*/false, /*isMustAlias=*/false,

View File

@ -467,7 +467,7 @@ void SelectionDAGISel::CodeGenAndEmitDAG() {
BlockName = MF->getFunction()->getNameStr() + ":" + BlockName = MF->getFunction()->getNameStr() + ":" +
BB->getBasicBlock()->getNameStr(); BB->getBasicBlock()->getNameStr();
DOUT << "Initial selection DAG:\n"; DEBUG(errs() << "Initial selection DAG:\n");
DEBUG(CurDAG->dump()); DEBUG(CurDAG->dump());
if (ViewDAGCombine1) CurDAG->viewGraph("dag-combine1 input for " + BlockName); if (ViewDAGCombine1) CurDAG->viewGraph("dag-combine1 input for " + BlockName);
@ -480,7 +480,7 @@ void SelectionDAGISel::CodeGenAndEmitDAG() {
CurDAG->Combine(Unrestricted, *AA, OptLevel); CurDAG->Combine(Unrestricted, *AA, OptLevel);
} }
DOUT << "Optimized lowered selection DAG:\n"; DEBUG(errs() << "Optimized lowered selection DAG:\n");
DEBUG(CurDAG->dump()); DEBUG(CurDAG->dump());
// Second step, hack on the DAG until it only uses operations and types that // Second step, hack on the DAG until it only uses operations and types that
@ -497,7 +497,7 @@ void SelectionDAGISel::CodeGenAndEmitDAG() {
Changed = CurDAG->LegalizeTypes(); Changed = CurDAG->LegalizeTypes();
} }
DOUT << "Type-legalized selection DAG:\n"; DEBUG(errs() << "Type-legalized selection DAG:\n");
DEBUG(CurDAG->dump()); DEBUG(CurDAG->dump());
if (Changed) { if (Changed) {
@ -512,7 +512,7 @@ void SelectionDAGISel::CodeGenAndEmitDAG() {
CurDAG->Combine(NoIllegalTypes, *AA, OptLevel); CurDAG->Combine(NoIllegalTypes, *AA, OptLevel);
} }
DOUT << "Optimized type-legalized selection DAG:\n"; DEBUG(errs() << "Optimized type-legalized selection DAG:\n");
DEBUG(CurDAG->dump()); DEBUG(CurDAG->dump());
} }
@ -542,7 +542,7 @@ void SelectionDAGISel::CodeGenAndEmitDAG() {
CurDAG->Combine(NoIllegalOperations, *AA, OptLevel); CurDAG->Combine(NoIllegalOperations, *AA, OptLevel);
} }
DOUT << "Optimized vector-legalized selection DAG:\n"; DEBUG(errs() << "Optimized vector-legalized selection DAG:\n");
DEBUG(CurDAG->dump()); DEBUG(CurDAG->dump());
} }
} }
@ -556,7 +556,7 @@ void SelectionDAGISel::CodeGenAndEmitDAG() {
CurDAG->Legalize(DisableLegalizeTypes, OptLevel); CurDAG->Legalize(DisableLegalizeTypes, OptLevel);
} }
DOUT << "Legalized selection DAG:\n"; DEBUG(errs() << "Legalized selection DAG:\n");
DEBUG(CurDAG->dump()); DEBUG(CurDAG->dump());
if (ViewDAGCombine2) CurDAG->viewGraph("dag-combine2 input for " + BlockName); if (ViewDAGCombine2) CurDAG->viewGraph("dag-combine2 input for " + BlockName);
@ -569,7 +569,7 @@ void SelectionDAGISel::CodeGenAndEmitDAG() {
CurDAG->Combine(NoIllegalOperations, *AA, OptLevel); CurDAG->Combine(NoIllegalOperations, *AA, OptLevel);
} }
DOUT << "Optimized legalized selection DAG:\n"; DEBUG(errs() << "Optimized legalized selection DAG:\n");
DEBUG(CurDAG->dump()); DEBUG(CurDAG->dump());
if (ViewISelDAGs) CurDAG->viewGraph("isel input for " + BlockName); if (ViewISelDAGs) CurDAG->viewGraph("isel input for " + BlockName);
@ -586,7 +586,7 @@ void SelectionDAGISel::CodeGenAndEmitDAG() {
InstructionSelect(); InstructionSelect();
} }
DOUT << "Selected selection DAG:\n"; DEBUG(errs() << "Selected selection DAG:\n");
DEBUG(CurDAG->dump()); DEBUG(CurDAG->dump());
if (ViewSchedDAGs) CurDAG->viewGraph("scheduler input for " + BlockName); if (ViewSchedDAGs) CurDAG->viewGraph("scheduler input for " + BlockName);
@ -619,7 +619,7 @@ void SelectionDAGISel::CodeGenAndEmitDAG() {
delete Scheduler; delete Scheduler;
} }
DOUT << "Selected machine code:\n"; DEBUG(errs() << "Selected machine code:\n");
DEBUG(BB->dump()); DEBUG(BB->dump());
} }
@ -799,14 +799,15 @@ void SelectionDAGISel::SelectAllBasicBlocks(Function &Fn,
void void
SelectionDAGISel::FinishBasicBlock() { SelectionDAGISel::FinishBasicBlock() {
DOUT << "Target-post-processed machine code:\n"; DEBUG(errs() << "Target-post-processed machine code:\n");
DEBUG(BB->dump()); DEBUG(BB->dump());
DOUT << "Total amount of phi nodes to update: " DEBUG(errs() << "Total amount of phi nodes to update: "
<< SDL->PHINodesToUpdate.size() << "\n"; << SDL->PHINodesToUpdate.size() << "\n");
DEBUG(for (unsigned i = 0, e = SDL->PHINodesToUpdate.size(); i != e; ++i) DEBUG(for (unsigned i = 0, e = SDL->PHINodesToUpdate.size(); i != e; ++i)
DOUT << "Node " << i << " : (" << SDL->PHINodesToUpdate[i].first errs() << "Node " << i << " : ("
<< ", " << SDL->PHINodesToUpdate[i].second << ")\n";); << SDL->PHINodesToUpdate[i].first
<< ", " << SDL->PHINodesToUpdate[i].second << ")\n");
// Next, now that we know what the last MBB the LLVM BB expanded is, update // Next, now that we know what the last MBB the LLVM BB expanded is, update
// PHI nodes in successors. // PHI nodes in successors.

View File

@ -216,7 +216,7 @@ bool SelectionDAG::setSubgraphColorHelper(SDNode *N, const char *Color, DenseSet
if (level >= 20) { if (level >= 20) {
if (!printed) { if (!printed) {
printed = true; printed = true;
DOUT << "setSubgraphColor hit max level\n"; DEBUG(errs() << "setSubgraphColor hit max level\n");
} }
return true; return true;
} }

View File

@ -198,7 +198,7 @@ void StackSlotColoring::InitializeSlots() {
Assignments.resize(LastFI); Assignments.resize(LastFI);
// Gather all spill slots into a list. // Gather all spill slots into a list.
DOUT << "Spill slot intervals:\n"; DEBUG(errs() << "Spill slot intervals:\n");
for (LiveStacks::iterator i = LS->begin(), e = LS->end(); i != e; ++i) { for (LiveStacks::iterator i = LS->begin(), e = LS->end(); i != e; ++i) {
LiveInterval &li = i->second; LiveInterval &li = i->second;
DEBUG(li.dump()); DEBUG(li.dump());
@ -210,7 +210,7 @@ void StackSlotColoring::InitializeSlots() {
OrigSizes[FI] = MFI->getObjectSize(FI); OrigSizes[FI] = MFI->getObjectSize(FI);
AllColors.set(FI); AllColors.set(FI);
} }
DOUT << '\n'; DEBUG(errs() << '\n');
// Sort them by weight. // Sort them by weight.
std::stable_sort(SSIntervals.begin(), SSIntervals.end(), IntervalSorter()); std::stable_sort(SSIntervals.begin(), SSIntervals.end(), IntervalSorter());
@ -242,7 +242,7 @@ StackSlotColoring::ColorSlotsWithFreeRegs(SmallVector<int, 16> &SlotMapping,
return false; return false;
bool Changed = false; bool Changed = false;
DOUT << "Assigning unused registers to spill slots:\n"; DEBUG(errs() << "Assigning unused registers to spill slots:\n");
for (unsigned i = 0, e = SSIntervals.size(); i != e; ++i) { for (unsigned i = 0, e = SSIntervals.size(); i != e; ++i) {
LiveInterval *li = SSIntervals[i]; LiveInterval *li = SSIntervals[i];
int SS = li->getStackSlotIndex(); int SS = li->getStackSlotIndex();
@ -272,7 +272,8 @@ StackSlotColoring::ColorSlotsWithFreeRegs(SmallVector<int, 16> &SlotMapping,
AllColored = false; AllColored = false;
continue; continue;
} else { } else {
DOUT << "Assigning fi#" << RSS << " to " << TRI->getName(Reg) << '\n'; DEBUG(errs() << "Assigning fi#" << RSS << " to "
<< TRI->getName(Reg) << '\n');
ColoredRegs.push_back(Reg); ColoredRegs.push_back(Reg);
SlotMapping[RSS] = Reg; SlotMapping[RSS] = Reg;
SlotIsReg.set(RSS); SlotIsReg.set(RSS);
@ -299,7 +300,7 @@ StackSlotColoring::ColorSlotsWithFreeRegs(SmallVector<int, 16> &SlotMapping,
++NumEliminated; ++NumEliminated;
} }
} }
DOUT << '\n'; DEBUG(errs() << '\n');
return Changed; return Changed;
} }
@ -334,7 +335,7 @@ int StackSlotColoring::ColorSlot(LiveInterval *li) {
// Record the assignment. // Record the assignment.
Assignments[Color].push_back(li); Assignments[Color].push_back(li);
int FI = li->getStackSlotIndex(); int FI = li->getStackSlotIndex();
DOUT << "Assigning fi#" << FI << " to fi#" << Color << "\n"; DEBUG(errs() << "Assigning fi#" << FI << " to fi#" << Color << "\n");
// Change size and alignment of the allocated slot. If there are multiple // Change size and alignment of the allocated slot. If there are multiple
// objects sharing the same slot, then make sure the size and alignment // objects sharing the same slot, then make sure the size and alignment
@ -358,7 +359,7 @@ bool StackSlotColoring::ColorSlots(MachineFunction &MF) {
BitVector SlotIsReg(NumObjs); BitVector SlotIsReg(NumObjs);
BitVector UsedColors(NumObjs); BitVector UsedColors(NumObjs);
DOUT << "Color spill slot intervals:\n"; DEBUG(errs() << "Color spill slot intervals:\n");
bool Changed = false; bool Changed = false;
for (unsigned i = 0, e = SSIntervals.size(); i != e; ++i) { for (unsigned i = 0, e = SSIntervals.size(); i != e; ++i) {
LiveInterval *li = SSIntervals[i]; LiveInterval *li = SSIntervals[i];
@ -372,7 +373,7 @@ bool StackSlotColoring::ColorSlots(MachineFunction &MF) {
Changed |= (SS != NewSS); Changed |= (SS != NewSS);
} }
DOUT << "\nSpill slots after coloring:\n"; DEBUG(errs() << "\nSpill slots after coloring:\n");
for (unsigned i = 0, e = SSIntervals.size(); i != e; ++i) { for (unsigned i = 0, e = SSIntervals.size(); i != e; ++i) {
LiveInterval *li = SSIntervals[i]; LiveInterval *li = SSIntervals[i];
int SS = li->getStackSlotIndex(); int SS = li->getStackSlotIndex();
@ -384,7 +385,7 @@ bool StackSlotColoring::ColorSlots(MachineFunction &MF) {
#ifndef NDEBUG #ifndef NDEBUG
for (unsigned i = 0, e = SSIntervals.size(); i != e; ++i) for (unsigned i = 0, e = SSIntervals.size(); i != e; ++i)
DEBUG(SSIntervals[i]->dump()); DEBUG(SSIntervals[i]->dump());
DOUT << '\n'; DEBUG(errs() << '\n');
#endif #endif
// Can we "color" a stack slot with a unused register? // Can we "color" a stack slot with a unused register?
@ -416,7 +417,7 @@ bool StackSlotColoring::ColorSlots(MachineFunction &MF) {
// Delete unused stack slots. // Delete unused stack slots.
while (NextColor != -1) { while (NextColor != -1) {
DOUT << "Removing unused stack object fi#" << NextColor << "\n"; DEBUG(errs() << "Removing unused stack object fi#" << NextColor << "\n");
MFI->RemoveStackObject(NextColor); MFI->RemoveStackObject(NextColor);
NextColor = AllColors.find_next(NextColor); NextColor = AllColors.find_next(NextColor);
} }
@ -610,7 +611,7 @@ StackSlotColoring::UnfoldAndRewriteInstruction(MachineInstr *MI, int OldFI,
MachineBasicBlock *MBB = MI->getParent(); MachineBasicBlock *MBB = MI->getParent();
if (unsigned DstReg = TII->isLoadFromStackSlot(MI, OldFI)) { if (unsigned DstReg = TII->isLoadFromStackSlot(MI, OldFI)) {
if (PropagateForward(MI, MBB, DstReg, Reg)) { if (PropagateForward(MI, MBB, DstReg, Reg)) {
DOUT << "Eliminated load: "; DEBUG(errs() << "Eliminated load: ");
DEBUG(MI->dump()); DEBUG(MI->dump());
++NumLoadElim; ++NumLoadElim;
} else { } else {
@ -626,7 +627,7 @@ StackSlotColoring::UnfoldAndRewriteInstruction(MachineInstr *MI, int OldFI,
} }
} else if (unsigned SrcReg = TII->isStoreToStackSlot(MI, OldFI)) { } else if (unsigned SrcReg = TII->isStoreToStackSlot(MI, OldFI)) {
if (MI->killsRegister(SrcReg) && PropagateBackward(MI, MBB, SrcReg, Reg)) { if (MI->killsRegister(SrcReg) && PropagateBackward(MI, MBB, SrcReg, Reg)) {
DOUT << "Eliminated store: "; DEBUG(errs() << "Eliminated store: ");
DEBUG(MI->dump()); DEBUG(MI->dump());
++NumStoreElim; ++NumStoreElim;
} else { } else {
@ -704,7 +705,7 @@ bool StackSlotColoring::RemoveDeadStores(MachineBasicBlock* MBB) {
bool StackSlotColoring::runOnMachineFunction(MachineFunction &MF) { bool StackSlotColoring::runOnMachineFunction(MachineFunction &MF) {
DOUT << "********** Stack Slot Coloring **********\n"; DEBUG(errs() << "********** Stack Slot Coloring **********\n");
MFI = MF.getFrameInfo(); MFI = MF.getFrameInfo();
MRI = &MF.getRegInfo(); MRI = &MF.getRegInfo();

View File

@ -554,8 +554,8 @@ void StrongPHIElimination::processBlock(MachineBasicBlock* MBB) {
// Add the renaming set for this PHI node to our overall renaming information // Add the renaming set for this PHI node to our overall renaming information
for (std::map<unsigned, MachineBasicBlock*>::iterator QI = PHIUnion.begin(), for (std::map<unsigned, MachineBasicBlock*>::iterator QI = PHIUnion.begin(),
QE = PHIUnion.end(); QI != QE; ++QI) { QE = PHIUnion.end(); QI != QE; ++QI) {
DOUT << "Adding Renaming: " << QI->first << " -> " DEBUG(errs() << "Adding Renaming: " << QI->first << " -> "
<< P->getOperand(0).getReg() << "\n"; << P->getOperand(0).getReg() << "\n");
} }
RenameSets.insert(std::make_pair(P->getOperand(0).getReg(), PHIUnion)); RenameSets.insert(std::make_pair(P->getOperand(0).getReg(), PHIUnion));
@ -697,7 +697,8 @@ void StrongPHIElimination::ScheduleCopies(MachineBasicBlock* MBB,
TII->copyRegToReg(*PI->getParent(), PI, t, TII->copyRegToReg(*PI->getParent(), PI, t,
curr.second, RC, RC); curr.second, RC, RC);
DOUT << "Inserted copy from " << curr.second << " to " << t << "\n"; DEBUG(errs() << "Inserted copy from " << curr.second << " to " << t
<< "\n");
// Push temporary on Stacks // Push temporary on Stacks
Stacks[curr.second].push_back(t); Stacks[curr.second].push_back(t);
@ -713,8 +714,8 @@ void StrongPHIElimination::ScheduleCopies(MachineBasicBlock* MBB,
TII->copyRegToReg(*MBB, MBB->getFirstTerminator(), curr.second, TII->copyRegToReg(*MBB, MBB->getFirstTerminator(), curr.second,
map[curr.first], RC, RC); map[curr.first], RC, RC);
map[curr.first] = curr.second; map[curr.first] = curr.second;
DOUT << "Inserted copy from " << curr.first << " to " DEBUG(errs() << "Inserted copy from " << curr.first << " to "
<< curr.second << "\n"; << curr.second << "\n");
// Push this copy onto InsertedPHICopies so we can // Push this copy onto InsertedPHICopies so we can
// update LiveIntervals with it. // update LiveIntervals with it.
@ -928,7 +929,8 @@ bool StrongPHIElimination::runOnMachineFunction(MachineFunction &Fn) {
unsigned reg = OI->first; unsigned reg = OI->first;
++OI; ++OI;
I->second.erase(reg); I->second.erase(reg);
DOUT << "Removing Renaming: " << reg << " -> " << I->first << "\n"; DEBUG(errs() << "Removing Renaming: " << reg << " -> " << I->first
<< "\n");
} }
} }
} }
@ -945,7 +947,7 @@ bool StrongPHIElimination::runOnMachineFunction(MachineFunction &Fn) {
while (I->second.size()) { while (I->second.size()) {
std::map<unsigned, MachineBasicBlock*>::iterator SI = I->second.begin(); std::map<unsigned, MachineBasicBlock*>::iterator SI = I->second.begin();
DOUT << "Renaming: " << SI->first << " -> " << I->first << "\n"; DEBUG(errs() << "Renaming: " << SI->first << " -> " << I->first << "\n");
if (SI->first != I->first) { if (SI->first != I->first) {
if (mergeLiveIntervals(I->first, SI->first)) { if (mergeLiveIntervals(I->first, SI->first)) {
@ -977,8 +979,8 @@ bool StrongPHIElimination::runOnMachineFunction(MachineFunction &Fn) {
R.valno->setCopy(--SI->second->getFirstTerminator()); R.valno->setCopy(--SI->second->getFirstTerminator());
R.valno->def = LiveIntervals::getDefIndex(instrIdx); R.valno->def = LiveIntervals::getDefIndex(instrIdx);
DOUT << "Renaming failed: " << SI->first << " -> " DEBUG(errs() << "Renaming failed: " << SI->first << " -> "
<< I->first << "\n"; << I->first << "\n");
} }
} }

View File

@ -243,13 +243,13 @@ static void *CreateArgv(LLVMContext &C, ExecutionEngine *EE,
unsigned PtrSize = EE->getTargetData()->getPointerSize(); unsigned PtrSize = EE->getTargetData()->getPointerSize();
char *Result = new char[(InputArgv.size()+1)*PtrSize]; char *Result = new char[(InputArgv.size()+1)*PtrSize];
DOUT << "JIT: ARGV = " << (void*)Result << "\n"; DEBUG(errs() << "JIT: ARGV = " << (void*)Result << "\n");
const Type *SBytePtr = PointerType::getUnqual(Type::getInt8Ty(C)); const Type *SBytePtr = PointerType::getUnqual(Type::getInt8Ty(C));
for (unsigned i = 0; i != InputArgv.size(); ++i) { for (unsigned i = 0; i != InputArgv.size(); ++i) {
unsigned Size = InputArgv[i].size()+1; unsigned Size = InputArgv[i].size()+1;
char *Dest = new char[Size]; char *Dest = new char[Size];
DOUT << "JIT: ARGV[" << i << "] = " << (void*)Dest << "\n"; DEBUG(errs() << "JIT: ARGV[" << i << "] = " << (void*)Dest << "\n");
std::copy(InputArgv[i].begin(), InputArgv[i].end(), Dest); std::copy(InputArgv[i].begin(), InputArgv[i].end(), Dest);
Dest[Size-1] = 0; Dest[Size-1] = 0;
@ -899,7 +899,7 @@ void ExecutionEngine::LoadValueFromMemory(GenericValue &Result,
// specified memory location... // specified memory location...
// //
void ExecutionEngine::InitializeMemory(const Constant *Init, void *Addr) { void ExecutionEngine::InitializeMemory(const Constant *Init, void *Addr) {
DOUT << "JIT: Initializing " << Addr << " "; DEBUG(errs() << "JIT: Initializing " << Addr << " ");
DEBUG(Init->dump()); DEBUG(Init->dump());
if (isa<UndefValue>(Init)) { if (isa<UndefValue>(Init)) {
return; return;

View File

@ -269,8 +269,8 @@ void *JITResolver::getExternalFunctionStub(void *FnAddr) {
Stub = TheJIT->getJITInfo().emitFunctionStub(0, FnAddr, Stub = TheJIT->getJITInfo().emitFunctionStub(0, FnAddr,
*TheJIT->getCodeEmitter()); *TheJIT->getCodeEmitter());
DOUT << "JIT: Stub emitted at [" << Stub DEBUG(errs() << "JIT: Stub emitted at [" << Stub
<< "] for external function at '" << FnAddr << "'\n"; << "] for external function at '" << FnAddr << "'\n");
return Stub; return Stub;
} }
@ -279,7 +279,8 @@ unsigned JITResolver::getGOTIndexForAddr(void* addr) {
if (!idx) { if (!idx) {
idx = ++nextGOTIndex; idx = ++nextGOTIndex;
revGOTMap[addr] = idx; revGOTMap[addr] = idx;
DOUT << "JIT: Adding GOT entry " << idx << " for addr [" << addr << "]\n"; DEBUG(errs() << "JIT: Adding GOT entry " << idx << " for addr ["
<< addr << "]\n");
} }
return idx; return idx;
} }
@ -508,7 +509,7 @@ namespace {
MemMgr = JMM ? JMM : JITMemoryManager::CreateDefaultMemManager(); MemMgr = JMM ? JMM : JITMemoryManager::CreateDefaultMemManager();
if (jit.getJITInfo().needsGOT()) { if (jit.getJITInfo().needsGOT()) {
MemMgr->AllocateGOT(); MemMgr->AllocateGOT();
DOUT << "JIT is managing a GOT\n"; DEBUG(errs() << "JIT is managing a GOT\n");
} }
if (DwarfExceptionHandling) DE = new JITDwarfEmitter(jit); if (DwarfExceptionHandling) DE = new JITDwarfEmitter(jit);
@ -556,8 +557,8 @@ namespace {
if (MBBLocations.size() <= (unsigned)MBB->getNumber()) if (MBBLocations.size() <= (unsigned)MBB->getNumber())
MBBLocations.resize((MBB->getNumber()+1)*2); MBBLocations.resize((MBB->getNumber()+1)*2);
MBBLocations[MBB->getNumber()] = getCurrentPCValue(); MBBLocations[MBB->getNumber()] = getCurrentPCValue();
DOUT << "JIT: Emitting BB" << MBB->getNumber() << " at [" DEBUG(errs() << "JIT: Emitting BB" << MBB->getNumber() << " at ["
<< (void*) getCurrentPCValue() << "]\n"; << (void*) getCurrentPCValue() << "]\n");
} }
virtual uintptr_t getConstantPoolEntryAddress(unsigned Entry) const; virtual uintptr_t getConstantPoolEntryAddress(unsigned Entry) const;
@ -756,7 +757,7 @@ unsigned JITEmitter::addSizeOfGlobal(const GlobalVariable *GV, unsigned Size) {
size_t GVSize = (size_t)TheJIT->getTargetData()->getTypeAllocSize(ElTy); size_t GVSize = (size_t)TheJIT->getTargetData()->getTypeAllocSize(ElTy);
size_t GVAlign = size_t GVAlign =
(size_t)TheJIT->getTargetData()->getPreferredAlignment(GV); (size_t)TheJIT->getTargetData()->getPreferredAlignment(GV);
DOUT << "JIT: Adding in size " << GVSize << " alignment " << GVAlign; DEBUG(errs() << "JIT: Adding in size " << GVSize << " alignment " << GVAlign);
DEBUG(GV->dump()); DEBUG(GV->dump());
// Assume code section ends with worst possible alignment, so first // Assume code section ends with worst possible alignment, so first
// variable needs maximal padding. // variable needs maximal padding.
@ -884,7 +885,7 @@ unsigned JITEmitter::GetSizeOfGlobalsInBytes(MachineFunction &MF) {
} }
} }
} }
DOUT << "JIT: About to look through initializers\n"; DEBUG(errs() << "JIT: About to look through initializers\n");
// Look for more globals that are referenced only from initializers. // Look for more globals that are referenced only from initializers.
// GVSet.end is computed each time because the set can grow as we go. // GVSet.end is computed each time because the set can grow as we go.
for (SmallPtrSet<const GlobalVariable *, 8>::iterator I = GVSet.begin(); for (SmallPtrSet<const GlobalVariable *, 8>::iterator I = GVSet.begin();
@ -905,7 +906,7 @@ void JITEmitter::startFunction(MachineFunction &F) {
// Set the memory writable, if it's not already // Set the memory writable, if it's not already
MemMgr->setMemoryWritable(); MemMgr->setMemoryWritable();
if (MemMgr->NeedsExactSize()) { if (MemMgr->NeedsExactSize()) {
DOUT << "JIT: ExactSize\n"; DEBUG(errs() << "JIT: ExactSize\n");
const TargetInstrInfo* TII = F.getTarget().getInstrInfo(); const TargetInstrInfo* TII = F.getTarget().getInstrInfo();
MachineJumpTableInfo *MJTI = F.getJumpTableInfo(); MachineJumpTableInfo *MJTI = F.getJumpTableInfo();
MachineConstantPool *MCP = F.getConstantPool(); MachineConstantPool *MCP = F.getConstantPool();
@ -932,12 +933,12 @@ void JITEmitter::startFunction(MachineFunction &F) {
// Add the function size // Add the function size
ActualSize += TII->GetFunctionSizeInBytes(F); ActualSize += TII->GetFunctionSizeInBytes(F);
DOUT << "JIT: ActualSize before globals " << ActualSize << "\n"; DEBUG(errs() << "JIT: ActualSize before globals " << ActualSize << "\n");
// Add the size of the globals that will be allocated after this function. // Add the size of the globals that will be allocated after this function.
// These are all the ones referenced from this function that were not // These are all the ones referenced from this function that were not
// previously allocated. // previously allocated.
ActualSize += GetSizeOfGlobalsInBytes(F); ActualSize += GetSizeOfGlobalsInBytes(F);
DOUT << "JIT: ActualSize after globals " << ActualSize << "\n"; DEBUG(errs() << "JIT: ActualSize after globals " << ActualSize << "\n");
} else if (SizeEstimate > 0) { } else if (SizeEstimate > 0) {
// SizeEstimate will be non-zero on reallocation attempts. // SizeEstimate will be non-zero on reallocation attempts.
ActualSize = SizeEstimate; ActualSize = SizeEstimate;
@ -994,8 +995,8 @@ bool JITEmitter::finishFunction(MachineFunction &F) {
if (MR.isExternalSymbol()) { if (MR.isExternalSymbol()) {
ResultPtr = TheJIT->getPointerToNamedFunction(MR.getExternalSymbol(), ResultPtr = TheJIT->getPointerToNamedFunction(MR.getExternalSymbol(),
false); false);
DOUT << "JIT: Map \'" << MR.getExternalSymbol() << "\' to [" DEBUG(errs() << "JIT: Map \'" << MR.getExternalSymbol() << "\' to ["
<< ResultPtr << "]\n"; << ResultPtr << "]\n");
// If the target REALLY wants a stub for this function, emit it now. // If the target REALLY wants a stub for this function, emit it now.
if (!MR.doesntNeedStub()) { if (!MR.doesntNeedStub()) {
@ -1036,9 +1037,9 @@ bool JITEmitter::finishFunction(MachineFunction &F) {
unsigned idx = Resolver.getGOTIndexForAddr(ResultPtr); unsigned idx = Resolver.getGOTIndexForAddr(ResultPtr);
MR.setGOTIndex(idx); MR.setGOTIndex(idx);
if (((void**)MemMgr->getGOTBase())[idx] != ResultPtr) { if (((void**)MemMgr->getGOTBase())[idx] != ResultPtr) {
DOUT << "JIT: GOT was out of date for " << ResultPtr DEBUG(errs() << "JIT: GOT was out of date for " << ResultPtr
<< " pointing at " << ((void**)MemMgr->getGOTBase())[idx] << " pointing at " << ((void**)MemMgr->getGOTBase())[idx]
<< "\n"; << "\n");
((void**)MemMgr->getGOTBase())[idx] = ResultPtr; ((void**)MemMgr->getGOTBase())[idx] = ResultPtr;
} }
} }
@ -1053,8 +1054,9 @@ bool JITEmitter::finishFunction(MachineFunction &F) {
if (MemMgr->isManagingGOT()) { if (MemMgr->isManagingGOT()) {
unsigned idx = Resolver.getGOTIndexForAddr((void*)BufferBegin); unsigned idx = Resolver.getGOTIndexForAddr((void*)BufferBegin);
if (((void**)MemMgr->getGOTBase())[idx] != (void*)BufferBegin) { if (((void**)MemMgr->getGOTBase())[idx] != (void*)BufferBegin) {
DOUT << "JIT: GOT was out of date for " << (void*)BufferBegin DEBUG(errs() << "JIT: GOT was out of date for " << (void*)BufferBegin
<< " pointing at " << ((void**)MemMgr->getGOTBase())[idx] << "\n"; << " pointing at " << ((void**)MemMgr->getGOTBase())[idx]
<< "\n");
((void**)MemMgr->getGOTBase())[idx] = (void*)BufferBegin; ((void**)MemMgr->getGOTBase())[idx] = (void*)BufferBegin;
} }
} }
@ -1092,39 +1094,36 @@ bool JITEmitter::finishFunction(MachineFunction &F) {
// Mark code region readable and executable if it's not so already. // Mark code region readable and executable if it's not so already.
MemMgr->setMemoryExecutable(); MemMgr->setMemoryExecutable();
#ifndef NDEBUG DEBUG(
{
if (sys::hasDisassembler()) { if (sys::hasDisassembler()) {
DOUT << "JIT: Disassembled code:\n"; errs() << "JIT: Disassembled code:\n";
DOUT << sys::disassembleBuffer(FnStart, FnEnd-FnStart, (uintptr_t)FnStart); errs() << sys::disassembleBuffer(FnStart, FnEnd-FnStart,
(uintptr_t)FnStart);
} else { } else {
DOUT << "JIT: Binary code:\n"; errs() << "JIT: Binary code:\n";
DOUT << std::hex;
uint8_t* q = FnStart; uint8_t* q = FnStart;
for (int i = 0; q < FnEnd; q += 4, ++i) { for (int i = 0; q < FnEnd; q += 4, ++i) {
if (i == 4) if (i == 4)
i = 0; i = 0;
if (i == 0) if (i == 0)
DOUT << "JIT: " << std::setw(8) << std::setfill('0') errs() << "JIT: " << (long)(q - FnStart) << ": ";
<< (long)(q - FnStart) << ": ";
bool Done = false; bool Done = false;
for (int j = 3; j >= 0; --j) { for (int j = 3; j >= 0; --j) {
if (q + j >= FnEnd) if (q + j >= FnEnd)
Done = true; Done = true;
else else
DOUT << std::setw(2) << std::setfill('0') << (unsigned short)q[j]; errs() << (unsigned short)q[j];
} }
if (Done) if (Done)
break; break;
DOUT << ' '; errs() << ' ';
if (i == 3) if (i == 3)
DOUT << '\n'; errs() << '\n';
} }
DOUT << std::dec; errs()<< '\n';
DOUT<< '\n';
} }
} );
#endif
if (DwarfExceptionHandling) { if (DwarfExceptionHandling) {
uintptr_t ActualSize = 0; uintptr_t ActualSize = 0;
SavedBufferBegin = BufferBegin; SavedBufferBegin = BufferBegin;
@ -1155,7 +1154,7 @@ bool JITEmitter::finishFunction(MachineFunction &F) {
} }
void JITEmitter::retryWithMoreMemory(MachineFunction &F) { void JITEmitter::retryWithMoreMemory(MachineFunction &F) {
DOUT << "JIT: Ran out of space for native code. Reattempting.\n"; DEBUG(errs() << "JIT: Ran out of space for native code. Reattempting.\n");
Relocations.clear(); // Clear the old relocations or we'll reapply them. Relocations.clear(); // Clear the old relocations or we'll reapply them.
ConstPoolAddresses.clear(); ConstPoolAddresses.clear();
++NumRetries; ++NumRetries;
@ -1190,7 +1189,7 @@ void JITEmitter::deallocateMemForFunction(const Function *F) {
// in the JITResolver. Were there a memory manager deallocateStub routine, // in the JITResolver. Were there a memory manager deallocateStub routine,
// we could call that at this point too. // we could call that at this point too.
if (FnRefs.empty()) { if (FnRefs.empty()) {
DOUT << "\nJIT: Invalidated Stub at [" << Stub << "]\n"; DEBUG(errs() << "\nJIT: Invalidated Stub at [" << Stub << "]\n");
StubFnRefs.erase(Stub); StubFnRefs.erase(Stub);
// Invalidate the stub. If it is a GV stub, update the JIT's global // Invalidate the stub. If it is a GV stub, update the JIT's global
@ -1245,8 +1244,8 @@ void JITEmitter::emitConstantPool(MachineConstantPool *MCP) {
if (ConstantPoolBase == 0) return; // Buffer overflow. if (ConstantPoolBase == 0) return; // Buffer overflow.
DOUT << "JIT: Emitted constant pool at [" << ConstantPoolBase DEBUG(errs() << "JIT: Emitted constant pool at [" << ConstantPoolBase
<< "] (size: " << Size << ", alignment: " << Align << ")\n"; << "] (size: " << Size << ", alignment: " << Align << ")\n");
// Initialize the memory for all of the constant pool entries. // Initialize the memory for all of the constant pool entries.
unsigned Offset = 0; unsigned Offset = 0;
@ -1263,8 +1262,8 @@ void JITEmitter::emitConstantPool(MachineConstantPool *MCP) {
"entry has not been implemented!"); "entry has not been implemented!");
} }
TheJIT->InitializeMemory(CPE.Val.ConstVal, (void*)CAddr); TheJIT->InitializeMemory(CPE.Val.ConstVal, (void*)CAddr);
DOUT << "JIT: CP" << i << " at [0x" DEBUG(errs() << "JIT: CP" << i << " at [0x";
<< std::hex << CAddr << std::dec << "]\n"; errs().write_hex(CAddr) << "]\n");
const Type *Ty = CPE.Val.ConstVal->getType(); const Type *Ty = CPE.Val.ConstVal->getType();
Offset += TheJIT->getTargetData()->getTypeAllocSize(Ty); Offset += TheJIT->getTargetData()->getTypeAllocSize(Ty);

View File

@ -357,7 +357,7 @@ namespace {
// another block of memory and add it to the free list. // another block of memory and add it to the free list.
if (largest < ActualSize || if (largest < ActualSize ||
largest <= FreeRangeHeader::getMinBlockSize()) { largest <= FreeRangeHeader::getMinBlockSize()) {
DOUT << "JIT: Allocating another slab of memory for function."; DEBUG(errs() << "JIT: Allocating another slab of memory for function.");
candidateBlock = allocateNewCodeSlab((size_t)ActualSize); candidateBlock = allocateNewCodeSlab((size_t)ActualSize);
} }

View File

@ -50,9 +50,9 @@ OProfileJITEventListener::OProfileJITEventListener()
: Agent(op_open_agent()) { : Agent(op_open_agent()) {
if (Agent == NULL) { if (Agent == NULL) {
const std::string err_str = sys::StrError(); const std::string err_str = sys::StrError();
DOUT << "Failed to connect to OProfile agent: " << err_str << "\n"; DEBUG(errs() << "Failed to connect to OProfile agent: " << err_str << "\n");
} else { } else {
DOUT << "Connected to OProfile agent.\n"; DEBUG(errs() << "Connected to OProfile agent.\n");
} }
} }
@ -60,9 +60,10 @@ OProfileJITEventListener::~OProfileJITEventListener() {
if (Agent != NULL) { if (Agent != NULL) {
if (op_close_agent(Agent) == -1) { if (op_close_agent(Agent) == -1) {
const std::string err_str = sys::StrError(); const std::string err_str = sys::StrError();
DOUT << "Failed to disconnect from OProfile agent: " << err_str << "\n"; DEBUG(errs() << "Failed to disconnect from OProfile agent: "
<< err_str << "\n");
} else { } else {
DOUT << "Disconnected from OProfile agent.\n"; DEBUG(errs() << "Disconnected from OProfile agent.\n");
} }
} }
} }
@ -99,8 +100,8 @@ static debug_line_info LineStartToOProfileFormat(
const DebugLocTuple& tuple = MF.getDebugLocTuple(Loc); const DebugLocTuple& tuple = MF.getDebugLocTuple(Loc);
Result.lineno = tuple.Line; Result.lineno = tuple.Line;
Result.filename = Filenames.getFilename(tuple.CompileUnit); Result.filename = Filenames.getFilename(tuple.CompileUnit);
DOUT << "Mapping " << reinterpret_cast<void*>(Result.vma) << " to " DEBUG(errs() << "Mapping " << reinterpret_cast<void*>(Result.vma) << " to "
<< Result.filename << ":" << Result.lineno << "\n"; << Result.filename << ":" << Result.lineno << "\n");
return Result; return Result;
} }

View File

@ -552,7 +552,7 @@ void DAE::MarkLive(const RetOrArg &RA) {
if (!LiveValues.insert(RA).second) if (!LiveValues.insert(RA).second)
return; // We were already marked Live. return; // We were already marked Live.
DOUT << "DAE - Marking " << RA.getDescription() << " live\n"; DEBUG(errs() << "DAE - Marking " << RA.getDescription() << " live\n");
PropagateLiveness(RA); PropagateLiveness(RA);
} }
@ -916,7 +916,7 @@ bool DAE::runOnModule(Module &M) {
// removed. We can do this if they never call va_start. This loop cannot be // removed. We can do this if they never call va_start. This loop cannot be
// fused with the next loop, because deleting a function invalidates // fused with the next loop, because deleting a function invalidates
// information computed while surveying other functions. // information computed while surveying other functions.
DOUT << "DAE - Deleting dead varargs\n"; DEBUG(errs() << "DAE - Deleting dead varargs\n");
for (Module::iterator I = M.begin(), E = M.end(); I != E; ) { for (Module::iterator I = M.begin(), E = M.end(); I != E; ) {
Function &F = *I++; Function &F = *I++;
if (F.getFunctionType()->isVarArg()) if (F.getFunctionType()->isVarArg())
@ -927,7 +927,7 @@ bool DAE::runOnModule(Module &M) {
// We assume all arguments are dead unless proven otherwise (allowing us to // We assume all arguments are dead unless proven otherwise (allowing us to
// determine that dead arguments passed into recursive functions are dead). // determine that dead arguments passed into recursive functions are dead).
// //
DOUT << "DAE - Determining liveness\n"; DEBUG(errs() << "DAE - Determining liveness\n");
for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I)
SurveyFunction(*I); SurveyFunction(*I);

View File

@ -633,11 +633,11 @@ bool MergeFunctions::runOnModule(Module &M) {
bool LocalChanged; bool LocalChanged;
do { do {
LocalChanged = false; LocalChanged = false;
DOUT << "size: " << FnMap.size() << "\n"; DEBUG(errs() << "size: " << FnMap.size() << "\n");
for (std::map<unsigned long, std::vector<Function *> >::iterator for (std::map<unsigned long, std::vector<Function *> >::iterator
I = FnMap.begin(), E = FnMap.end(); I != E; ++I) { I = FnMap.begin(), E = FnMap.end(); I != E; ++I) {
std::vector<Function *> &FnVec = I->second; std::vector<Function *> &FnVec = I->second;
DOUT << "hash (" << I->first << "): " << FnVec.size() << "\n"; DEBUG(errs() << "hash (" << I->first << "): " << FnVec.size() << "\n");
for (int i = 0, e = FnVec.size(); i != e; ++i) { for (int i = 0, e = FnVec.size(); i != e; ++i) {
for (int j = i + 1; j != e; ++j) { for (int j = i + 1; j != e; ++j) {

View File

@ -105,12 +105,12 @@ bool SRETPromotion::PromoteReturn(CallGraphNode *CGN) {
// Check if it is ok to perform this promotion. // Check if it is ok to perform this promotion.
if (isSafeToUpdateAllCallers(F) == false) { if (isSafeToUpdateAllCallers(F) == false) {
DOUT << "SretPromotion: Not all callers can be updated\n"; DEBUG(errs() << "SretPromotion: Not all callers can be updated\n");
NumRejectedSRETUses++; NumRejectedSRETUses++;
return false; return false;
} }
DOUT << "SretPromotion: sret argument will be promoted\n"; DEBUG(errs() << "SretPromotion: sret argument will be promoted\n");
NumSRET++; NumSRET++;
// [1] Replace use of sret parameter // [1] Replace use of sret parameter
AllocaInst *TheAlloca = new AllocaInst(STy, NULL, "mrv", AllocaInst *TheAlloca = new AllocaInst(STy, NULL, "mrv",

View File

@ -1222,13 +1222,13 @@ void GVNPRE::topo_sort(ValueNumberedSet& set, SmallVector<Value*, 8>& vec) {
/// dump - Dump a set of values to standard error /// dump - Dump a set of values to standard error
void GVNPRE::dump(ValueNumberedSet& s) const { void GVNPRE::dump(ValueNumberedSet& s) const {
DOUT << "{ "; DEBUG(errs() << "{ ");
for (ValueNumberedSet::iterator I = s.begin(), E = s.end(); for (ValueNumberedSet::iterator I = s.begin(), E = s.end();
I != E; ++I) { I != E; ++I) {
DOUT << "" << VN.lookup(*I) << ": "; DEBUG(errs() << "" << VN.lookup(*I) << ": ");
DEBUG((*I)->dump()); DEBUG((*I)->dump());
} }
DOUT << "}\n\n"; DEBUG(errs() << "}\n\n");
} }
/// elimination - Phase 3 of the main algorithm. Perform full redundancy /// elimination - Phase 3 of the main algorithm. Perform full redundancy