// debug build, then the code specified as the option to the macro will be
// executed. Otherwise it will not be. Example:
//
-// DEBUG(std::cerr << "Bitset contains: " << Bitset << "\n");
+// DOUT << "Bitset contains: " << Bitset << "\n";
//</i>
<span class="doc_hilite">#ifdef NDEBUG
#define DEBUG(X)
<div class="doc_code">
<pre>
-DEBUG(std::cerr << "I am here!\n");
+DOUT << "I am here!\n";
</pre>
</div>
<div class="doc_code">
<pre>
-DEBUG(std::cerr << "No debug type\n");
+DOUT << "No debug type\n";
#undef DEBUG_TYPE
#define DEBUG_TYPE "foo"
-DEBUG(std::cerr << "'foo' debug type\n");
+DOUT << "'foo' debug type\n";
#undef DEBUG_TYPE
#define DEBUG_TYPE "bar"
-DEBUG(std::cerr << "'bar' debug type\n");
+DOUT << "'bar' debug type\n";
#undef DEBUG_TYPE
#define DEBUG_TYPE ""
-DEBUG(std::cerr << "No debug type (2)\n");
+DOUT << "No debug type (2)\n";
</pre>
</div>
for (Function::iterator i = func->begin(), e = func->end(); i != e; ++i)
// <i>Print out the name of the basic block if it has one, and then the</i>
// <i>number of instructions that it contains</i>
- std::cerr << "Basic block (name=" << i->getName() << ") has "
- << i->size() << " instructions.\n";
+ llvm::cerr << "Basic block (name=" << i->getName() << ") has "
+ << i->size() << " instructions.\n";
</pre>
</div>
for (BasicBlock::iterator i = blk->begin(), e = blk->end(); i != e; ++i)
// <i>The next statement works since operator<<(ostream&,...)</i>
// <i>is overloaded for Instruction&</i>
- std::cerr << *i << "\n";
+ llvm::cerr << *i << "\n";
</pre>
</div>
<p>However, this isn't really the best way to print out the contents of a
<tt>BasicBlock</tt>! Since the ostream operators are overloaded for virtually
anything you'll care about, you could have just invoked the print routine on the
-basic block itself: <tt>std::cerr << *blk << "\n";</tt>.</p>
+basic block itself: <tt>llvm::cerr << *blk << "\n";</tt>.</p>
</div>
// <i>F is a ptr to a Function instance</i>
for (inst_iterator i = inst_begin(F), e = inst_end(F); i != e; ++i)
- std::cerr << *i << "\n";
+ llvm::cerr << *i << "\n";
</pre>
</div>
void printNextInstruction(Instruction* inst) {
BasicBlock::iterator it(inst);
++it; // <i>After this line, it refers to the instruction after *inst</i>
- if (it != inst->getParent()->end()) std::cerr << *it << "\n";
+ if (it != inst->getParent()->end()) llvm::cerr << *it << "\n";
}
</pre>
</div>
for (Value::use_iterator i = F->use_begin(), e = F->use_end(); i != e; ++i)
if (Instruction *Inst = dyn_cast<Instruction>(*i)) {
- std::cerr << "F is used in instruction:\n";
- std::cerr << *Inst << "\n";
+ llvm::cerr << "F is used in instruction:\n";
+ llvm::cerr << *Inst << "\n";
}
</pre>
</div>
<div class="doc_code"><pre>
<b>virtual bool</b> <a href="#runOnFunction">runOnFunction</a>(Function &F) {
- std::cerr << "<i>Hello: </i>" << F.getName() << "\n";
+ llvm::cerr << "<i>Hello: </i>" << F.getName() << "\n";
<b>return false</b>;
}
}; <i>// end of struct Hello</i>
<b>namespace</b> {
<b>struct Hello</b> : <b>public</b> <a href="#FunctionPass">FunctionPass</a> {
<b>virtual bool</b> <a href="#runOnFunction">runOnFunction</a>(Function &F) {
- std::cerr << "<i>Hello: </i>" << F.getName() << "\n";
+ llvm::cerr << "<i>Hello: </i>" << F.getName() << "\n";
<b>return false</b>;
}
};
<div class="doc_text">
<div class="doc_code"><pre>
- <b>virtual void</b> print(std::ostream &O, <b>const</b> Module *M) <b>const</b>;
+ <b>virtual void</b> print(llvm::OStream &O, <b>const</b> Module *M) <b>const</b>;
</pre></div>
<p>The <tt>print</tt> method must be implemented by "analyses" in order to print
an analysis itself, as well as for other people to figure out how an analysis
works. Use the <tt>opt -analyze</tt> argument to invoke this method.</p>
-<p>The <tt>ostream</tt> parameter specifies the stream to write the results on,
+<p>The <tt>llvm::OStream</tt> parameter specifies the stream to write the results on,
and the <tt>Module</tt> parameter gives a pointer to the top level module of the
program that has been analyzed. Note however that this pointer may be null in
certain circumstances (such as calling the <tt>Pass::dump()</tt> from a
#include "llvm/Instructions.h"
#include "llvm/Module.h"
#include "llvm/Support/Dwarf.h"
-
-#include <iostream>
-
+#include "llvm/Support/Streams.h"
using namespace llvm;
using namespace llvm::dwarf;
#ifndef NDEBUG
void AnchorDesc::dump() {
- std::cerr << getDescString() << " "
- << "Version(" << getVersion() << "), "
- << "Tag(" << getTag() << "), "
- << "AnchorTag(" << AnchorTag << ")\n";
+ cerr << getDescString() << " "
+ << "Version(" << getVersion() << "), "
+ << "Tag(" << getTag() << "), "
+ << "AnchorTag(" << AnchorTag << ")\n";
}
#endif
#ifndef NDEBUG
void CompileUnitDesc::dump() {
- std::cerr << getDescString() << " "
- << "Version(" << getVersion() << "), "
- << "Tag(" << getTag() << "), "
- << "Anchor(" << getAnchor() << "), "
- << "Language(" << Language << "), "
- << "FileName(\"" << FileName << "\"), "
- << "Directory(\"" << Directory << "\"), "
- << "Producer(\"" << Producer << "\")\n";
+ cerr << getDescString() << " "
+ << "Version(" << getVersion() << "), "
+ << "Tag(" << getTag() << "), "
+ << "Anchor(" << getAnchor() << "), "
+ << "Language(" << Language << "), "
+ << "FileName(\"" << FileName << "\"), "
+ << "Directory(\"" << Directory << "\"), "
+ << "Producer(\"" << Producer << "\")\n";
}
#endif
#ifndef NDEBUG
void TypeDesc::dump() {
- std::cerr << getDescString() << " "
- << "Version(" << getVersion() << "), "
- << "Tag(" << getTag() << "), "
- << "Context(" << Context << "), "
- << "Name(\"" << Name << "\"), "
- << "File(" << File << "), "
- << "Line(" << Line << "), "
- << "Size(" << Size << "), "
- << "Align(" << Align << "), "
- << "Offset(" << Offset << "), "
- << "Flags(" << Flags << ")\n";
+ cerr << getDescString() << " "
+ << "Version(" << getVersion() << "), "
+ << "Tag(" << getTag() << "), "
+ << "Context(" << Context << "), "
+ << "Name(\"" << Name << "\"), "
+ << "File(" << File << "), "
+ << "Line(" << Line << "), "
+ << "Size(" << Size << "), "
+ << "Align(" << Align << "), "
+ << "Offset(" << Offset << "), "
+ << "Flags(" << Flags << ")\n";
}
#endif
#ifndef NDEBUG
void BasicTypeDesc::dump() {
- std::cerr << getDescString() << " "
- << "Version(" << getVersion() << "), "
- << "Tag(" << getTag() << "), "
- << "Context(" << getContext() << "), "
- << "Name(\"" << getName() << "\"), "
- << "Size(" << getSize() << "), "
- << "Encoding(" << Encoding << ")\n";
+ cerr << getDescString() << " "
+ << "Version(" << getVersion() << "), "
+ << "Tag(" << getTag() << "), "
+ << "Context(" << getContext() << "), "
+ << "Name(\"" << getName() << "\"), "
+ << "Size(" << getSize() << "), "
+ << "Encoding(" << Encoding << ")\n";
}
#endif
#ifndef NDEBUG
void DerivedTypeDesc::dump() {
- std::cerr << getDescString() << " "
- << "Version(" << getVersion() << "), "
- << "Tag(" << getTag() << "), "
- << "Context(" << getContext() << "), "
- << "Name(\"" << getName() << "\"), "
- << "Size(" << getSize() << "), "
- << "File(" << getFile() << "), "
- << "Line(" << getLine() << "), "
- << "FromType(" << FromType << ")\n";
+ cerr << getDescString() << " "
+ << "Version(" << getVersion() << "), "
+ << "Tag(" << getTag() << "), "
+ << "Context(" << getContext() << "), "
+ << "Name(\"" << getName() << "\"), "
+ << "Size(" << getSize() << "), "
+ << "File(" << getFile() << "), "
+ << "Line(" << getLine() << "), "
+ << "FromType(" << FromType << ")\n";
}
#endif
#ifndef NDEBUG
void CompositeTypeDesc::dump() {
- std::cerr << getDescString() << " "
- << "Version(" << getVersion() << "), "
- << "Tag(" << getTag() << "), "
- << "Context(" << getContext() << "), "
- << "Name(\"" << getName() << "\"), "
- << "Size(" << getSize() << "), "
- << "File(" << getFile() << "), "
- << "Line(" << getLine() << "), "
- << "FromType(" << getFromType() << "), "
- << "Elements.size(" << Elements.size() << ")\n";
+ cerr << getDescString() << " "
+ << "Version(" << getVersion() << "), "
+ << "Tag(" << getTag() << "), "
+ << "Context(" << getContext() << "), "
+ << "Name(\"" << getName() << "\"), "
+ << "Size(" << getSize() << "), "
+ << "File(" << getFile() << "), "
+ << "Line(" << getLine() << "), "
+ << "FromType(" << getFromType() << "), "
+ << "Elements.size(" << Elements.size() << ")\n";
}
#endif
#ifndef NDEBUG
void SubrangeDesc::dump() {
- std::cerr << getDescString() << " "
- << "Version(" << getVersion() << "), "
- << "Tag(" << getTag() << "), "
- << "Lo(" << Lo << "), "
- << "Hi(" << Hi << ")\n";
+ cerr << getDescString() << " "
+ << "Version(" << getVersion() << "), "
+ << "Tag(" << getTag() << "), "
+ << "Lo(" << Lo << "), "
+ << "Hi(" << Hi << ")\n";
}
#endif
#ifndef NDEBUG
void EnumeratorDesc::dump() {
- std::cerr << getDescString() << " "
- << "Version(" << getVersion() << "), "
- << "Tag(" << getTag() << "), "
- << "Name(" << Name << "), "
- << "Value(" << Value << ")\n";
+ cerr << getDescString() << " "
+ << "Version(" << getVersion() << "), "
+ << "Tag(" << getTag() << "), "
+ << "Name(" << Name << "), "
+ << "Value(" << Value << ")\n";
}
#endif
#ifndef NDEBUG
void VariableDesc::dump() {
- std::cerr << getDescString() << " "
- << "Version(" << getVersion() << "), "
- << "Tag(" << getTag() << "), "
- << "Context(" << Context << "), "
- << "Name(\"" << Name << "\"), "
- << "File(" << File << "), "
- << "Line(" << Line << "), "
- << "TyDesc(" << TyDesc << ")\n";
+ cerr << getDescString() << " "
+ << "Version(" << getVersion() << "), "
+ << "Tag(" << getTag() << "), "
+ << "Context(" << Context << "), "
+ << "Name(\"" << Name << "\"), "
+ << "File(" << File << "), "
+ << "Line(" << Line << "), "
+ << "TyDesc(" << TyDesc << ")\n";
}
#endif
#ifndef NDEBUG
void GlobalVariableDesc::dump() {
- std::cerr << getDescString() << " "
- << "Version(" << getVersion() << "), "
- << "Tag(" << getTag() << "), "
- << "Anchor(" << getAnchor() << "), "
- << "Name(\"" << getName() << "\"), "
- << "FullName(\"" << getFullName() << "\"), "
- << "LinkageName(\"" << getLinkageName() << "\"), "
- << "File(" << getFile() << "),"
- << "Line(" << getLine() << "),"
- << "Type(" << getType() << "), "
- << "IsStatic(" << (isStatic() ? "true" : "false") << "), "
- << "IsDefinition(" << (isDefinition() ? "true" : "false") << "), "
- << "Global(" << Global << ")\n";
+ cerr << getDescString() << " "
+ << "Version(" << getVersion() << "), "
+ << "Tag(" << getTag() << "), "
+ << "Anchor(" << getAnchor() << "), "
+ << "Name(\"" << getName() << "\"), "
+ << "FullName(\"" << getFullName() << "\"), "
+ << "LinkageName(\"" << getLinkageName() << "\"), "
+ << "File(" << getFile() << "),"
+ << "Line(" << getLine() << "),"
+ << "Type(" << getType() << "), "
+ << "IsStatic(" << (isStatic() ? "true" : "false") << "), "
+ << "IsDefinition(" << (isDefinition() ? "true" : "false") << "), "
+ << "Global(" << Global << ")\n";
}
#endif
#ifndef NDEBUG
void SubprogramDesc::dump() {
- std::cerr << getDescString() << " "
- << "Version(" << getVersion() << "), "
- << "Tag(" << getTag() << "), "
- << "Anchor(" << getAnchor() << "), "
- << "Name(\"" << getName() << "\"), "
- << "FullName(\"" << getFullName() << "\"), "
- << "LinkageName(\"" << getLinkageName() << "\"), "
- << "File(" << getFile() << "),"
- << "Line(" << getLine() << "),"
- << "Type(" << getType() << "), "
- << "IsStatic(" << (isStatic() ? "true" : "false") << "), "
- << "IsDefinition(" << (isDefinition() ? "true" : "false") << ")\n";
+ cerr << getDescString() << " "
+ << "Version(" << getVersion() << "), "
+ << "Tag(" << getTag() << "), "
+ << "Anchor(" << getAnchor() << "), "
+ << "Name(\"" << getName() << "\"), "
+ << "FullName(\"" << getFullName() << "\"), "
+ << "LinkageName(\"" << getLinkageName() << "\"), "
+ << "File(" << getFile() << "),"
+ << "Line(" << getLine() << "),"
+ << "Type(" << getType() << "), "
+ << "IsStatic(" << (isStatic() ? "true" : "false") << "), "
+ << "IsDefinition(" << (isDefinition() ? "true" : "false") << ")\n";
}
#endif
#ifndef NDEBUG
void BlockDesc::dump() {
- std::cerr << getDescString() << " "
- << "Version(" << getVersion() << "), "
- << "Tag(" << getTag() << "),"
- << "Context(" << Context << ")\n";
+ cerr << getDescString() << " "
+ << "Version(" << getVersion() << "), "
+ << "Tag(" << getTag() << "),"
+ << "Context(" << Context << ")\n";
}
#endif
for (unsigned i = MRegisterInfo::FirstVirtualRegister,
e = MF->getSSARegMap()->getLastVirtReg(); i <= e; ++i)
if (unsigned PR = Virt2PhysRegMap[i]) {
- std::cerr << "Register still mapped: " << i << " -> " << PR << "\n";
+ cerr << "Register still mapped: " << i << " -> " << PR << "\n";
AllOk = false;
}
assert(AllOk && "Virtual registers still in phys regs?");
#include "llvm/Support/Compiler.h"
#include "llvm/Support/CommandLine.h"
#include <algorithm>
-#include <iostream>
-#include <algorithm>
using namespace llvm;
namespace {
bool AddTo = true) {
assert(N->getNumValues() == NumTo && "Broken CombineTo call!");
++NodesCombined;
- DEBUG(std::cerr << "\nReplacing.1 "; N->dump();
- std::cerr << "\nWith: "; To[0].Val->dump(&DAG);
- std::cerr << " and " << NumTo-1 << " other values\n");
+ DOUT << "\nReplacing.1 "; DEBUG(N->dump());
+ DOUT << "\nWith: "; DEBUG(To[0].Val->dump(&DAG));
+ DOUT << " and " << NumTo-1 << " other values\n";
std::vector<SDNode*> NowDead;
DAG.ReplaceAllUsesWith(N, To, &NowDead);
// Replace the old value with the new one.
++NodesCombined;
- DEBUG(std::cerr << "\nReplacing.2 "; TLO.Old.Val->dump();
- std::cerr << "\nWith: "; TLO.New.Val->dump(&DAG);
- std::cerr << '\n');
+ DOUT << "\nReplacing.2 "; DEBUG(TLO.Old.Val->dump());
+ DOUT << "\nWith: "; DEBUG(TLO.New.Val->dump(&DAG));
+ DOUT << '\n';
std::vector<SDNode*> NowDead;
DAG.ReplaceAllUsesOfValueWith(TLO.Old, TLO.New, NowDead);
RV.Val->getOpcode() != ISD::DELETED_NODE &&
"Node was deleted but visit returned new node!");
- DEBUG(std::cerr << "\nReplacing.3 "; N->dump();
- std::cerr << "\nWith: "; RV.Val->dump(&DAG);
- std::cerr << '\n');
+ DOUT << "\nReplacing.3 "; DEBUG(N->dump());
+ DOUT << "\nWith: "; DEBUG(RV.Val->dump(&DAG));
+ DOUT << '\n';
std::vector<SDNode*> NowDead;
if (N->getNumValues() == RV.Val->getNumValues())
DAG.ReplaceAllUsesWith(N, RV.Val, &NowDead);
Result = DAG.getIndexedStore(SDOperand(N,0), BasePtr, Offset, AM);
++PreIndexedNodes;
++NodesCombined;
- DEBUG(std::cerr << "\nReplacing.4 "; N->dump();
- std::cerr << "\nWith: "; Result.Val->dump(&DAG);
- std::cerr << '\n');
+ DOUT << "\nReplacing.4 "; DEBUG(N->dump());
+ DOUT << "\nWith: "; DEBUG(Result.Val->dump(&DAG));
+ DOUT << '\n';
std::vector<SDNode*> NowDead;
if (isLoad) {
DAG.ReplaceAllUsesOfValueWith(SDOperand(N, 0), Result.getValue(0),
: DAG.getIndexedStore(SDOperand(N,0), BasePtr, Offset, AM);
++PostIndexedNodes;
++NodesCombined;
- DEBUG(std::cerr << "\nReplacing.5 "; N->dump();
- std::cerr << "\nWith: "; Result.Val->dump(&DAG);
- std::cerr << '\n');
+ DOUT << "\nReplacing.5 "; DEBUG(N->dump());
+ DOUT << "\nWith: "; DEBUG(Result.Val->dump(&DAG));
+ DOUT << '\n';
std::vector<SDNode*> NowDead;
if (isLoad) {
DAG.ReplaceAllUsesOfValueWith(SDOperand(N, 0), Result.getValue(0),
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Compiler.h"
#include "llvm/ADT/SmallVector.h"
-#include <iostream>
#include <map>
using namespace llvm;
}
// Otherwise this is an unhandled builtin node. splat.
#ifndef NDEBUG
- std::cerr << "NODE: "; Node->dump(); std::cerr << "\n";
+ cerr << "NODE: "; Node->dump(); cerr << "\n";
#endif
assert(0 && "Do not know how to legalize this operator!");
abort();
assert(0 && "CopyFromReg must be legal!");
default:
#ifndef NDEBUG
- std::cerr << "NODE: "; Node->dump(); std::cerr << "\n";
+ cerr << "NODE: "; Node->dump(); cerr << "\n";
#endif
assert(0 && "Do not know how to promote this operator!");
abort();
assert(0 && "CopyFromReg must be legal!");
default:
#ifndef NDEBUG
- std::cerr << "NODE: "; Node->dump(); std::cerr << "\n";
+ cerr << "NODE: "; Node->dump(); cerr << "\n";
#endif
assert(0 && "Do not know how to expand this operator!");
abort();
switch (Node->getOpcode()) {
default:
#ifndef NDEBUG
- Node->dump(); std::cerr << "\n";
+ Node->dump(); cerr << "\n";
#endif
assert(0 && "Unknown vector operation in PackVectorOp!");
case ISD::VADD:
#include "llvm/Target/TargetLowering.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/MathExtras.h"
-#include <iostream>
using namespace llvm;
-
/// BuildSchedUnits - Build SUnits from the selection dag that we are input.
/// This SUnit graph is similar to the SelectionDAG, but represents flagged
/// together nodes with a single SUnit.
if (CommuteSet.count(Node)) {
MachineInstr *NewMI = TII->commuteInstruction(MI);
if (NewMI == 0)
- DEBUG(std::cerr << "Sched: COMMUTING FAILED!\n");
+ DOUT << "Sched: COMMUTING FAILED!\n";
else {
- DEBUG(std::cerr << "Sched: COMMUTED TO: " << *NewMI);
+ DOUT << "Sched: COMMUTED TO: " << *NewMI;
if (MI != NewMI) {
delete MI;
MI = NewMI;
if (SUnit *SU = Sequence[i])
SU->dump(&DAG);
else
- std::cerr << "**** NOOP ****\n";
+ cerr << "**** NOOP ****\n";
}
}
/// SUnit - Scheduling unit. It's an wrapper around either a single SDNode or
/// a group of nodes flagged together.
void SUnit::dump(const SelectionDAG *G) const {
- std::cerr << "SU(" << NodeNum << "): ";
+ cerr << "SU(" << NodeNum << "): ";
Node->dump(G);
- std::cerr << "\n";
+ cerr << "\n";
if (FlaggedNodes.size() != 0) {
for (unsigned i = 0, e = FlaggedNodes.size(); i != e; i++) {
- std::cerr << " ";
+ cerr << " ";
FlaggedNodes[i]->dump(G);
- std::cerr << "\n";
+ cerr << "\n";
}
}
}
void SUnit::dumpAll(const SelectionDAG *G) const {
dump(G);
- std::cerr << " # preds left : " << NumPredsLeft << "\n";
- std::cerr << " # succs left : " << NumSuccsLeft << "\n";
- std::cerr << " # chain preds left : " << NumChainPredsLeft << "\n";
- std::cerr << " # chain succs left : " << NumChainSuccsLeft << "\n";
- std::cerr << " Latency : " << Latency << "\n";
- std::cerr << " Depth : " << Depth << "\n";
- std::cerr << " Height : " << Height << "\n";
+ cerr << " # preds left : " << NumPredsLeft << "\n";
+ cerr << " # succs left : " << NumSuccsLeft << "\n";
+ cerr << " # chain preds left : " << NumChainPredsLeft << "\n";
+ cerr << " # chain succs left : " << NumChainSuccsLeft << "\n";
+ cerr << " Latency : " << Latency << "\n";
+ cerr << " Depth : " << Depth << "\n";
+ cerr << " Height : " << Height << "\n";
if (Preds.size() != 0) {
- std::cerr << " Predecessors:\n";
+ cerr << " Predecessors:\n";
for (SUnit::const_succ_iterator I = Preds.begin(), E = Preds.end();
I != E; ++I) {
if (I->second)
- std::cerr << " ch #";
+ cerr << " ch #";
else
- std::cerr << " val #";
- std::cerr << I->first << " - SU(" << I->first->NodeNum << ")\n";
+ cerr << " val #";
+ cerr << I->first << " - SU(" << I->first->NodeNum << ")\n";
}
}
if (Succs.size() != 0) {
- std::cerr << " Successors:\n";
+ cerr << " Successors:\n";
for (SUnit::const_succ_iterator I = Succs.begin(), E = Succs.end();
I != E; ++I) {
if (I->second)
- std::cerr << " ch #";
+ cerr << " ch #";
else
- std::cerr << " val #";
- std::cerr << I->first << " - SU(" << I->first->NodeNum << ")\n";
+ cerr << " val #";
+ cerr << I->first << " - SU(" << I->first->NodeNum << ")\n";
}
}
- std::cerr << "\n";
+ cerr << "\n";
}
#include "llvm/Support/Compiler.h"
#include "llvm/ADT/Statistic.h"
#include <climits>
-#include <iostream>
#include <queue>
using namespace llvm;
/// Schedule - Schedule the DAG using list scheduling.
void ScheduleDAGList::Schedule() {
- DEBUG(std::cerr << "********** List Scheduling **********\n");
+ DOUT << "********** List Scheduling **********\n";
// Build scheduling units.
BuildSchedUnits();
AvailableQueue->releaseState();
- DEBUG(std::cerr << "*** Final schedule ***\n");
+ DOUT << "*** Final schedule ***\n";
DEBUG(dumpSchedule());
- DEBUG(std::cerr << "\n");
+ DOUT << "\n";
// Emit in scheduled order
EmitSchedule();
/// count of its successors. If a successor pending count is zero, add it to
/// the Available queue.
void ScheduleDAGList::ScheduleNodeTopDown(SUnit *SU, unsigned CurCycle) {
- DEBUG(std::cerr << "*** Scheduling [" << CurCycle << "]: ");
+ DOUT << "*** Scheduling [" << CurCycle << "]: ";
DEBUG(SU->dump(&DAG));
Sequence.push_back(SU);
} else if (!HasNoopHazards) {
// Otherwise, we have a pipeline stall, but no other problem, just advance
// the current cycle and try again.
- DEBUG(std::cerr << "*** Advancing cycle, no work to do\n");
+ DOUT << "*** Advancing cycle, no work to do\n";
HazardRec->AdvanceCycle();
++NumStalls;
++CurCycle;
// 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
// processors without pipeline interlocks and other cases.
- DEBUG(std::cerr << "*** Emitting noop\n");
+ DOUT << "*** Emitting noop\n";
HazardRec->EmitNoop();
Sequence.push_back(0); // NULL SUnit* -> noop
++NumNoops;
for (unsigned i = 0, e = SUnits.size(); i != e; ++i) {
if (SUnits[i].NumPredsLeft != 0 || SUnits[i].NumChainPredsLeft != 0) {
if (!AnyNotSched)
- std::cerr << "*** List scheduling failed! ***\n";
+ cerr << "*** List scheduling failed! ***\n";
SUnits[i].dump(&DAG);
- std::cerr << "has not been scheduled!\n";
+ cerr << "has not been scheduled!\n";
AnyNotSched = true;
}
}
#include "llvm/Support/Compiler.h"
#include "llvm/ADT/Statistic.h"
#include <climits>
-#include <iostream>
#include <queue>
#include "llvm/Support/CommandLine.h"
using namespace llvm;
/// Schedule - Schedule the DAG using list scheduling.
void ScheduleDAGRRList::Schedule() {
- DEBUG(std::cerr << "********** List Scheduling **********\n");
+ DOUT << "********** List Scheduling **********\n";
// Build scheduling units.
BuildSchedUnits();
CommuteNodesToReducePressure();
- DEBUG(std::cerr << "*** Final schedule ***\n");
+ DOUT << "*** Final schedule ***\n";
DEBUG(dumpSchedule());
- DEBUG(std::cerr << "\n");
+ DOUT << "\n";
// Emit in scheduled order
EmitSchedule();
#ifndef NDEBUG
if (PredSU->NumSuccsLeft < 0 || PredSU->NumChainSuccsLeft < 0) {
- std::cerr << "*** List scheduling failed! ***\n";
+ cerr << "*** List scheduling failed! ***\n";
PredSU->dump(&DAG);
- std::cerr << " has been released too many times!\n";
+ cerr << " has been released too many times!\n";
assert(0);
}
#endif
/// count of its predecessors. If a predecessor pending count is zero, add it to
/// the Available queue.
void ScheduleDAGRRList::ScheduleNodeBottomUp(SUnit *SU, unsigned CurCycle) {
- DEBUG(std::cerr << "*** Scheduling [" << CurCycle << "]: ");
+ DOUT << "*** Scheduling [" << CurCycle << "]: ";
DEBUG(SU->dump(&DAG));
SU->Cycle = CurCycle;
for (unsigned i = 0, e = SUnits.size(); i != e; ++i) {
if (SUnits[i].NumSuccsLeft != 0 || SUnits[i].NumChainSuccsLeft != 0) {
if (!AnyNotSched)
- std::cerr << "*** List scheduling failed! ***\n";
+ cerr << "*** List scheduling failed! ***\n";
SUnits[i].dump(&DAG);
- std::cerr << "has not been scheduled!\n";
+ cerr << "has not been scheduled!\n";
AnyNotSched = true;
}
}
#ifndef NDEBUG
if (SuccSU->NumPredsLeft < 0 || SuccSU->NumChainPredsLeft < 0) {
- std::cerr << "*** List scheduling failed! ***\n";
+ cerr << "*** List scheduling failed! ***\n";
SuccSU->dump(&DAG);
- std::cerr << " has been released too many times!\n";
+ cerr << " has been released too many times!\n";
assert(0);
}
#endif
/// count of its successors. If a successor pending count is zero, add it to
/// the Available queue.
void ScheduleDAGRRList::ScheduleNodeTopDown(SUnit *SU, unsigned CurCycle) {
- DEBUG(std::cerr << "*** Scheduling [" << CurCycle << "]: ");
+ DOUT << "*** Scheduling [" << CurCycle << "]: ";
DEBUG(SU->dump(&DAG));
SU->Cycle = CurCycle;
for (unsigned i = 0, e = SUnits.size(); i != e; ++i) {
if (!SUnits[i].isScheduled) {
if (!AnyNotSched)
- std::cerr << "*** List scheduling failed! ***\n";
+ cerr << "*** List scheduling failed! ***\n";
SUnits[i].dump(&DAG);
- std::cerr << "has not been scheduled!\n";
+ cerr << "has not been scheduled!\n";
AnyNotSched = true;
}
}
(!canClobber(SuccSU, DUSU) ||
(!SU->isCommutable && SuccSU->isCommutable))){
if (SuccSU->Depth == SU->Depth && !isReachable(SuccSU, SU)) {
- DEBUG(std::cerr << "Adding an edge from SU # " << SU->NodeNum
- << " to SU #" << SuccSU->NodeNum << "\n");
+ DOUT << "Adding an edge from SU # " << SU->NodeNum
+ << " to SU #" << SuccSU->NodeNum << "\n";
if (SU->addPred(SuccSU, true))
SU->NumChainPredsLeft++;
if (SuccSU->addSucc(SU, true))
#include "llvm/Support/Debug.h"
#include "llvm/Support/Compiler.h"
#include <algorithm>
-#include <iostream>
using namespace llvm;
-
namespace {
static RegisterScheduler
/// print - Print ordering to specified output stream.
///
- void print(std::ostream &O) const;
+ void print(OStream &O) const;
void dump(const char *tag) const;
/// printNI - Print node info.
///
- void printNI(std::ostream &O, NodeInfo *NI) const;
+ void printNI(OStream &O, NodeInfo *NI) const;
/// printChanges - Hilight changes in order caused by scheduling.
///
/// print - Print ordering to specified output stream.
///
-void ScheduleDAGSimple::print(std::ostream &O) const {
+void ScheduleDAGSimple::print(OStream &O) const {
#ifndef NDEBUG
O << "Ordering\n";
for (unsigned i = 0, N = Ordering.size(); i < N; i++) {
}
void ScheduleDAGSimple::dump(const char *tag) const {
- std::cerr << tag; dump();
+ cerr << tag; dump();
}
void ScheduleDAGSimple::dump() const {
- print(std::cerr);
+ print(cerr);
}
/// printNI - Print node info.
///
-void ScheduleDAGSimple::printNI(std::ostream &O, NodeInfo *NI) const {
+void ScheduleDAGSimple::printNI(OStream &O, NodeInfo *NI) const {
#ifndef NDEBUG
SDNode *Node = NI->Node;
O << " "
}
if (i < N) {
- std::cerr << Index << ". New Ordering\n";
+ cerr << Index << ". New Ordering\n";
for (i = 0; i < N; i++) {
NodeInfo *NI = Ordering[i];
- std::cerr << " " << NI->Preorder << ". ";
- printNI(std::cerr, NI);
- std::cerr << "\n";
+ cerr << " " << NI->Preorder << ". ";
+ printNI(cerr, NI);
+ cerr << "\n";
if (NI->isGroupDominator()) {
NodeGroup *Group = NI->Group;
for (NIIterator NII = Group->group_begin(), E = Group->group_end();
NII != E; NII++) {
- std::cerr << " ";
- printNI(std::cerr, *NII);
- std::cerr << "\n";
+ cerr << " ";
+ printNI(cerr, *NII);
+ cerr << "\n";
}
}
}
} else {
- std::cerr << Index << ". No Changes\n";
+ cerr << Index << ". No Changes\n";
}
#endif
}
if (!Erased && N->getValueType(N->getNumValues()-1) != MVT::Flag &&
!N->isTargetOpcode()) {
N->dump();
- std::cerr << "\n";
+ cerr << "\n";
assert(0 && "Node is not in map!");
}
#endif
void SDNode::dump() const { dump(0); }
void SDNode::dump(const SelectionDAG *G) const {
- std::cerr << (void*)this << ": ";
+ cerr << (void*)this << ": ";
for (unsigned i = 0, e = getNumValues(); i != e; ++i) {
- if (i) std::cerr << ",";
+ if (i) cerr << ",";
if (getValueType(i) == MVT::Other)
- std::cerr << "ch";
+ cerr << "ch";
else
- std::cerr << MVT::getValueTypeString(getValueType(i));
+ cerr << MVT::getValueTypeString(getValueType(i));
}
- std::cerr << " = " << getOperationName(G);
+ cerr << " = " << getOperationName(G);
- std::cerr << " ";
+ cerr << " ";
for (unsigned i = 0, e = getNumOperands(); i != e; ++i) {
- if (i) std::cerr << ", ";
- std::cerr << (void*)getOperand(i).Val;
+ if (i) cerr << ", ";
+ cerr << (void*)getOperand(i).Val;
if (unsigned RN = getOperand(i).ResNo)
- std::cerr << ":" << RN;
+ cerr << ":" << RN;
}
if (const ConstantSDNode *CSDN = dyn_cast<ConstantSDNode>(this)) {
- std::cerr << "<" << CSDN->getValue() << ">";
+ cerr << "<" << CSDN->getValue() << ">";
} else if (const ConstantFPSDNode *CSDN = dyn_cast<ConstantFPSDNode>(this)) {
- std::cerr << "<" << CSDN->getValue() << ">";
+ cerr << "<" << CSDN->getValue() << ">";
} else if (const GlobalAddressSDNode *GADN =
dyn_cast<GlobalAddressSDNode>(this)) {
int offset = GADN->getOffset();
- std::cerr << "<";
+ cerr << "<";
WriteAsOperand(std::cerr, GADN->getGlobal()) << ">";
if (offset > 0)
- std::cerr << " + " << offset;
+ cerr << " + " << offset;
else
- std::cerr << " " << offset;
+ cerr << " " << offset;
} else if (const FrameIndexSDNode *FIDN = dyn_cast<FrameIndexSDNode>(this)) {
- std::cerr << "<" << FIDN->getIndex() << ">";
+ cerr << "<" << FIDN->getIndex() << ">";
} else if (const JumpTableSDNode *JTDN = dyn_cast<JumpTableSDNode>(this)) {
- std::cerr << "<" << JTDN->getIndex() << ">";
+ cerr << "<" << JTDN->getIndex() << ">";
} else if (const ConstantPoolSDNode *CP = dyn_cast<ConstantPoolSDNode>(this)){
int offset = CP->getOffset();
if (CP->isMachineConstantPoolEntry())
- std::cerr << "<" << *CP->getMachineCPVal() << ">";
+ cerr << "<" << *CP->getMachineCPVal() << ">";
else
- std::cerr << "<" << *CP->getConstVal() << ">";
+ cerr << "<" << *CP->getConstVal() << ">";
if (offset > 0)
- std::cerr << " + " << offset;
+ cerr << " + " << offset;
else
- std::cerr << " " << offset;
+ cerr << " " << offset;
} else if (const BasicBlockSDNode *BBDN = dyn_cast<BasicBlockSDNode>(this)) {
- std::cerr << "<";
+ cerr << "<";
const Value *LBB = (const Value*)BBDN->getBasicBlock()->getBasicBlock();
if (LBB)
- std::cerr << LBB->getName() << " ";
- std::cerr << (const void*)BBDN->getBasicBlock() << ">";
+ cerr << LBB->getName() << " ";
+ cerr << (const void*)BBDN->getBasicBlock() << ">";
} else if (const RegisterSDNode *R = dyn_cast<RegisterSDNode>(this)) {
if (G && R->getReg() && MRegisterInfo::isPhysicalRegister(R->getReg())) {
- std::cerr << " " <<G->getTarget().getRegisterInfo()->getName(R->getReg());
+ cerr << " " <<G->getTarget().getRegisterInfo()->getName(R->getReg());
} else {
- std::cerr << " #" << R->getReg();
+ cerr << " #" << R->getReg();
}
} else if (const ExternalSymbolSDNode *ES =
dyn_cast<ExternalSymbolSDNode>(this)) {
- std::cerr << "'" << ES->getSymbol() << "'";
+ cerr << "'" << ES->getSymbol() << "'";
} else if (const SrcValueSDNode *M = dyn_cast<SrcValueSDNode>(this)) {
if (M->getValue())
- std::cerr << "<" << M->getValue() << ":" << M->getOffset() << ">";
+ cerr << "<" << M->getValue() << ":" << M->getOffset() << ">";
else
- std::cerr << "<null:" << M->getOffset() << ">";
+ cerr << "<null:" << M->getOffset() << ">";
} else if (const VTSDNode *N = dyn_cast<VTSDNode>(this)) {
- std::cerr << ":" << getValueTypeString(N->getVT());
+ cerr << ":" << getValueTypeString(N->getVT());
} else if (const LoadSDNode *LD = dyn_cast<LoadSDNode>(this)) {
bool doExt = true;
switch (LD->getExtensionType()) {
default: doExt = false; break;
case ISD::EXTLOAD:
- std::cerr << " <anyext ";
+ cerr << " <anyext ";
break;
case ISD::SEXTLOAD:
- std::cerr << " <sext ";
+ cerr << " <sext ";
break;
case ISD::ZEXTLOAD:
- std::cerr << " <zext ";
+ cerr << " <zext ";
break;
}
if (doExt)
- std::cerr << MVT::getValueTypeString(LD->getLoadedVT()) << ">";
+ cerr << MVT::getValueTypeString(LD->getLoadedVT()) << ">";
const char *AM = getIndexedModeName(LD->getAddressingMode());
if (AM != "")
- std::cerr << " " << AM;
+ cerr << " " << AM;
} else if (const StoreSDNode *ST = dyn_cast<StoreSDNode>(this)) {
if (ST->isTruncatingStore())
- std::cerr << " <trunc "
- << MVT::getValueTypeString(ST->getStoredVT()) << ">";
+ cerr << " <trunc "
+ << MVT::getValueTypeString(ST->getStoredVT()) << ">";
const char *AM = getIndexedModeName(ST->getAddressingMode());
if (AM != "")
- std::cerr << " " << AM;
+ cerr << " " << AM;
}
}
if (N->getOperand(i).Val->hasOneUse())
DumpNodes(N->getOperand(i).Val, indent+2, G);
else
- std::cerr << "\n" << std::string(indent+2, ' ')
- << (void*)N->getOperand(i).Val << ": <multiple use>";
+ cerr << "\n" << std::string(indent+2, ' ')
+ << (void*)N->getOperand(i).Val << ": <multiple use>";
- std::cerr << "\n" << std::string(indent, ' ');
+ cerr << "\n" << std::string(indent, ' ');
N->dump(G);
}
void SelectionDAG::dump() const {
- std::cerr << "SelectionDAG has " << AllNodes.size() << " nodes:";
+ cerr << "SelectionDAG has " << AllNodes.size() << " nodes:";
std::vector<const SDNode*> Nodes;
for (allnodes_const_iterator I = allnodes_begin(), E = allnodes_end();
I != E; ++I)
if (getRoot().Val) DumpNodes(getRoot().Val, 2, this);
- std::cerr << "\n\n";
+ cerr << "\n\n";
}
const Type *ConstantPoolSDNode::getType() const {
#include "llvm/Support/MathExtras.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/Compiler.h"
-#include <iostream>
#include <algorithm>
using namespace llvm;
true, UsesInputRegister,
OutputRegs, InputRegs);
if (Regs.Regs.empty()) {
- std::cerr << "Couldn't allocate output reg for contraint '"
- << ConstraintCode << "'!\n";
+ cerr << "Couldn't allocate output reg for contraint '"
+ << ConstraintCode << "'!\n";
exit(1);
}
InOperandVal = TLI.isOperandValidForConstraint(InOperandVal,
ConstraintCode[0], DAG);
if (!InOperandVal.Val) {
- std::cerr << "Invalid operand for inline asm constraint '"
- << ConstraintCode << "'!\n";
+ cerr << "Invalid operand for inline asm constraint '"
+ << ConstraintCode << "'!\n";
exit(1);
}
// basic blocks, and the scheduler passes ownership of it to this method.
MachineBasicBlock *TargetLowering::InsertAtEndOfBasicBlock(MachineInstr *MI,
MachineBasicBlock *MBB) {
- std::cerr << "If a target marks an instruction with "
- "'usesCustomDAGSchedInserter', it must implement "
- "TargetLowering::InsertAtEndOfBasicBlock!\n";
+ cerr << "If a target marks an instruction with "
+ << "'usesCustomDAGSchedInserter', it must implement "
+ << "TargetLowering::InsertAtEndOfBasicBlock!\n";
abort();
return 0;
}
bool SelectionDAGISel::runOnFunction(Function &Fn) {
MachineFunction &MF = MachineFunction::construct(&Fn, TLI.getTargetMachine());
RegMap = MF.getSSARegMap();
- DEBUG(std::cerr << "\n\n\n=== " << Fn.getName() << "\n");
+ DOUT << "\n\n\n=== " << Fn.getName() << "\n";
// First, split all critical edges.
//
// Run the DAG combiner in pre-legalize mode.
DAG.Combine(false, AA);
- DEBUG(std::cerr << "Lowered selection DAG:\n");
+ DOUT << "Lowered selection DAG:\n";
DEBUG(DAG.dump());
// Second step, hack on the DAG until it only uses operations and types that
// the target supports.
DAG.Legalize();
- DEBUG(std::cerr << "Legalized selection DAG:\n");
+ DOUT << "Legalized selection DAG:\n";
DEBUG(DAG.dump());
// Run the DAG combiner in post-legalize mode.
// code to the MachineBasicBlock.
InstructionSelectBasicBlock(DAG);
- DEBUG(std::cerr << "Selected machine code:\n");
+ DOUT << "Selected machine code:\n";
DEBUG(BB->dump());
}
// Otherwise, this is a memory operand. Ask the target to select it.
std::vector<SDOperand> SelOps;
if (SelectInlineAsmMemoryOperand(InOps[i+1], 'm', SelOps, DAG)) {
- std::cerr << "Could not match memory address. Inline asm failure!\n";
+ cerr << "Could not match memory address. Inline asm failure!\n";
exit(1);
}
#include "llvm/Config/config.h"
#include <fstream>
#include <sstream>
-#include <iostream>
using namespace llvm;
namespace llvm {
#ifndef NDEBUG
ViewGraph(this, "dag." + getMachineFunction().getFunction()->getName());
#else
- std::cerr << "SelectionDAG::viewGraph is only available in debug builds on "
- << "systems with Graphviz or gv!\n";
+ cerr << "SelectionDAG::viewGraph is only available in debug builds on "
+ << "systems with Graphviz or gv!\n";
#endif // NDEBUG
}
#ifndef NDEBUG
NodeGraphAttrs.clear();
#else
- std::cerr << "SelectionDAG::clearGraphAttrs is only available in debug builds"
- << " on systems with Graphviz or gv!\n";
+ cerr << "SelectionDAG::clearGraphAttrs is only available in debug builds"
+ << " on systems with Graphviz or gv!\n";
#endif
}
#ifndef NDEBUG
NodeGraphAttrs[N] = Attrs;
#else
- std::cerr << "SelectionDAG::setGraphAttrs is only available in debug builds"
- << " on systems with Graphviz or gv!\n";
+ cerr << "SelectionDAG::setGraphAttrs is only available in debug builds"
+ << " on systems with Graphviz or gv!\n";
#endif
}
else
return "";
#else
- std::cerr << "SelectionDAG::getGraphAttrs is only available in debug builds"
- << " on systems with Graphviz or gv!\n";
+ cerr << "SelectionDAG::getGraphAttrs is only available in debug builds"
+ << " on systems with Graphviz or gv!\n";
return std::string("");
#endif
}
#ifndef NDEBUG
NodeGraphAttrs[N] = std::string("color=") + Color;
#else
- std::cerr << "SelectionDAG::setGraphColor is only available in debug builds"
- << " on systems with Graphviz or gv!\n";
+ cerr << "SelectionDAG::setGraphColor is only available in debug builds"
+ << " on systems with Graphviz or gv!\n";
#endif
}
#include "llvm/Support/CallSite.h"
#include "llvm/Target/TargetData.h"
#include "llvm/Support/DataTypes.h"
-#include <iostream>
namespace llvm {
void visitAShr(ShiftInst &I);
void visitVAArgInst(VAArgInst &I);
void visitInstruction(Instruction &I) {
- std::cerr << I;
+ cerr << I;
assert(0 && "Instruction not interpretable yet!");
}
#include "JIT.h"
#include "llvm/System/DynamicLibrary.h"
#include "llvm/Config/config.h"
-#include <iostream>
using namespace llvm;
// AtExitHandlers - List of functions to call when the program exits,
if (Ptr) return Ptr;
}
- std::cerr << "ERROR: Program used external function '" << Name
- << "' which could not be resolved!\n";
+ cerr << "ERROR: Program used external function '" << Name
+ << "' which could not be resolved!\n";
abort();
return 0;
}
#include "llvm/Target/TargetData.h"
#include "llvm/Target/TargetMachine.h"
#include "llvm/Target/TargetJITInfo.h"
-#include <iostream>
using namespace llvm;
#ifdef __APPLE__
// Turn the machine code intermediate representation into bytes in memory that
// may be executed.
if (TM.addPassesToEmitMachineCode(PM, *MCE, false /*fast*/)) {
- std::cerr << "Target does not support machine code emission!\n";
+ cerr << "Target does not support machine code emission!\n";
abort();
}
std::string ErrorMsg;
if (MP->materializeFunction(F, &ErrorMsg)) {
- std::cerr << "Error reading function '" << F->getName()
- << "' from bytecode file: " << ErrorMsg << "\n";
+ cerr << "Error reading function '" << F->getName()
+ << "' from bytecode file: " << ErrorMsg << "\n";
abort();
}
}
#endif
Ptr = sys::DynamicLibrary::SearchForAddressOfSymbol(GV->getName().c_str());
if (Ptr == 0) {
- std::cerr << "Could not resolve external global address: "
- << GV->getName() << "\n";
+ cerr << "Could not resolve external global address: "
+ << GV->getName() << "\n";
abort();
}
} else {
#include "llvm/ADT/Statistic.h"
#include "llvm/System/Memory.h"
#include <algorithm>
-#include <iostream>
using namespace llvm;
namespace {
~(intptr_t)(Alignment-1));
if (CurStubPtr < StubBase) {
// FIXME: allocate a new block
- std::cerr << "JIT ran out of memory for function stubs!\n";
+ cerr << "JIT ran out of memory for function stubs!\n";
abort();
}
return CurStubPtr;
std::string ErrMsg;
sys::MemoryBlock B = sys::Memory::AllocateRWX(size, BOld, &ErrMsg);
if (B.base() == 0) {
- std::cerr << "Allocation failed when allocating new memory in the JIT\n";
- std::cerr << ErrMsg << "\n";
+ cerr << "Allocation failed when allocating new memory in the JIT\n";
+ cerr << ErrMsg << "\n";
abort();
}
Blocks.push_back(B);
// Invalidate the icache if necessary.
synchronizeICache(Stub, MCE.getCurrentPCValue()-(intptr_t)Stub);
- DEBUG(std::cerr << "JIT: Stub emitted at [" << Stub << "] for function '"
- << F->getName() << "'\n");
+ DOUT << "JIT: Stub emitted at [" << Stub << "] for function '"
+ << F->getName() << "'\n";
// Finally, keep track of the stub-to-Function mapping so that the
// JITCompilerFn knows which function to compile!
// Invalidate the icache if necessary.
synchronizeICache(Stub, MCE.getCurrentPCValue()-(intptr_t)Stub);
- DEBUG(std::cerr << "JIT: Stub emitted at [" << Stub
- << "] for external function at '" << FnAddr << "'\n");
+ DOUT << "JIT: Stub emitted at [" << Stub
+ << "] for external function at '" << FnAddr << "'\n";
return Stub;
}
if (!idx) {
idx = ++nextGOTIndex;
revGOTMap[addr] = idx;
- DEBUG(std::cerr << "Adding GOT entry " << idx
- << " for addr " << addr << "\n");
+ DOUT << "Adding GOT entry " << idx
+ << " for addr " << addr << "\n";
// ((void**)MemMgr.getGOTBase())[idx] = addr;
}
return idx;
// If disabled, emit a useful error message and abort.
if (TheJIT->isLazyCompilationDisabled()) {
- std::cerr << "LLVM JIT requested to do lazy compilation of function '"
- << F->getName() << "' when lazy compiles are disabled!\n";
+ cerr << "LLVM JIT requested to do lazy compilation of function '"
+ << F->getName() << "' when lazy compiles are disabled!\n";
abort();
}
// needs to call.
//JR.state.getStubToFunctionMap(locked).erase(I);
- DEBUG(std::cerr << "JIT: Lazily resolving function '" << F->getName()
- << "' In stub ptr = " << Stub << " actual ptr = "
- << I->first << "\n");
+ DOUT << "JIT: Lazily resolving function '" << F->getName()
+ << "' In stub ptr = " << Stub << " actual ptr = "
+ << I->first << "\n";
void *Result = TheJIT->getPointerToFunction(F);
public:
JITEmitter(JIT &jit) : MemMgr(jit.getJITInfo().needsGOT()) {
TheJIT = &jit;
- DEBUG(if (MemMgr.isManagingGOT()) std::cerr << "JIT is managing a GOT\n");
+ if (MemMgr.isManagingGOT()) DOUT << "JIT is managing a GOT\n";
}
virtual void startFunction(MachineFunction &F);
bool JITEmitter::finishFunction(MachineFunction &F) {
if (CurBufferPtr == BufferEnd) {
// FIXME: Allocate more space, then try again.
- std::cerr << "JIT: Ran out of space for generated machine code!\n";
+ cerr << "JIT: Ran out of space for generated machine code!\n";
abort();
}
unsigned idx = getJITResolver(this).getGOTIndexForAddr(ResultPtr);
MR.setGOTIndex(idx);
if (((void**)MemMgr.getGOTBase())[idx] != ResultPtr) {
- DEBUG(std::cerr << "GOT was out of date for " << ResultPtr
- << " pointing at " << ((void**)MemMgr.getGOTBase())[idx]
- << "\n");
+ DOUT << "GOT was out of date for " << ResultPtr
+ << " pointing at " << ((void**)MemMgr.getGOTBase())[idx]
+ << "\n";
((void**)MemMgr.getGOTBase())[idx] = ResultPtr;
}
}
if(MemMgr.isManagingGOT()) {
unsigned idx = getJITResolver(this).getGOTIndexForAddr((void*)BufferBegin);
if (((void**)MemMgr.getGOTBase())[idx] != (void*)BufferBegin) {
- DEBUG(std::cerr << "GOT was out of date for " << (void*)BufferBegin
- << " pointing at " << ((void**)MemMgr.getGOTBase())[idx] << "\n");
+ DOUT << "GOT was out of date for " << (void*)BufferBegin
+ << " pointing at " << ((void**)MemMgr.getGOTBase())[idx] << "\n";
((void**)MemMgr.getGOTBase())[idx] = (void*)BufferBegin;
}
}
// Invalidate the icache if necessary.
synchronizeICache(FnStart, FnEnd-FnStart);
- DEBUG(std::cerr << "JIT: Finished CodeGen of [" << (void*)FnStart
- << "] Function: " << F.getFunction()->getName()
- << ": " << (FnEnd-FnStart) << " bytes of text, "
- << Relocations.size() << " relocations\n");
+ DOUT << "JIT: Finished CodeGen of [" << (void*)FnStart
+ << "] Function: " << F.getFunction()->getName()
+ << ": " << (FnEnd-FnStart) << " bytes of text, "
+ << Relocations.size() << " relocations\n";
Relocations.clear();
return false;
}
void *CAddr = (char*)ConstantPoolBase+Constants[i].Offset;
if (Constants[i].isMachineConstantPoolEntry()) {
// FIXME: add support to lower machine constant pool values into bytes!
- std::cerr << "Initialize memory with machine specific constant pool entry"
- << " has not been implemented!\n";
+ cerr << "Initialize memory with machine specific constant pool entry"
+ << " has not been implemented!\n";
abort();
}
TheJIT->InitializeMemory(Constants[i].Val.ConstVal, CAddr);
#include "llvm/Target/SubtargetFeature.h"
#include "llvm/Target/TargetMachine.h"
#include "llvm/Target/TargetMachineRegistry.h"
-#include <iostream>
using namespace llvm;
static cl::opt<const TargetMachineRegistry::Entry*, false, TargetNameParser>
MArch = TargetMachineRegistry::getClosestTargetForJIT(Error);
if (MArch == 0) return 0;
} else if (MArch->JITMatchQualityFn() == 0) {
- std::cerr << "WARNING: This target JIT is not designed for the host you are"
- << " running. If bad things happen, please choose a different "
- << "-march switch.\n";
+ cerr << "WARNING: This target JIT is not designed for the host you are"
+ << " running. If bad things happen, please choose a different "
+ << "-march switch.\n";
}
// Package up features to be passed to target/subtarget
if (OldFT->getNumParams() > ConcreteFT->getNumParams() &&
!ConcreteFT->isVarArg())
if (!Old->use_empty()) {
- std::cerr << "WARNING: Linking function '" << Old->getName()
- << "' is causing arguments to be dropped.\n";
- std::cerr << "WARNING: Prototype: ";
+ cerr << "WARNING: Linking function '" << Old->getName()
+ << "' is causing arguments to be dropped.\n";
+ cerr << "WARNING: Prototype: ";
WriteAsOperand(std::cerr, Old);
- std::cerr << " resolved to ";
+ cerr << " resolved to ";
WriteAsOperand(std::cerr, Concrete);
- std::cerr << "\n";
+ cerr << "\n";
}
// Check to make sure that if there are specified types, that they
if (OldFT->getParamType(i) != ConcreteFT->getParamType(i))
if (OldFT->getParamType(i)->getTypeID() !=
ConcreteFT->getParamType(i)->getTypeID()) {
- std::cerr << "WARNING: Function [" << Old->getName()
- << "]: Parameter types conflict for: '";
+ cerr << "WARNING: Function [" << Old->getName()
+ << "]: Parameter types conflict for: '";
WriteTypeSymbolic(std::cerr, OldFT, &M);
- std::cerr << "' (in "
- << Old->getParent()->getModuleIdentifier() << ") and '";
+ cerr << "' (in "
+ << Old->getParent()->getModuleIdentifier() << ") and '";
WriteTypeSymbolic(std::cerr, ConcreteFT, &M);
- std::cerr << "'(in "
- << Concrete->getParent()->getModuleIdentifier() << ")\n";
+ cerr << "'(in "
+ << Concrete->getParent()->getModuleIdentifier() << ")\n";
return Changed;
}
for (unsigned i = 0; i != Globals.size(); ) {
if (isa<Function>(Globals[i]) != isFunction) {
- std::cerr << "WARNING: Found function and global variable with the "
- << "same name: '" << Globals[i]->getName() << "'.\n";
+ cerr << "WARNING: Found function and global variable with the "
+ << "same name: '" << Globals[i]->getName() << "'.\n";
return false; // Don't know how to handle this, bail out!
}
GlobalVariable *GV = cast<GlobalVariable>(Globals[i]);
if (!GV->isExternal()) {
if (Concrete) {
- std::cerr << "WARNING: Two global variables with external linkage"
- << " exist with the same name: '" << GV->getName()
- << "'!\n";
+ cerr << "WARNING: Two global variables with external linkage"
+ << " exist with the same name: '" << GV->getName()
+ << "'!\n";
return false;
}
Concrete = GV;
}
if (0 && !DontPrintWarning) {
- std::cerr << "WARNING: Found global types that are not compatible:\n";
+ cerr << "WARNING: Found global types that are not compatible:\n";
for (unsigned i = 0; i < Globals.size(); ++i) {
- std::cerr << "\t";
+ cerr << "\t";
WriteTypeSymbolic(std::cerr, Globals[i]->getType(), &M);
- std::cerr << " %" << Globals[i]->getName() << "\n";
+ cerr << " %" << Globals[i]->getName() << "\n";
}
}
#include "llvm/ADT/PostOrderIterator.h"
#include "llvm/ADT/Statistic.h"
#include <algorithm>
-#include <iostream>
using namespace llvm;
namespace {
ComputeReplacements(RI);
// If debugging, print computed region information...
- DEBUG(RI.print(std::cerr));
+ DEBUG(RI.print(*cerr.stream()));
// Simplify the contents of this block...
bool Changed = SimplifyBasicBlock(*BB, RI);
BasicBlock *OldSucc = TI->getSuccessor(SuccNo);
BasicBlock *BB = TI->getParent();
- DEBUG(std::cerr << "Forwarding branch in basic block %" << BB->getName()
- << " from block %" << OldSucc->getName() << " to block %"
- << Dest->getName() << "\n");
-
- DEBUG(std::cerr << "Before forwarding: " << *BB->getParent());
+ DOUT << "Forwarding branch in basic block %" << BB->getName()
+ << " from block %" << OldSucc->getName() << " to block %"
+ << Dest->getName() << "\n"
+ << "Before forwarding: " << *BB->getParent();
// Because we know that there cannot be critical edges in the flow graph, and
// that OldSucc has multiple outgoing edges, this means that Dest cannot have
// FIXME: This is much worse than it really should be!
//EF->recalculate();
- DEBUG(std::cerr << "After forwarding: " << *BB->getParent());
+ DOUT << "After forwarding: " << *BB->getParent();
}
/// ReplaceUsesOfValueInRegion - This method replaces all uses of Orig with uses
//
if (Op1R.contradicts(Opcode, VI)) {
Op1R.contradicts(Opcode, VI);
- std::cerr << "Contradiction found for opcode: "
- << Instruction::getOpcodeName(Opcode) << "\n";
- Op1R.print(std::cerr);
+ cerr << "Contradiction found for opcode: "
+ << Instruction::getOpcodeName(Opcode) << "\n";
+ Op1R.print(*cerr.stream());
return;
}
// Try to simplify a setcc instruction based on inherited information
Relation::KnownResult Result = getSetCCResult(SCI, RI);
if (Result != Relation::Unknown) {
- DEBUG(std::cerr << "Replacing setcc with " << Result
- << " constant: " << *SCI);
+ DOUT << "Replacing setcc with " << Result << " constant: " << *SCI;
SCI->replaceAllUsesWith(ConstantBool::get((bool)Result));
// The instruction is now dead, remove it from the program.
if (Value *Repl = VI->getReplacement()) {
// If we know if a replacement with lower rank than Op0, make the
// replacement now.
- DEBUG(std::cerr << "In Inst: " << *I << " Replacing operand #" << i
- << " with " << *Repl << "\n");
+ DOUT << "In Inst: " << *I << " Replacing operand #" << i
+ << " with " << *Repl << "\n";
I->setOperand(i, Repl);
Changed = true;
++NumOperandsCann;
if (isa<Constant>(Op1)) {
if (Constant *Result = ConstantFoldInstruction(SCI)) {
// Wow, this is easy, directly eliminate the SetCondInst.
- DEBUG(std::cerr << "Replacing setcc with constant fold: " << *SCI);
+ DOUT << "Replacing setcc with constant fold: " << *SCI;
return cast<ConstantBool>(Result)->getValue()
? Relation::KnownTrue : Relation::KnownFalse;
}
}
// Don't inline these methods or else we won't be able to call them from GDB!
-void Relation::dump() const { print(std::cerr); }
-void ValueInfo::dump() const { print(std::cerr, 0); }
-void RegionInfo::dump() const { print(std::cerr); }
+void Relation::dump() const { print(*cerr.stream()); }
+void ValueInfo::dump() const { print(*cerr.stream(), 0); }
+void RegionInfo::dump() const { print(*cerr.stream()); }
#include "llvm/Transforms/Utils/Local.h"
#include <algorithm>
#include <deque>
-#include <iostream>
#include <sstream>
#include <map>
using namespace llvm;
}
Node *newNode(Value *V) {
- //DEBUG(std::cerr << "new node: " << *V << "\n");
+ //DOUT << "new node: " << *V << "\n";
materialize();
Node *&N = Nodes[V];
assert(N == 0 && "Node already exists for value.");
}
void addToWorklist(Instruction *I) {
- //DEBUG(std::cerr << "addToWorklist: " << *I << "\n");
+ //DOUT << "addToWorklist: " << *I << "\n";
if (!isa<BinaryOperator>(I) && !isa<SelectInst>(I)) return;
}
void addRecursive(Value *V) {
- //DEBUG(std::cerr << "addRecursive: " << *V << "\n");
+ //DOUT << "addRecursive: " << *V << "\n";
Instruction *I = dyn_cast<Instruction>(V);
if (I)
else if (!isa<Argument>(V))
return;
- //DEBUG(std::cerr << "addRecursive uses...\n");
+ //DOUT << "addRecursive uses...\n";
for (Value::use_iterator UI = V->use_begin(), UE = V->use_end();
UI != UE; ++UI) {
// Use must be either be dominated by Top, or dominate Top.
}
if (I) {
- //DEBUG(std::cerr << "addRecursive ops...\n");
+ //DOUT << "addRecursive ops...\n";
for (User::op_iterator OI = I->op_begin(), OE = I->op_end();
OI != OE; ++OI) {
if (Instruction *Inst = dyn_cast<Instruction>(*OI))
addToWorklist(Inst);
}
}
- //DEBUG(std::cerr << "exit addRecursive (" << *V << ").\n");
+ //DOUT << "exit addRecursive (" << *V << ").\n";
}
public:
// you may no longer perform any queries on the InequalityGraph.
bool addEqual(Value *V1, Value *V2) {
- //DEBUG(std::cerr << "addEqual(" << *V1 << ", "
- // << *V2 << ")\n");
+ //DOUT << "addEqual(" << *V1 << ", " << *V2 << ")\n";
if (isEqual(V1, V2)) return true;
const Node *cN1 = cIG.getNode(V1), *cN2 = cIG.getNode(V2);
if (Top != Node_I2 && Node_I2->DominatedBy(Top)) {
Value *V = V1;
if (cN1 && compare(V1, cN1->getValue())) V = cN1->getValue();
- //DEBUG(std::cerr << "Simply removing " << *I2
- // << ", replacing with " << *V << "\n");
+ //DOUT << "Simply removing " << *I2
+ // << ", replacing with " << *V << "\n";
I2->replaceAllUsesWith(V);
// leave it dead; it'll get erased later.
++NumSimple;
}
bool addNotEqual(Value *V1, Value *V2) {
- //DEBUG(std::cerr << "addNotEqual(" << *V1 << ", "
- // << *V2 << ")\n");
+ //DOUT << "addNotEqual(" << *V1 << ", " << *V2 << ")\n");
if (isNotEqual(V1, V2)) return true;
// Never permit %x NE true/false.
}
void solve() {
- DEBUG(std::cerr << "WorkList entry, size: " << WorkList.size() << "\n");
+ DOUT << "WorkList entry, size: " << WorkList.size() << "\n";
while (!WorkList.empty()) {
- DEBUG(std::cerr << "WorkList size: " << WorkList.size() << "\n");
+ DOUT << "WorkList size: " << WorkList.size() << "\n";
Instruction *I = WorkList.front();
WorkList.pop_front();
Value *Canonical = cIG.canonicalize(I);
const Type *Ty = I->getType();
- //DEBUG(std::cerr << "solving: " << *I << "\n");
- //DEBUG(IG.debug(std::cerr));
+ //DOUT << "solving: " << *I << "\n";
+ //DEBUG(IG.debug(*cerr.stream()));
if (BinaryOperator *BO = dyn_cast<BinaryOperator>(I)) {
Value *Op0 = cIG.canonicalize(BO->getOperand(0)),
// Visits each instruction in the basic block.
void visitBasicBlock(BasicBlock *BB, InequalityGraph &IG) {
- DEBUG(std::cerr << "Entering Basic Block: " << BB->getName() << "\n");
- for (BasicBlock::iterator I = BB->begin(), E = BB->end(); I != E;) {
- visitInstruction(I++, IG);
+ DOUT << "Entering Basic Block: " << BB->getName() << "\n";
+ for (BasicBlock::iterator I = BB->begin(), E = BB->end(); I != E;) {
+ visitInstruction(I++, IG);
}
}
// Tries to simplify each Instruction and add new properties to
// the PropertySet.
void visitInstruction(Instruction *I, InequalityGraph &IG) {
- DEBUG(std::cerr << "Considering instruction " << *I << "\n");
- DEBUG(IG.debug(std::cerr));
+ DOUT << "Considering instruction " << *I << "\n";
+ DEBUG(IG.debug(*cerr.stream()));
// Sometimes instructions are made dead due to earlier analysis.
if (isInstructionTriviallyDead(I)) {
if (V != I) {
modified = true;
++NumInstruction;
- DEBUG(std::cerr << "Removing " << *I << ", replacing with "
- << *V << "\n");
+ DOUT << "Removing " << *I << ", replacing with " << *V << "\n";
IG.remove(I);
I->replaceAllUsesWith(V);
I->eraseFromParent();
if (V != Oper) {
modified = true;
++NumVarsReplaced;
- DEBUG(std::cerr << "Resolving " << *I);
+ DOUT << "Resolving " << *I;
I->setOperand(i, V);
- DEBUG(std::cerr << " into " << *I);
+ DOUT << " into " << *I;
}
}
- //DEBUG(std::cerr << "push (%" << I->getParent()->getName() << ")\n");
+ //DOUT << "push (%" << I->getParent()->getName() << ")\n";
Forwards visit(this, IG);
visit.visit(*I);
- //DEBUG(std::cerr << "pop (%" << I->getParent()->getName() << ")\n");
+ //DOUT << "pop (%" << I->getParent()->getName() << ")\n";
}
};
DT = &getAnalysis<DominatorTree>();
Forest = &getAnalysis<ETForest>();
- DEBUG(std::cerr << "Entering Function: " << F.getName() << "\n");
+ DOUT << "Entering Function: " << F.getName() << "\n";
modified = false;
WorkList.push_back(State(DT->getRoot(), new InequalityGraph()));
VRPSolver Solver(*DestProperties, PS->Forest, Dest);
if (Dest == TrueDest) {
- DEBUG(std::cerr << "(" << BB->getName() << ") true set:\n");
+ DOUT << "(" << BB->getName() << ") true set:\n";
if (!Solver.addEqual(ConstantBool::getTrue(), Condition)) continue;
Solver.solve();
- DEBUG(DestProperties->debug(std::cerr));
+ DEBUG(DestProperties->debug(*cerr.stream()));
} else if (Dest == FalseDest) {
- DEBUG(std::cerr << "(" << BB->getName() << ") false set:\n");
+ DOUT << "(" << BB->getName() << ") false set:\n";
if (!Solver.addEqual(ConstantBool::getFalse(), Condition)) continue;
Solver.solve();
- DEBUG(DestProperties->debug(std::cerr));
+ DEBUG(DestProperties->debug(*cerr.stream()));
}
PS->proceedToSuccessor(DestProperties, Dest);
#include "llvm/ADT/PostOrderIterator.h"
#include "llvm/ADT/Statistic.h"
#include <algorithm>
-#include <iostream>
using namespace llvm;
namespace {
///
static void PrintOps(Instruction *I, const std::vector<ValueEntry> &Ops) {
Module *M = I->getParent()->getParent()->getParent();
- std::cerr << Instruction::getOpcodeName(I->getOpcode()) << " "
+ cerr << Instruction::getOpcodeName(I->getOpcode()) << " "
<< *Ops[0].Op->getType();
for (unsigned i = 0, e = Ops.size(); i != e; ++i)
- WriteAsOperand(std::cerr << " ", Ops[i].Op, false, M)
+ WriteAsOperand(*cerr.stream() << " ", Ops[i].Op, false, M)
<< "," << Ops[i].Rank;
}
(!BinaryOperator::isNot(I) && !BinaryOperator::isNeg(I)))
++Rank;
- //DEBUG(std::cerr << "Calculated Rank[" << V->getName() << "] = "
- //<< Rank << "\n");
+ //DOUT << "Calculated Rank[" << V->getName() << "] = "
+ // << Rank << "\n";
return CachedRank = Rank;
}
isReassociableOp(RHS, I->getOpcode()) &&
"Not an expression that needs linearization?");
- DEBUG(std::cerr << "Linear" << *LHS << *RHS << *I);
+ DOUT << "Linear" << *LHS << *RHS << *I;
// Move the RHS instruction to live immediately before I, avoiding breaking
// dominator properties.
++NumLinear;
MadeChange = true;
- DEBUG(std::cerr << "Linearized: " << *I);
+ DOUT << "Linearized: " << *I;
// If D is part of this expression tree, tail recurse.
if (isReassociableOp(I->getOperand(1), I->getOpcode()))
if (I->getOperand(0) != Ops[i].Op ||
I->getOperand(1) != Ops[i+1].Op) {
Value *OldLHS = I->getOperand(0);
- DEBUG(std::cerr << "RA: " << *I);
+ DOUT << "RA: " << *I;
I->setOperand(0, Ops[i].Op);
I->setOperand(1, Ops[i+1].Op);
- DEBUG(std::cerr << "TO: " << *I);
+ DOUT << "TO: " << *I;
MadeChange = true;
++NumChanged;
assert(i+2 < Ops.size() && "Ops index out of range!");
if (I->getOperand(1) != Ops[i].Op) {
- DEBUG(std::cerr << "RA: " << *I);
+ DOUT << "RA: " << *I;
I->setOperand(1, Ops[i].Op);
- DEBUG(std::cerr << "TO: " << *I);
+ DOUT << "TO: " << *I;
MadeChange = true;
++NumChanged;
}
Sub->replaceAllUsesWith(New);
Sub->eraseFromParent();
- DEBUG(std::cerr << "Negated: " << *New);
+ DOUT << "Negated: " << *New;
return New;
}
// If any factor occurred more than one time, we can pull it out.
if (MaxOcc > 1) {
- DEBUG(std::cerr << "\nFACTORING [" << MaxOcc << "]: "
- << *MaxOccVal << "\n");
+ DOUT << "\nFACTORING [" << MaxOcc << "]: " << *MaxOccVal << "\n";
// Create a new instruction that uses the MaxOccVal twice. If we don't do
// this, we could otherwise run into situations where removing a factor
std::vector<ValueEntry> Ops;
LinearizeExprTree(I, Ops);
- DEBUG(std::cerr << "RAIn:\t"; PrintOps(I, Ops);
- std::cerr << "\n");
+ DOUT << "RAIn:\t"; DEBUG(PrintOps(I, Ops)); DOUT << "\n";
// Now that we have linearized the tree to a list and have gathered all of
// the operands and their ranks, sort the operands by their rank. Use a
if (Value *V = OptimizeExpression(I, Ops)) {
// This expression tree simplified to something that isn't a tree,
// eliminate it.
- DEBUG(std::cerr << "Reassoc to scalar: " << *V << "\n");
+ DOUT << "Reassoc to scalar: " << *V << "\n";
I->replaceAllUsesWith(V);
RemoveDeadBinaryOp(I);
return;
Ops.pop_back();
}
- DEBUG(std::cerr << "RAOut:\t"; PrintOps(I, Ops);
- std::cerr << "\n");
+ DOUT << "RAOut:\t"; DEBUG(PrintOps(I, Ops)); DOUT << "\n";
if (Ops.size() == 1) {
// This expression tree simplified to something that isn't a tree,
#include "llvm/Support/MathExtras.h"
#include "llvm/Support/Streams.h"
#include <algorithm>
-#include <iostream>
using namespace llvm;
namespace llvm {
// Value::dump - allow easy printing of Values from the debugger.
// Located here because so much of the needed functionality is here.
-void Value::dump() const { print(std::cerr); cerr << '\n'; }
+void Value::dump() const { print(*cerr.stream()); cerr << '\n'; }
// Type::dump - allow easy printing of Values from the debugger.
// Located here because so much of the needed functionality is here.
-void Type::dump() const { print(std::cerr); cerr << '\n'; }
+void Type::dump() const { print(*cerr.stream()); cerr << '\n'; }
//===----------------------------------------------------------------------===//
// SlotMachine Implementation
#include <algorithm>
#include <cstdarg>
#include <cstdlib>
-#include <iostream>
#include <map>
using namespace llvm;
// Module::dump() - Allow printing from debugger
void Module::dump() const {
- print(std::cerr);
+ print(*cerr.stream());
}
/// Target endian information...
#include "llvm/ADT/STLExtras.h"
#include "llvm/Support/ManagedStatic.h"
#include "llvm/Support/TypeInfo.h"
-#include <iostream>
#include <set>
using namespace llvm;
bool FunctionPassManager::run(Function &F) {
std::string errstr;
if (MP->materializeFunction(&F, &errstr)) {
- std::cerr << "Error reading bytecode file: " << errstr << "\n";
+ cerr << "Error reading bytecode file: " << errstr << "\n";
abort();
}
return PM->runOnFunction(F);
// Print out arguments for registered passes that are _optimizations_
if (const PassInfo *PI = P->getPassInfo())
if (!PI->isAnalysisGroup())
- std::cerr << " -" << PI->getPassArgument();
+ cerr << " -" << PI->getPassArgument();
}
}
void PMDebug::PrintPassInformation(unsigned Depth, const char *Action,
Pass *P, Module *M) {
if (PassDebugging >= Executions) {
- std::cerr << (void*)P << std::string(Depth*2+1, ' ') << Action << " '"
- << P->getPassName();
- if (M) std::cerr << "' on Module '" << M->getModuleIdentifier() << "'\n";
- std::cerr << "'...\n";
+ cerr << (void*)P << std::string(Depth*2+1, ' ') << Action << " '"
+ << P->getPassName();
+ if (M) cerr << "' on Module '" << M->getModuleIdentifier() << "'\n";
+ cerr << "'...\n";
}
}
void PMDebug::PrintPassInformation(unsigned Depth, const char *Action,
Pass *P, Function *F) {
if (PassDebugging >= Executions) {
- std::cerr << (void*)P << std::string(Depth*2+1, ' ') << Action << " '"
- << P->getPassName();
- if (F) std::cerr << "' on Function '" << F->getName();
- std::cerr << "'...\n";
+ cerr << (void*)P << std::string(Depth*2+1, ' ') << Action << " '"
+ << P->getPassName();
+ if (F) cerr << "' on Function '" << F->getName();
+ cerr << "'...\n";
}
}
void PMDebug::PrintPassInformation(unsigned Depth, const char *Action,
Pass *P, BasicBlock *BB) {
if (PassDebugging >= Executions) {
- std::cerr << (void*)P << std::string(Depth*2+1, ' ') << Action << " '"
- << P->getPassName();
- if (BB) std::cerr << "' on BasicBlock '" << BB->getName();
- std::cerr << "'...\n";
+ cerr << (void*)P << std::string(Depth*2+1, ' ') << Action << " '"
+ << P->getPassName();
+ if (BB) cerr << "' on BasicBlock '" << BB->getName();
+ cerr << "'...\n";
}
}
void PMDebug::PrintAnalysisSetInfo(unsigned Depth, const char *Msg,
Pass *P, const std::vector<AnalysisID> &Set){
if (PassDebugging >= Details && !Set.empty()) {
- std::cerr << (void*)P << std::string(Depth*2+3, ' ') << Msg << " Analyses:";
+ cerr << (void*)P << std::string(Depth*2+3, ' ') << Msg << " Analyses:";
for (unsigned i = 0; i != Set.size(); ++i) {
- if (i) std::cerr << ",";
- std::cerr << " " << Set[i]->getPassName();
+ if (i) cerr << ",";
+ cerr << " " << Set[i]->getPassName();
}
- std::cerr << "\n";
+ cerr << "\n";
}
}
// dumpPassStructure - Implement the -debug-passes=Structure option
void Pass::dumpPassStructure(unsigned Offset) {
- std::cerr << std::string(Offset*2, ' ') << getPassName() << "\n";
+ cerr << std::string(Offset*2, ' ') << getPassName() << "\n";
}
// getPassName - Use C++ RTTI to get a SOMEWHAT intelligible name for the pass.
O << "Pass::print not implemented for pass: '" << getPassName() << "'!\n";
}
-// dump - call print(std::cerr);
+// dump - call print(cerr);
void Pass::dump() const {
- print(std::cerr, 0);
+ print(*cerr.stream(), 0);
}
//===----------------------------------------------------------------------===//
#include "llvm/Support/LeakDetector.h"
#include "llvm/Support/Timer.h"
#include <algorithm>
-#include <iostream>
namespace llvm {
static void PerformPassStartupStuff(Pass *P) {
// If debugging is enabled, print out argument information...
if (PassDebugging >= Arguments) {
- std::cerr << "Pass Arguments: ";
+ cerr << "Pass Arguments: ";
PrintArgumentInformation(P);
- std::cerr << "\n";
+ cerr << "\n";
// Print the pass execution structure
if (PassDebugging >= Structure)
for (unsigned i = 0, e = ImmutablePasses.size(); i != e; ++i)
ImmutablePasses[i]->dumpPassStructure(0);
- std::cerr << std::string(Offset*2, ' ') << this->getPMName()
- << " Pass Manager\n";
+ cerr << std::string(Offset*2, ' ') << this->getPMName()
+ << " Pass Manager\n";
for (typename std::vector<PassClass*>::iterator
I = Passes.begin(), E = Passes.end(); I != E; ++I) {
PassClass *P = *I;
for (std::map<Pass*, Pass*>::iterator I = LastUseOf.begin(),
E = LastUseOf.end(); I != E; ++I) {
if (P == I->second) {
- std::cerr << "--" << std::string(Offset*2, ' ');
+ cerr << "--" << std::string(Offset*2, ' ');
I->first->dumpPassStructure(0);
}
}
E = AU.getRequiredSet().end(); I != E; ++I) {
Pass *Impl = getAnalysisOrNullUp(*I);
if (Impl == 0) {
- std::cerr << "Analysis '" << (*I)->getPassName()
- << "' used but not available!";
+ cerr << "Analysis '" << (*I)->getPassName()
+ << "' used but not available!";
assert(0 && "Analysis used but not available!");
} else if (PassDebugging == Details) {
if ((*I)->getPassName() != std::string(Impl->getPassName()))
- std::cerr << " Interface '" << (*I)->getPassName()
- << "' implemented by '" << Impl->getPassName() << "'\n";
+ cerr << " Interface '" << (*I)->getPassName()
+ << "' implemented by '" << Impl->getPassName() << "'\n";
}
IP->AnalysisImpls.push_back(std::make_pair(*I, Impl));
}
E = AnUsage.getRequiredSet().end(); I != E; ++I) {
Pass *Impl = getAnalysisOrNullUp(*I);
if (Impl == 0) {
- std::cerr << "Analysis '" << (*I)->getPassName()
- << "' used but not available!";
+ cerr << "Analysis '" << (*I)->getPassName()
+ << "' used but not available!";
assert(0 && "Analysis used but not available!");
} else if (PassDebugging == Details) {
if ((*I)->getPassName() != std::string(Impl->getPassName()))
- std::cerr << " Interface '" << (*I)->getPassName()
- << "' implemented by '" << Impl->getPassName() << "'\n";
+ cerr << " Interface '" << (*I)->getPassName()
+ << "' implemented by '" << Impl->getPassName() << "'\n";
}
P->AnalysisImpls.push_back(std::make_pair(*I, Impl));