llvm.org GIT mirror llvm / bbbfa99
remove a few DOUTs here and there. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79832 91177308-0d34-0410-b5e6-96231b3b80d8 Chris Lattner 10 years ago
19 changed file(s) with 198 addition(s) and 176 deletion(s). Raw diff Collapse all Expand all
7070 SCCNodeStack.push_back(N);
7171 MinVisitNumStack.push_back(visitNum);
7272 VisitStack.push_back(std::make_pair(N, GT::child_begin(N)));
73 //DOUT << "TarjanSCC: Node " << N <<
73 //errs() << "TarjanSCC: Node " << N <<
7474 // " : visitNum = " << visitNum << "\n";
7575 }
7676
105105 if (!MinVisitNumStack.empty() && MinVisitNumStack.back() > minVisitNum)
106106 MinVisitNumStack.back() = minVisitNum;
107107
108 //DOUT << "TarjanSCC: Popped node " << visitingN <<
108 //errs() << "TarjanSCC: Popped node " << visitingN <<
109109 // " : minVisitNum = " << minVisitNum << "; Node visit num = " <<
110110 // nodeVisitNumbers[visitingN] << "\n";
111111
14181418 unsigned Pos = NewPos++;
14191419 Translate[i] = Pos;
14201420 NewGraphNodes.push_back(GraphNodes[i]);
1421 DOUT << "Renumbering node " << i << " to node " << Pos << "\n";
1421 DEBUG(errs() << "Renumbering node " << i << " to node " << Pos << "\n");
14221422 }
14231423
14241424 // I believe this ends up being faster than making two vectors and splicing
14281428 unsigned Pos = NewPos++;
14291429 Translate[i] = Pos;
14301430 NewGraphNodes.push_back(GraphNodes[i]);
1431 DOUT << "Renumbering node " << i << " to node " << Pos << "\n";
1431 DEBUG(errs() << "Renumbering node " << i << " to node " << Pos << "\n");
14321432 }
14331433 }
14341434
14371437 unsigned Pos = NewPos++;
14381438 Translate[i] = Pos;
14391439 NewGraphNodes.push_back(GraphNodes[i]);
1440 DOUT << "Renumbering node " << i << " to node " << Pos << "\n";
1440 DEBUG(errs() << "Renumbering node " << i << " to node " << Pos << "\n");
14411441 }
14421442 }
14431443
15091509 /// receive &D from E anyway.
15101510
15111511 void Andersens::HVN() {
1512 DOUT << "Beginning HVN\n";
1512 DEBUG(errs() << "Beginning HVN\n");
15131513 // Build a predecessor graph. This is like our constraint graph with the
15141514 // edges going in the opposite direction, and there are edges for all the
15151515 // constraints, instead of just copy constraints. We also build implicit
15801580 Node2DFS.clear();
15811581 Node2Deleted.clear();
15821582 Node2Visited.clear();
1583 DOUT << "Finished HVN\n";
1583 DEBUG(errs() << "Finished HVN\n");
15841584
15851585 }
15861586
17041704 /// and is equivalent to value numbering the collapsed constraint graph
17051705 /// including evaluating unions.
17061706 void Andersens::HU() {
1707 DOUT << "Beginning HU\n";
1707 DEBUG(errs() << "Beginning HU\n");
17081708 // Build a predecessor graph. This is like our constraint graph with the
17091709 // edges going in the opposite direction, and there are edges for all the
17101710 // constraints, instead of just copy constraints. We also build implicit
17841784 }
17851785 // PEClass nodes will be deleted by the deleting of N->PointsTo in our caller.
17861786 Set2PEClass.clear();
1787 DOUT << "Finished HU\n";
1787 DEBUG(errs() << "Finished HU\n");
17881788 }
17891789
17901790
19621962 // to anything.
19631963 if (LHSLabel == 0) {
19641964 DEBUG(PrintNode(&GraphNodes[LHSNode]));
1965 DOUT << " is a non-pointer, ignoring constraint.\n";
1965 DEBUG(errs() << " is a non-pointer, ignoring constraint.\n");
19661966 continue;
19671967 }
19681968 if (RHSLabel == 0) {
19691969 DEBUG(PrintNode(&GraphNodes[RHSNode]));
1970 DOUT << " is a non-pointer, ignoring constraint.\n";
1970 DEBUG(errs() << " is a non-pointer, ignoring constraint.\n");
19711971 continue;
19721972 }
19731973 // This constraint may be useless, and it may become useless as we translate
20152015 if (i < FirstRefNode) {
20162016 PrintNode(&GraphNodes[i]);
20172017 } else if (i < FirstAdrNode) {
2018 DOUT << "REF(";
2018 DEBUG(errs() << "REF(");
20192019 PrintNode(&GraphNodes[i-FirstRefNode]);
2020 DOUT <<")";
2020 DEBUG(errs() <<")");
20212021 } else {
2022 DOUT << "ADR(";
2022 DEBUG(errs() << "ADR(");
20232023 PrintNode(&GraphNodes[i-FirstAdrNode]);
2024 DOUT <<")";
2025 }
2026
2027 DOUT << " has pointer label " << GraphNodes[i].PointerEquivLabel
2024 DEBUG(errs() <<")");
2025 }
2026
2027 DEBUG(errs() << " has pointer label " << GraphNodes[i].PointerEquivLabel
20282028 << " and SCC rep " << VSSCCRep[i]
20292029 << " and is " << (GraphNodes[i].Direct ? "Direct" : "Not direct")
2030 << "\n";
2030 << "\n");
20312031 }
20322032 }
20332033
20412041 /// operation are stored in SDT and are later used in SolveContraints()
20422042 /// and UniteNodes().
20432043 void Andersens::HCD() {
2044 DOUT << "Starting HCD.\n";
2044 DEBUG(errs() << "Starting HCD.\n");
20452045 HCDSCCRep.resize(GraphNodes.size());
20462046
20472047 for (unsigned i = 0; i < GraphNodes.size(); ++i) {
20902090 Node2Visited.clear();
20912091 Node2Deleted.clear();
20922092 HCDSCCRep.clear();
2093 DOUT << "HCD complete.\n";
2093 DEBUG(errs() << "HCD complete.\n");
20942094 }
20952095
20962096 // Component of HCD:
21622162 /// Optimize the constraints by performing offline variable substitution and
21632163 /// other optimizations.
21642164 void Andersens::OptimizeConstraints() {
2165 DOUT << "Beginning constraint optimization\n";
2165 DEBUG(errs() << "Beginning constraint optimization\n");
21662166
21672167 SDTActive = false;
21682168
22462246
22472247 // HCD complete.
22482248
2249 DOUT << "Finished constraint optimization\n";
2249 DEBUG(errs() << "Finished constraint optimization\n");
22502250 FirstRefNode = 0;
22512251 FirstAdrNode = 0;
22522252 }
22542254 /// Unite pointer but not location equivalent variables, now that the constraint
22552255 /// graph is built.
22562256 void Andersens::UnitePointerEquivalences() {
2257 DOUT << "Uniting remaining pointer equivalences\n";
2257 DEBUG(errs() << "Uniting remaining pointer equivalences\n");
22582258 for (unsigned i = 0; i < GraphNodes.size(); ++i) {
22592259 if (GraphNodes[i].AddressTaken && GraphNodes[i].isRep()) {
22602260 unsigned Label = GraphNodes[i].PointerEquivLabel;
22632263 UniteNodes(i, PENLEClass2Node[Label]);
22642264 }
22652265 }
2266 DOUT << "Finished remaining pointer equivalences\n";
2266 DEBUG(errs() << "Finished remaining pointer equivalences\n");
22672267 PENLEClass2Node.clear();
22682268 }
22692269
24192419 std::vector RSV;
24202420 #endif
24212421 while( !CurrWL->empty() ) {
2422 DOUT << "Starting iteration #" << ++NumIters << "\n";
2422 DEBUG(errs() << "Starting iteration #" << ++NumIters << "\n");
24232423
24242424 Node* CurrNode;
24252425 unsigned CurrNodeIndex;
27222722 SecondNode->OldPointsTo = NULL;
27232723
27242724 NumUnified++;
2725 DOUT << "Unified Node ";
2725 DEBUG(errs() << "Unified Node ");
27262726 DEBUG(PrintNode(FirstNode));
2727 DOUT << " and Node ";
2727 DEBUG(errs() << " and Node ");
27282728 DEBUG(PrintNode(SecondNode));
2729 DOUT << "\n";
2729 DEBUG(errs() << "\n");
27302730
27312731 if (SDTActive)
27322732 if (SDT[Second] >= 0) {
256256 const SCEV *NewStart = SE->getMinusSCEV(Start, Stride);
257257 StrideUses->addUser(NewStart, User, I);
258258 StrideUses->Users.back().setIsUseOfPostIncrementedValue(true);
259 DOUT << " USING POSTINC SCEV, START=" << *NewStart<< "\n";
259 DEBUG(errs() << " USING POSTINC SCEV, START=" << *NewStart<< "\n");
260260 } else {
261261 StrideUses->addUser(Start, User, I);
262262 }
3535 #include "llvm/Support/Debug.h"
3636 #include "llvm/Support/ErrorHandling.h"
3737 #include "llvm/Support/MathExtras.h"
38 #include "llvm/Support/raw_ostream.h"
3839 #include
3940 #include
4041 using namespace llvm;
538539 bool AddTo) {
539540 assert(N->getNumValues() == NumTo && "Broken CombineTo call!");
540541 ++NodesCombined;
541 DOUT << "\nReplacing.1 "; DEBUG(N->dump(&DAG));
542 DOUT << "\nWith: "; DEBUG(To[0].getNode()->dump(&DAG));
543 DOUT << " and " << NumTo-1 << " other values\n";
544 DEBUG(for (unsigned i = 0, e = NumTo; i != e; ++i)
542 DEBUG(errs() << "\nReplacing.1 ";
543 N->dump(&DAG);
544 errs() << "\nWith: ";
545 To[0].getNode()->dump(&DAG);
546 errs() << " and " << NumTo-1 << " other values\n";
547 for (unsigned i = 0, e = NumTo; i != e; ++i)
545548 assert(N->getValueType(i) == To[i].getValueType() &&
546549 "Cannot combine value to value of different type!"));
547550 WorkListRemover DeadNodes(*this);
613616
614617 // Replace the old value with the new one.
615618 ++NodesCombined;
616 DOUT << "\nReplacing.2 "; DEBUG(TLO.Old.getNode()->dump(&DAG));
617 DOUT << "\nWith: "; DEBUG(TLO.New.getNode()->dump(&DAG));
618 DOUT << '\n';
619 DEBUG(errs() << "\nReplacing.2 ";
620 TLO.Old.getNode()->dump(&DAG);
621 errs() << "\nWith: ";
622 TLO.New.getNode()->dump(&DAG);
623 errs() << '\n');
619624
620625 CommitTargetLoweringOpt(TLO);
621626 return true;
681686 RV.getNode()->getOpcode() != ISD::DELETED_NODE &&
682687 "Node was deleted but visit returned new node!");
683688
684 DOUT << "\nReplacing.3 "; DEBUG(N->dump(&DAG));
685 DOUT << "\nWith: "; DEBUG(RV.getNode()->dump(&DAG));
686 DOUT << '\n';
689 DEBUG(errs() << "\nReplacing.3 ";
690 N->dump(&DAG);
691 errs() << "\nWith: ";
692 RV.getNode()->dump(&DAG);
693 errs() << '\n');
687694 WorkListRemover DeadNodes(*this);
688695 if (N->getNumValues() == RV.getNode()->getNumValues())
689696 DAG.ReplaceAllUsesWith(N, RV.getNode(), &DeadNodes);
46334640 BasePtr, Offset, AM);
46344641 ++PreIndexedNodes;
46354642 ++NodesCombined;
4636 DOUT << "\nReplacing.4 "; DEBUG(N->dump(&DAG));
4637 DOUT << "\nWith: "; DEBUG(Result.getNode()->dump(&DAG));
4638 DOUT << '\n';
4643 DEBUG(errs() << "\nReplacing.4 ";
4644 N->dump(&DAG);
4645 errs() << "\nWith: ";
4646 Result.getNode()->dump(&DAG);
4647 errs() << '\n');
46394648 WorkListRemover DeadNodes(*this);
46404649 if (isLoad) {
46414650 DAG.ReplaceAllUsesOfValueWith(SDValue(N, 0), Result.getValue(0),
47654774 BasePtr, Offset, AM);
47664775 ++PostIndexedNodes;
47674776 ++NodesCombined;
4768 DOUT << "\nReplacing.5 "; DEBUG(N->dump(&DAG));
4769 DOUT << "\nWith: "; DEBUG(Result.getNode()->dump(&DAG));
4770 DOUT << '\n';
4777 DEBUG(errs() << "\nReplacing.5 ";
4778 N->dump(&DAG);
4779 errs() << "\nWith: ";
4780 Result.getNode()->dump(&DAG);
4781 errs() << '\n');
47714782 WorkListRemover DeadNodes(*this);
47724783 if (isLoad) {
47734784 DAG.ReplaceAllUsesOfValueWith(SDValue(N, 0), Result.getValue(0),
48694880 // v3 = add v2, c
48704881 // Now we replace use of chain2 with chain1. This makes the second load
48714882 // isomorphic to the one we are deleting, and thus makes this load live.
4872 DOUT << "\nReplacing.6 "; DEBUG(N->dump(&DAG));
4873 DOUT << "\nWith chain: "; DEBUG(Chain.getNode()->dump(&DAG));
4874 DOUT << "\n";
4883 DEBUG(errs() << "\nReplacing.6 ";
4884 N->dump(&DAG);
4885 errs() << "\nWith chain: ";
4886 Chain.getNode()->dump(&DAG);
4887 errs() << "\n");
48754888 WorkListRemover DeadNodes(*this);
48764889 DAG.ReplaceAllUsesOfValueWith(SDValue(N, 1), Chain, &DeadNodes);
48774890
48874900 assert(N->getValueType(2) == MVT::Other && "Malformed indexed loads?");
48884901 if (N->hasNUsesOfValue(0, 0) && N->hasNUsesOfValue(0, 1)) {
48894902 SDValue Undef = DAG.getUNDEF(N->getValueType(0));
4890 DOUT << "\nReplacing.6 "; DEBUG(N->dump(&DAG));
4891 DOUT << "\nWith: "; DEBUG(Undef.getNode()->dump(&DAG));
4892 DOUT << " and 2 other values\n";
4903 DEBUG(errs() << "\nReplacing.6 ";
4904 N->dump(&DAG);
4905 errs() << "\nWith: ";
4906 Undef.getNode()->dump(&DAG);
4907 errs() << " and 2 other values\n");
48934908 WorkListRemover DeadNodes(*this);
48944909 DAG.ReplaceAllUsesOfValueWith(SDValue(N, 0), Undef, &DeadNodes);
48954910 DAG.ReplaceAllUsesOfValueWith(SDValue(N, 1),
2424 #include "llvm/ADT/STLExtras.h"
2525 #include "llvm/Support/CommandLine.h"
2626 #include "llvm/Support/ErrorHandling.h"
27 #include "llvm/Support/raw_ostream.h"
2728 using namespace llvm;
2829
2930 STATISTIC(NumUnfolds, "Number of nodes unfolded");
108109
109110 /// Schedule - Schedule the DAG using list scheduling.
110111 void ScheduleDAGFast::Schedule() {
111 DOUT << "********** List Scheduling **********\n";
112 DEBUG(errs() << "********** List Scheduling **********\n");
112113
113114 NumLiveRegs = 0;
114115 LiveRegDefs.resize(TRI->getNumRegs(), NULL);
174175 /// count of its predecessors. If a predecessor pending count is zero, add it to
175176 /// the Available queue.
176177 void ScheduleDAGFast::ScheduleNodeBottomUp(SUnit *SU, unsigned CurCycle) {
177 DOUT << "*** Scheduling [" << CurCycle << "]: ";
178 DEBUG(errs() << "*** Scheduling [" << CurCycle << "]: ");
178179 DEBUG(SU->dump(this));
179180
180181 assert(CurCycle >= SU->getHeight() && "Node scheduled below its height!");
232233 if (!TII->unfoldMemoryOperand(*DAG, N, NewNodes))
233234 return NULL;
234235
235 DOUT << "Unfolding SU # " << SU->NodeNum << "\n";
236 DEBUG(errs() << "Unfolding SU # " << SU->NodeNum << "\n");
236237 assert(NewNodes.size() == 2 && "Expected a load folding node!");
237238
238239 N = NewNodes[1];
342343 SU = NewSU;
343344 }
344345
345 DOUT << "Duplicating SU # " << SU->NodeNum << "\n";
346 DEBUG(errs() << "Duplicating SU # " << SU->NodeNum << "\n");
346347 NewSU = Clone(SU);
347348
348349 // New SUnit has the exact same predecessors.
549550 // Issue copies, these can be expensive cross register class copies.
550551 SmallVector Copies;
551552 InsertCopiesAndMoveSuccs(LRDef, Reg, DestRC, RC, Copies);
552 DOUT << "Adding an edge from SU # " << TrySU->NodeNum
553 << " to SU #" << Copies.front()->NodeNum << "\n";
553 DEBUG(errs() << "Adding an edge from SU # " << TrySU->NodeNum
554 << " to SU #" << Copies.front()->NodeNum << "\n");
554555 AddPred(TrySU, SDep(Copies.front(), SDep::Order, /*Latency=*/1,
555556 /*Reg=*/0, /*isNormalMemory=*/false,
556557 /*isMustAlias=*/false, /*isArtificial=*/true));
557558 NewDef = Copies.back();
558559 }
559560
560 DOUT << "Adding an edge from SU # " << NewDef->NodeNum
561 << " to SU #" << TrySU->NodeNum << "\n";
561 DEBUG(errs() << "Adding an edge from SU # " << NewDef->NodeNum
562 << " to SU #" << TrySU->NodeNum << "\n");
562563 LiveRegDefs[Reg] = NewDef;
563564 AddPred(NewDef, SDep(TrySU, SDep::Order, /*Latency=*/1,
564565 /*Reg=*/0, /*isNormalMemory=*/false,
2929 #include "llvm/Support/Debug.h"
3030 #include "llvm/Support/Compiler.h"
3131 #include "llvm/Support/ErrorHandling.h"
32 #include "llvm/Support/raw_ostream.h"
3233 #include "llvm/ADT/PriorityQueue.h"
3334 #include "llvm/ADT/Statistic.h"
3435 #include
8687
8788 /// Schedule - Schedule the DAG using list scheduling.
8889 void ScheduleDAGList::Schedule() {
89 DOUT << "********** List Scheduling **********\n";
90 DEBUG(errs() << "********** List Scheduling **********\n");
9091
9192 // Build the scheduling graph.
9293 BuildSchedGraph();
140141 /// count of its successors. If a successor pending count is zero, add it to
141142 /// the Available queue.
142143 void ScheduleDAGList::ScheduleNodeTopDown(SUnit *SU, unsigned CurCycle) {
143 DOUT << "*** Scheduling [" << CurCycle << "]: ";
144 DEBUG(errs() << "*** Scheduling [" << CurCycle << "]: ");
144145 DEBUG(SU->dump(this));
145146
146147 Sequence.push_back(SU);
232233 } else if (!HasNoopHazards) {
233234 // Otherwise, we have a pipeline stall, but no other problem, just advance
234235 // the current cycle and try again.
235 DOUT << "*** Advancing cycle, no work to do\n";
236 DEBUG(errs() << "*** Advancing cycle, no work to do\n");
236237 HazardRec->AdvanceCycle();
237238 ++NumStalls;
238239 ++CurCycle;
240241 // Otherwise, we have no instructions to issue and we have instructions
241242 // that will fault if we don't do this right. This is the case for
242243 // processors without pipeline interlocks and other cases.
243 DOUT << "*** Emitting noop\n";
244 DEBUG(errs() << "*** Emitting noop\n");
244245 HazardRec->EmitNoop();
245246 Sequence.push_back(0); // NULL here means noop
246247 ++NumNoops;
2929 #include "llvm/ADT/SmallSet.h"
3030 #include "llvm/ADT/Statistic.h"
3131 #include "llvm/ADT/STLExtras.h"
32 #include "llvm/Support/raw_ostream.h"
3233 #include
3334 using namespace llvm;
3435
163164
164165 /// Schedule - Schedule the DAG using list scheduling.
165166 void ScheduleDAGRRList::Schedule() {
166 DOUT << "********** List Scheduling **********\n";
167 DEBUG(errs() << "********** List Scheduling **********\n");
167168
168169 NumLiveRegs = 0;
169170 LiveRegDefs.resize(TRI->getNumRegs(), NULL);
237238 /// count of its predecessors. If a predecessor pending count is zero, add it to
238239 /// the Available queue.
239240 void ScheduleDAGRRList::ScheduleNodeBottomUp(SUnit *SU, unsigned CurCycle) {
240 DOUT << "*** Scheduling [" << CurCycle << "]: ";
241 DEBUG(errs() << "*** Scheduling [" << CurCycle << "]: ");
241242 DEBUG(SU->dump(this));
242243
243244 assert(CurCycle >= SU->getHeight() && "Node scheduled below its height!");
282283 /// UnscheduleNodeBottomUp - Remove the node from the schedule, update its and
283284 /// its predecessor states to reflect the change.
284285 void ScheduleDAGRRList::UnscheduleNodeBottomUp(SUnit *SU) {
285 DOUT << "*** Unscheduling [" << SU->getHeight() << "]: ";
286 DEBUG(errs() << "*** Unscheduling [" << SU->getHeight() << "]: ");
286287 DEBUG(SU->dump(this));
287288
288289 AvailableQueue->UnscheduledNode(SU);
369370 if (!TII->unfoldMemoryOperand(*DAG, N, NewNodes))
370371 return NULL;
371372
372 DOUT << "Unfolding SU # " << SU->NodeNum << "\n";
373 DEBUG(errs() << "Unfolding SU # " << SU->NodeNum << "\n");
373374 assert(NewNodes.size() == 2 && "Expected a load folding node!");
374375
375376 N = NewNodes[1];
488489 SU = NewSU;
489490 }
490491
491 DOUT << "Duplicating SU # " << SU->NodeNum << "\n";
492 DEBUG(errs() << "Duplicating SU # " << SU->NodeNum << "\n");
492493 NewSU = CreateClone(SU);
493494
494495 // New SUnit has the exact same predecessors.
769770 // Issue copies, these can be expensive cross register class copies.
770771 SmallVector Copies;
771772 InsertCopiesAndMoveSuccs(LRDef, Reg, DestRC, RC, Copies);
772 DOUT << "Adding an edge from SU #" << TrySU->NodeNum
773 << " to SU #" << Copies.front()->NodeNum << "\n";
773 DEBUG(errs() << "Adding an edge from SU #" << TrySU->NodeNum
774 << " to SU #" << Copies.front()->NodeNum << "\n");
774775 AddPred(TrySU, SDep(Copies.front(), SDep::Order, /*Latency=*/1,
775776 /*Reg=*/0, /*isNormalMemory=*/false,
776777 /*isMustAlias=*/false,
778779 NewDef = Copies.back();
779780 }
780781
781 DOUT << "Adding an edge from SU #" << NewDef->NodeNum
782 << " to SU #" << TrySU->NodeNum << "\n";
782 DEBUG(errs() << "Adding an edge from SU #" << NewDef->NodeNum
783 << " to SU #" << TrySU->NodeNum << "\n");
783784 LiveRegDefs[Reg] = NewDef;
784785 AddPred(NewDef, SDep(TrySU, SDep::Order, /*Latency=*/1,
785786 /*Reg=*/0, /*isNormalMemory=*/false,
856857 /// count of its successors. If a successor pending count is zero, add it to
857858 /// the Available queue.
858859 void ScheduleDAGRRList::ScheduleNodeTopDown(SUnit *SU, unsigned CurCycle) {
859 DOUT << "*** Scheduling [" << CurCycle << "]: ";
860 DEBUG(errs() << "*** Scheduling [" << CurCycle << "]: ");
860861 DEBUG(SU->dump(this));
861862
862863 assert(CurCycle >= SU->getDepth() && "Node scheduled above its depth!");
13281329
13291330 // Ok, the transformation is safe and the heuristics suggest it is
13301331 // profitable. Update the graph.
1331 DOUT << "Prescheduling SU # " << SU->NodeNum
1332 << " next to PredSU # " << PredSU->NodeNum
1333 << " to guide scheduling in the presence of multiple uses\n";
1332 DEBUG(errs() << "Prescheduling SU # " << SU->NodeNum
1333 << " next to PredSU # " << PredSU->NodeNum
1334 << " to guide scheduling in the presence of multiple uses\n");
13341335 for (unsigned i = 0; i != PredSU->Succs.size(); ++i) {
13351336 SDep Edge = PredSU->Succs[i];
13361337 assert(!Edge.isAssignedRegDep());
14181419 (hasCopyToRegUse(SU) && !hasCopyToRegUse(SuccSU)) ||
14191420 (!SU->isCommutable && SuccSU->isCommutable)) &&
14201421 !scheduleDAG->IsReachable(SuccSU, SU)) {
1421 DOUT << "Adding a pseudo-two-addr edge from SU # " << SU->NodeNum
1422 << " to SU #" << SuccSU->NodeNum << "\n";
1422 DEBUG(errs() << "Adding a pseudo-two-addr edge from SU # "
1423 << SU->NodeNum << " to SU #" << SuccSU->NodeNum << "\n");
14231424 scheduleDAG->AddPred(SU, SDep(SuccSU, SDep::Order, /*Latency=*/0,
14241425 /*Reg=*/0, /*isNormalMemory=*/false,
14251426 /*isMustAlias=*/false,
466466 BlockName = MF->getFunction()->getNameStr() + ":" +
467467 BB->getBasicBlock()->getNameStr();
468468
469 DOUT << "Initial selection DAG:\n";
469 DEBUG(errs() << "Initial selection DAG:\n");
470470 DEBUG(CurDAG->dump());
471471
472472 if (ViewDAGCombine1) CurDAG->viewGraph("dag-combine1 input for " + BlockName);
479479 CurDAG->Combine(Unrestricted, *AA, OptLevel);
480480 }
481481
482 DOUT << "Optimized lowered selection DAG:\n";
482 DEBUG(errs() << "Optimized lowered selection DAG:\n");
483483 DEBUG(CurDAG->dump());
484484
485485 // Second step, hack on the DAG until it only uses operations and types that
496496 Changed = CurDAG->LegalizeTypes();
497497 }
498498
499 DOUT << "Type-legalized selection DAG:\n";
499 DEBUG(errs() << "Type-legalized selection DAG:\n");
500500 DEBUG(CurDAG->dump());
501501
502502 if (Changed) {
511511 CurDAG->Combine(NoIllegalTypes, *AA, OptLevel);
512512 }
513513
514 DOUT << "Optimized type-legalized selection DAG:\n";
514 DEBUG(errs() << "Optimized type-legalized selection DAG:\n");
515515 DEBUG(CurDAG->dump());
516516 }
517517
541541 CurDAG->Combine(NoIllegalOperations, *AA, OptLevel);
542542 }
543543
544 DOUT << "Optimized vector-legalized selection DAG:\n";
544 DEBUG(errs() << "Optimized vector-legalized selection DAG:\n");
545545 DEBUG(CurDAG->dump());
546546 }
547547 }
555555 CurDAG->Legalize(DisableLegalizeTypes, OptLevel);
556556 }
557557
558 DOUT << "Legalized selection DAG:\n";
558 DEBUG(errs() << "Legalized selection DAG:\n");
559559 DEBUG(CurDAG->dump());
560560
561561 if (ViewDAGCombine2) CurDAG->viewGraph("dag-combine2 input for " + BlockName);
568568 CurDAG->Combine(NoIllegalOperations, *AA, OptLevel);
569569 }
570570
571 DOUT << "Optimized legalized selection DAG:\n";
571 DEBUG(errs() << "Optimized legalized selection DAG:\n");
572572 DEBUG(CurDAG->dump());
573573
574574 if (ViewISelDAGs) CurDAG->viewGraph("isel input for " + BlockName);
585585 InstructionSelect();
586586 }
587587
588 DOUT << "Selected selection DAG:\n";
588 DEBUG(errs() << "Selected selection DAG:\n");
589589 DEBUG(CurDAG->dump());
590590
591591 if (ViewSchedDAGs) CurDAG->viewGraph("scheduler input for " + BlockName);
618618 delete Scheduler;
619619 }
620620
621 DOUT << "Selected machine code:\n";
621 DEBUG(errs() << "Selected machine code:\n");
622622 DEBUG(BB->dump());
623623 }
624624
798798 void
799799 SelectionDAGISel::FinishBasicBlock() {
800800
801 DOUT << "Target-post-processed machine code:\n";
801 DEBUG(errs() << "Target-post-processed machine code:\n");
802802 DEBUG(BB->dump());
803803
804 DOUT << "Total amount of phi nodes to update: "
805 << SDL->PHINodesToUpdate.size() << "\n";
804 DEBUG(errs() << "Total amount of phi nodes to update: "
805 << SDL->PHINodesToUpdate.size() << "\n");
806806 DEBUG(for (unsigned i = 0, e = SDL->PHINodesToUpdate.size(); i != e; ++i)
807 DOUT << "Node " << i << " : (" << SDL->PHINodesToUpdate[i].first
808 << ", " << SDL->PHINodesToUpdate[i].second << ")\n";);
807 errs() << "Node " << i << " : ("
808 << SDL->PHINodesToUpdate[i].first
809 << ", " << SDL->PHINodesToUpdate[i].second << ")\n");
809810
810811 // Next, now that we know what the last MBB the LLVM BB expanded is, update
811812 // PHI nodes in successors.
215215 if (level >= 20) {
216216 if (!printed) {
217217 printed = true;
218 DOUT << "setSubgraphColor hit max level\n";
218 DEBUG(errs() << "setSubgraphColor hit max level\n");
219219 }
220220 return true;
221221 }
197197 Assignments.resize(LastFI);
198198
199199 // Gather all spill slots into a list.
200 DOUT << "Spill slot intervals:\n";
200 DEBUG(errs() << "Spill slot intervals:\n");
201201 for (LiveStacks::iterator i = LS->begin(), e = LS->end(); i != e; ++i) {
202202 LiveInterval &li = i->second;
203203 DEBUG(li.dump());
209209 OrigSizes[FI] = MFI->getObjectSize(FI);
210210 AllColors.set(FI);
211211 }
212 DOUT << '\n';
212 DEBUG(errs() << '\n');
213213
214214 // Sort them by weight.
215215 std::stable_sort(SSIntervals.begin(), SSIntervals.end(), IntervalSorter());
241241 return false;
242242
243243 bool Changed = false;
244 DOUT << "Assigning unused registers to spill slots:\n";
244 DEBUG(errs() << "Assigning unused registers to spill slots:\n");
245245 for (unsigned i = 0, e = SSIntervals.size(); i != e; ++i) {
246246 LiveInterval *li = SSIntervals[i];
247247 int SS = li->getStackSlotIndex();
271271 AllColored = false;
272272 continue;
273273 } else {
274 DOUT << "Assigning fi#" << RSS << " to " << TRI->getName(Reg) << '\n';
274 DEBUG(errs() << "Assigning fi#" << RSS << " to "
275 << TRI->getName(Reg) << '\n');
275276 ColoredRegs.push_back(Reg);
276277 SlotMapping[RSS] = Reg;
277278 SlotIsReg.set(RSS);
298299 ++NumEliminated;
299300 }
300301 }
301 DOUT << '\n';
302 DEBUG(errs() << '\n');
302303
303304 return Changed;
304305 }
333334 // Record the assignment.
334335 Assignments[Color].push_back(li);
335336 int FI = li->getStackSlotIndex();
336 DOUT << "Assigning fi#" << FI << " to fi#" << Color << "\n";
337 DEBUG(errs() << "Assigning fi#" << FI << " to fi#" << Color << "\n");
337338
338339 // Change size and alignment of the allocated slot. If there are multiple
339340 // objects sharing the same slot, then make sure the size and alignment
357358 BitVector SlotIsReg(NumObjs);
358359 BitVector UsedColors(NumObjs);
359360
360 DOUT << "Color spill slot intervals:\n";
361 DEBUG(errs() << "Color spill slot intervals:\n");
361362 bool Changed = false;
362363 for (unsigned i = 0, e = SSIntervals.size(); i != e; ++i) {
363364 LiveInterval *li = SSIntervals[i];
371372 Changed |= (SS != NewSS);
372373 }
373374
374 DOUT << "\nSpill slots after coloring:\n";
375 DEBUG(errs() << "\nSpill slots after coloring:\n");
375376 for (unsigned i = 0, e = SSIntervals.size(); i != e; ++i) {
376377 LiveInterval *li = SSIntervals[i];
377378 int SS = li->getStackSlotIndex();
383384 #ifndef NDEBUG
384385 for (unsigned i = 0, e = SSIntervals.size(); i != e; ++i)
385386 DEBUG(SSIntervals[i]->dump());
386 DOUT << '\n';
387 DEBUG(errs() << '\n');
387388 #endif
388389
389390 // Can we "color" a stack slot with a unused register?
415416
416417 // Delete unused stack slots.
417418 while (NextColor != -1) {
418 DOUT << "Removing unused stack object fi#" << NextColor << "\n";
419 DEBUG(errs() << "Removing unused stack object fi#" << NextColor << "\n");
419420 MFI->RemoveStackObject(NextColor);
420421 NextColor = AllColors.find_next(NextColor);
421422 }
609610 MachineBasicBlock *MBB = MI->getParent();
610611 if (unsigned DstReg = TII->isLoadFromStackSlot(MI, OldFI)) {
611612 if (PropagateForward(MI, MBB, DstReg, Reg)) {
612 DOUT << "Eliminated load: ";
613 DEBUG(errs() << "Eliminated load: ");
613614 DEBUG(MI->dump());
614615 ++NumLoadElim;
615616 } else {
625626 }
626627 } else if (unsigned SrcReg = TII->isStoreToStackSlot(MI, OldFI)) {
627628 if (MI->killsRegister(SrcReg) && PropagateBackward(MI, MBB, SrcReg, Reg)) {
628 DOUT << "Eliminated store: ";
629 DEBUG(errs() << "Eliminated store: ");
629630 DEBUG(MI->dump());
630631 ++NumStoreElim;
631632 } else {
703704
704705
705706 bool StackSlotColoring::runOnMachineFunction(MachineFunction &MF) {
706 DOUT << "********** Stack Slot Coloring **********\n";
707 DEBUG(errs() << "********** Stack Slot Coloring **********\n");
707708
708709 MFI = MF.getFrameInfo();
709710 MRI = &MF.getRegInfo();
553553 // Add the renaming set for this PHI node to our overall renaming information
554554 for (std::map::iterator QI = PHIUnion.begin(),
555555 QE = PHIUnion.end(); QI != QE; ++QI) {
556 DOUT << "Adding Renaming: " << QI->first << " -> "
557 << P->getOperand(0).getReg() << "\n";
556 DEBUG(errs() << "Adding Renaming: " << QI->first << " -> "
557 << P->getOperand(0).getReg() << "\n");
558558 }
559559
560560 RenameSets.insert(std::make_pair(P->getOperand(0).getReg(), PHIUnion));
696696 TII->copyRegToReg(*PI->getParent(), PI, t,
697697 curr.second, RC, RC);
698698
699 DOUT << "Inserted copy from " << curr.second << " to " << t << "\n";
699 DEBUG(errs() << "Inserted copy from " << curr.second << " to " << t
700 << "\n");
700701
701702 // Push temporary on Stacks
702703 Stacks[curr.second].push_back(t);
712713 TII->copyRegToReg(*MBB, MBB->getFirstTerminator(), curr.second,
713714 map[curr.first], RC, RC);
714715 map[curr.first] = curr.second;
715 DOUT << "Inserted copy from " << curr.first << " to "
716 << curr.second << "\n";
716 DEBUG(errs() << "Inserted copy from " << curr.first << " to "
717 << curr.second << "\n");
717718
718719 // Push this copy onto InsertedPHICopies so we can
719720 // update LiveIntervals with it.
927928 unsigned reg = OI->first;
928929 ++OI;
929930 I->second.erase(reg);
930 DOUT << "Removing Renaming: " << reg << " -> " << I->first << "\n";
931 DEBUG(errs() << "Removing Renaming: " << reg << " -> " << I->first
932 << "\n");
931933 }
932934 }
933935 }
944946 while (I->second.size()) {
945947 std::map::iterator SI = I->second.begin();
946948
947 DOUT << "Renaming: " << SI->first << " -> " << I->first << "\n";
949 DEBUG(errs() << "Renaming: " << SI->first << " -> " << I->first << "\n");
948950
949951 if (SI->first != I->first) {
950952 if (mergeLiveIntervals(I->first, SI->first)) {
976978 R.valno->setCopy(--SI->second->getFirstTerminator());
977979 R.valno->def = LiveIntervals::getDefIndex(instrIdx);
978980
979 DOUT << "Renaming failed: " << SI->first << " -> "
980 << I->first << "\n";
981 DEBUG(errs() << "Renaming failed: " << SI->first << " -> "
982 << I->first << "\n");
981983 }
982984 }
983985
242242 unsigned PtrSize = EE->getTargetData()->getPointerSize();
243243 char *Result = new char[(InputArgv.size()+1)*PtrSize];
244244
245 DOUT << "JIT: ARGV = " << (void*)Result << "\n";
245 DEBUG(errs() << "JIT: ARGV = " << (void*)Result << "\n");
246246 const Type *SBytePtr = PointerType::getUnqual(Type::getInt8Ty(C));
247247
248248 for (unsigned i = 0; i != InputArgv.size(); ++i) {
249249 unsigned Size = InputArgv[i].size()+1;
250250 char *Dest = new char[Size];
251 DOUT << "JIT: ARGV[" << i << "] = " << (void*)Dest << "\n";
251 DEBUG(errs() << "JIT: ARGV[" << i << "] = " << (void*)Dest << "\n");
252252
253253 std::copy(InputArgv[i].begin(), InputArgv[i].end(), Dest);
254254 Dest[Size-1] = 0;
898898 // specified memory location...
899899 //
900900 void ExecutionEngine::InitializeMemory(const Constant *Init, void *Addr) {
901 DOUT << "JIT: Initializing " << Addr << " ";
901 DEBUG(errs() << "JIT: Initializing " << Addr << " ");
902902 DEBUG(Init->dump());
903903 if (isa(Init)) {
904904 return;
268268 Stub = TheJIT->getJITInfo().emitFunctionStub(0, FnAddr,
269269 *TheJIT->getCodeEmitter());
270270
271 DOUT << "JIT: Stub emitted at [" << Stub
272 << "] for external function at '" << FnAddr << "'\n";
271 DEBUG(errs() << "JIT: Stub emitted at [" << Stub
272 << "] for external function at '" << FnAddr << "'\n");
273273 return Stub;
274274 }
275275
278278 if (!idx) {
279279 idx = ++nextGOTIndex;
280280 revGOTMap[addr] = idx;
281 DOUT << "JIT: Adding GOT entry " << idx << " for addr [" << addr << "]\n";
281 DEBUG(errs() << "JIT: Adding GOT entry " << idx << " for addr ["
282 << addr << "]\n");
282283 }
283284 return idx;
284285 }
507508 MemMgr = JMM ? JMM : JITMemoryManager::CreateDefaultMemManager();
508509 if (jit.getJITInfo().needsGOT()) {
509510 MemMgr->AllocateGOT();
510 DOUT << "JIT is managing a GOT\n";
511 DEBUG(errs() << "JIT is managing a GOT\n");
511512 }
512513
513514 if (DwarfExceptionHandling) DE = new JITDwarfEmitter(jit);
555556 if (MBBLocations.size() <= (unsigned)MBB->getNumber())
556557 MBBLocations.resize((MBB->getNumber()+1)*2);
557558 MBBLocations[MBB->getNumber()] = getCurrentPCValue();
558 DOUT << "JIT: Emitting BB" << MBB->getNumber() << " at ["
559 << (void*) getCurrentPCValue() << "]\n";
559 DEBUG(errs() << "JIT: Emitting BB" << MBB->getNumber() << " at ["
560 << (void*) getCurrentPCValue() << "]\n");
560561 }
561562
562563 virtual uintptr_t getConstantPoolEntryAddress(unsigned Entry) const;
755756 size_t GVSize = (size_t)TheJIT->getTargetData()->getTypeAllocSize(ElTy);
756757 size_t GVAlign =
757758 (size_t)TheJIT->getTargetData()->getPreferredAlignment(GV);
758 DOUT << "JIT: Adding in size " << GVSize << " alignment " << GVAlign;
759 DEBUG(errs() << "JIT: Adding in size " << GVSize << " alignment " << GVAlign);
759760 DEBUG(GV->dump());
760761 // Assume code section ends with worst possible alignment, so first
761762 // variable needs maximal padding.
883884 }
884885 }
885886 }
886 DOUT << "JIT: About to look through initializers\n";
887 DEBUG(errs() << "JIT: About to look through initializers\n");
887888 // Look for more globals that are referenced only from initializers.
888889 // GVSet.end is computed each time because the set can grow as we go.
889890 for (SmallPtrSet::iterator I = GVSet.begin();
904905 // Set the memory writable, if it's not already
905906 MemMgr->setMemoryWritable();
906907 if (MemMgr->NeedsExactSize()) {
907 DOUT << "JIT: ExactSize\n";
908 DEBUG(errs() << "JIT: ExactSize\n");
908909 const TargetInstrInfo* TII = F.getTarget().getInstrInfo();
909910 MachineJumpTableInfo *MJTI = F.getJumpTableInfo();
910911 MachineConstantPool *MCP = F.getConstantPool();
931932 // Add the function size
932933 ActualSize += TII->GetFunctionSizeInBytes(F);
933934
934 DOUT << "JIT: ActualSize before globals " << ActualSize << "\n";
935 DEBUG(errs() << "JIT: ActualSize before globals " << ActualSize << "\n");
935936 // Add the size of the globals that will be allocated after this function.
936937 // These are all the ones referenced from this function that were not
937938 // previously allocated.
938939 ActualSize += GetSizeOfGlobalsInBytes(F);
939 DOUT << "JIT: ActualSize after globals " << ActualSize << "\n";
940 DEBUG(errs() << "JIT: ActualSize after globals " << ActualSize << "\n");
940941 } else if (SizeEstimate > 0) {
941942 // SizeEstimate will be non-zero on reallocation attempts.
942943 ActualSize = SizeEstimate;
993994 if (MR.isExternalSymbol()) {
994995 ResultPtr = TheJIT->getPointerToNamedFunction(MR.getExternalSymbol(),
995996 false);
996 DOUT << "JIT: Map \'" << MR.getExternalSymbol() << "\' to ["
997 << ResultPtr << "]\n";
997 DEBUG(errs() << "JIT: Map \'" << MR.getExternalSymbol() << "\' to ["
998 << ResultPtr << "]\n");
998999
9991000 // If the target REALLY wants a stub for this function, emit it now.
10001001 if (!MR.doesntNeedStub()) {
10351036 unsigned idx = Resolver.getGOTIndexForAddr(ResultPtr);
10361037 MR.setGOTIndex(idx);
10371038 if (((void**)MemMgr->getGOTBase())[idx] != ResultPtr) {
1038 DOUT << "JIT: GOT was out of date for " << ResultPtr
1039 << " pointing at " << ((void**)MemMgr->getGOTBase())[idx]
1040 << "\n";
1039 DEBUG(errs() << "JIT: GOT was out of date for " << ResultPtr
1040 << " pointing at " << ((void**)MemMgr->getGOTBase())[idx]
1041 << "\n");
10411042 ((void**)MemMgr->getGOTBase())[idx] = ResultPtr;
10421043 }
10431044 }
10521053 if (MemMgr->isManagingGOT()) {
10531054 unsigned idx = Resolver.getGOTIndexForAddr((void*)BufferBegin);
10541055 if (((void**)MemMgr->getGOTBase())[idx] != (void*)BufferBegin) {
1055 DOUT << "JIT: GOT was out of date for " << (void*)BufferBegin
1056 << " pointing at " << ((void**)MemMgr->getGOTBase())[idx] << "\n";
1056 DEBUG(errs() << "JIT: GOT was out of date for " << (void*)BufferBegin
1057 << " pointing at " << ((void**)MemMgr->getGOTBase())[idx]
1058 << "\n");
10571059 ((void**)MemMgr->getGOTBase())[idx] = (void*)BufferBegin;
10581060 }
10591061 }
10911093 // Mark code region readable and executable if it's not so already.
10921094 MemMgr->setMemoryExecutable();
10931095
1094 #ifndef NDEBUG
1095 {
1096 DEBUG(
10961097 if (sys::hasDisassembler()) {
1097 DOUT << "JIT: Disassembled code:\n";
1098 DOUT << sys::disassembleBuffer(FnStart, FnEnd-FnStart, (uintptr_t)FnStart);
1098 errs() << "JIT: Disassembled code:\n";
1099 errs() << sys::disassembleBuffer(FnStart, FnEnd-FnStart,
1100 (uintptr_t)FnStart);
10991101 } else {
1100 DOUT << "JIT: Binary code:\n";
1101 DOUT << std::hex;
1102 errs() << "JIT: Binary code:\n";
11021103 uint8_t* q = FnStart;
11031104 for (int i = 0; q < FnEnd; q += 4, ++i) {
11041105 if (i == 4)
11051106 i = 0;
11061107 if (i == 0)
1107 DOUT << "JIT: " << std::setw(8) << std::setfill('0')
1108 << (long)(q - FnStart) << ": ";
1108 errs() << "JIT: " << (long)(q - FnStart) << ": ";
11091109 bool Done = false;
11101110 for (int j = 3; j >= 0; --j) {
11111111 if (q + j >= FnEnd)
11121112 Done = true;
11131113 else
1114 DOUT << std::setw(2) << std::setfill('0') << (unsigned short)q[j];
1114 errs() << (unsigned short)q[j];
11151115 }
11161116 if (Done)
11171117 break;
1118 DOUT << ' ';
1118 errs() << ' ';
11191119 if (i == 3)
1120 DOUT << '\n';
1120 errs() << '\n';
11211121 }
1122 DOUT << std::dec;
1123 DOUT<< '\n';
1124 }
1125 }
1126 #endif
1122 errs()<< '\n';
1123 }
1124 );
1125
11271126 if (DwarfExceptionHandling) {
11281127 uintptr_t ActualSize = 0;
11291128 SavedBufferBegin = BufferBegin;
11541153 }
11551154
11561155 void JITEmitter::retryWithMoreMemory(MachineFunction &F) {
1157 DOUT << "JIT: Ran out of space for native code. Reattempting.\n";
1156 DEBUG(errs() << "JIT: Ran out of space for native code. Reattempting.\n");
11581157 Relocations.clear(); // Clear the old relocations or we'll reapply them.
11591158 ConstPoolAddresses.clear();
11601159 ++NumRetries;
11891188 // in the JITResolver. Were there a memory manager deallocateStub routine,
11901189 // we could call that at this point too.
11911190 if (FnRefs.empty()) {
1192 DOUT << "\nJIT: Invalidated Stub at [" << Stub << "]\n";
1191 DEBUG(errs() << "\nJIT: Invalidated Stub at [" << Stub << "]\n");
11931192 StubFnRefs.erase(Stub);
11941193
11951194 // Invalidate the stub. If it is a GV stub, update the JIT's global
12441243
12451244 if (ConstantPoolBase == 0) return; // Buffer overflow.
12461245
1247 DOUT << "JIT: Emitted constant pool at [" << ConstantPoolBase
1248 << "] (size: " << Size << ", alignment: " << Align << ")\n";
1246 DEBUG(errs() << "JIT: Emitted constant pool at [" << ConstantPoolBase
1247 << "] (size: " << Size << ", alignment: " << Align << ")\n");
12491248
12501249 // Initialize the memory for all of the constant pool entries.
12511250 unsigned Offset = 0;
12621261 "entry has not been implemented!");
12631262 }
12641263 TheJIT->InitializeMemory(CPE.Val.ConstVal, (void*)CAddr);
1265 DOUT << "JIT: CP" << i << " at [0x"
1266 << std::hex << CAddr << std::dec << "]\n";
1264 DEBUG(errs() << "JIT: CP" << i << " at [0x";
1265 errs().write_hex(CAddr) << "]\n");
12671266
12681267 const Type *Ty = CPE.Val.ConstVal->getType();
12691268 Offset += TheJIT->getTargetData()->getTypeAllocSize(Ty);
356356 // another block of memory and add it to the free list.
357357 if (largest < ActualSize ||
358358 largest <= FreeRangeHeader::getMinBlockSize()) {
359 DOUT << "JIT: Allocating another slab of memory for function.";
359 DEBUG(errs() << "JIT: Allocating another slab of memory for function.");
360360 candidateBlock = allocateNewCodeSlab((size_t)ActualSize);
361361 }
362362
4949 : Agent(op_open_agent()) {
5050 if (Agent == NULL) {
5151 const std::string err_str = sys::StrError();
52 DOUT << "Failed to connect to OProfile agent: " << err_str << "\n";
52 DEBUG(errs() << "Failed to connect to OProfile agent: " << err_str << "\n");
5353 } else {
54 DOUT << "Connected to OProfile agent.\n";
54 DEBUG(errs() << "Connected to OProfile agent.\n");
5555 }
5656 }
5757
5959 if (Agent != NULL) {
6060 if (op_close_agent(Agent) == -1) {
6161 const std::string err_str = sys::StrError();
62 DOUT << "Failed to disconnect from OProfile agent: " << err_str << "\n";
62 DEBUG(errs() << "Failed to disconnect from OProfile agent: "
63 << err_str << "\n");
6364 } else {
64 DOUT << "Disconnected from OProfile agent.\n";
65 DEBUG(errs() << "Disconnected from OProfile agent.\n");
6566 }
6667 }
6768 }
9899 const DebugLocTuple& tuple = MF.getDebugLocTuple(Loc);
99100 Result.lineno = tuple.Line;
100101 Result.filename = Filenames.getFilename(tuple.CompileUnit);
101 DOUT << "Mapping " << reinterpret_cast(Result.vma) << " to "
102 << Result.filename << ":" << Result.lineno << "\n";
102 DEBUG(errs() << "Mapping " << reinterpret_cast(Result.vma) << " to "
103 << Result.filename << ":" << Result.lineno << "\n");
103104 return Result;
104105 }
105106
551551 if (!LiveValues.insert(RA).second)
552552 return; // We were already marked Live.
553553
554 DOUT << "DAE - Marking " << RA.getDescription() << " live\n";
554 DEBUG(errs() << "DAE - Marking " << RA.getDescription() << " live\n");
555555 PropagateLiveness(RA);
556556 }
557557
915915 // removed. We can do this if they never call va_start. This loop cannot be
916916 // fused with the next loop, because deleting a function invalidates
917917 // information computed while surveying other functions.
918 DOUT << "DAE - Deleting dead varargs\n";
918 DEBUG(errs() << "DAE - Deleting dead varargs\n");
919919 for (Module::iterator I = M.begin(), E = M.end(); I != E; ) {
920920 Function &F = *I++;
921921 if (F.getFunctionType()->isVarArg())
926926 // We assume all arguments are dead unless proven otherwise (allowing us to
927927 // determine that dead arguments passed into recursive functions are dead).
928928 //
929 DOUT << "DAE - Determining liveness\n";
929 DEBUG(errs() << "DAE - Determining liveness\n");
930930 for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I)
931931 SurveyFunction(*I);
932932
632632 bool LocalChanged;
633633 do {
634634 LocalChanged = false;
635 DOUT << "size: " << FnMap.size() << "\n";
635 DEBUG(errs() << "size: " << FnMap.size() << "\n");
636636 for (std::map >::iterator
637637 I = FnMap.begin(), E = FnMap.end(); I != E; ++I) {
638638 std::vector &FnVec = I->second;
639 DOUT << "hash (" << I->first << "): " << FnVec.size() << "\n";
639 DEBUG(errs() << "hash (" << I->first << "): " << FnVec.size() << "\n");
640640
641641 for (int i = 0, e = FnVec.size(); i != e; ++i) {
642642 for (int j = i + 1; j != e; ++j) {
104104
105105 // Check if it is ok to perform this promotion.
106106 if (isSafeToUpdateAllCallers(F) == false) {
107 DOUT << "SretPromotion: Not all callers can be updated\n";
107 DEBUG(errs() << "SretPromotion: Not all callers can be updated\n");
108108 NumRejectedSRETUses++;
109109 return false;
110110 }
111111
112 DOUT << "SretPromotion: sret argument will be promoted\n";
112 DEBUG(errs() << "SretPromotion: sret argument will be promoted\n");
113113 NumSRET++;
114114 // [1] Replace use of sret parameter
115115 AllocaInst *TheAlloca = new AllocaInst(STy, NULL, "mrv",
12211221
12221222 /// dump - Dump a set of values to standard error
12231223 void GVNPRE::dump(ValueNumberedSet& s) const {
1224 DOUT << "{ ";
1224 DEBUG(errs() << "{ ");
12251225 for (ValueNumberedSet::iterator I = s.begin(), E = s.end();
12261226 I != E; ++I) {
1227 DOUT << "" << VN.lookup(*I) << ": ";
1227 DEBUG(errs() << "" << VN.lookup(*I) << ": ");
12281228 DEBUG((*I)->dump());
12291229 }
1230 DOUT << "}\n\n";
1230 DEBUG(errs() << "}\n\n");
12311231 }
12321232
12331233 /// elimination - Phase 3 of the main algorithm. Perform full redundancy