1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 11:13:28 +01:00

Removing even more <iostream> includes.

llvm-svn: 32320
This commit is contained in:
Bill Wendling 2006-12-07 20:04:42 +00:00
parent 0117a3e391
commit 23b8b13c9d
27 changed files with 414 additions and 447 deletions

View File

@ -1042,7 +1042,7 @@ extern bool DebugFlag;
// debug build, then the code specified as the option to the macro will be
// executed. Otherwise it will not be. Example:
//
// DEBUG(std::cerr &lt;&lt; "Bitset contains: " &lt;&lt; Bitset &lt;&lt; "\n");
// DOUT &lt;&lt; "Bitset contains: " &lt;&lt; Bitset &lt;&lt; "\n";
//</i>
<span class="doc_hilite">#ifdef NDEBUG
#define DEBUG(X)

View File

@ -395,7 +395,7 @@ tool) is run with the '<tt>-debug</tt>' command line argument:</p>
<div class="doc_code">
<pre>
DEBUG(std::cerr &lt;&lt; "I am here!\n");
DOUT &lt;&lt; "I am here!\n";
</pre>
</div>
@ -440,16 +440,16 @@ option as follows:</p>
<div class="doc_code">
<pre>
DEBUG(std::cerr &lt;&lt; "No debug type\n");
DOUT &lt;&lt; "No debug type\n";
#undef DEBUG_TYPE
#define DEBUG_TYPE "foo"
DEBUG(std::cerr &lt;&lt; "'foo' debug type\n");
DOUT &lt;&lt; "'foo' debug type\n";
#undef DEBUG_TYPE
#define DEBUG_TYPE "bar"
DEBUG(std::cerr &lt;&lt; "'bar' debug type\n");
DOUT &lt;&lt; "'bar' debug type\n";
#undef DEBUG_TYPE
#define DEBUG_TYPE ""
DEBUG(std::cerr &lt;&lt; "No debug type (2)\n");
DOUT &lt;&lt; "No debug type (2)\n";
</pre>
</div>
@ -695,8 +695,8 @@ an example that prints the name of a <tt>BasicBlock</tt> and the number of
for (Function::iterator i = func-&gt;begin(), e = func-&gt;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 &lt;&lt; "Basic block (name=" &lt;&lt; i-&gt;getName() &lt;&lt; ") has "
&lt;&lt; i-&gt;size() &lt;&lt; " instructions.\n";
llvm::cerr &lt;&lt; "Basic block (name=" &lt;&lt; i-&gt;getName() &lt;&lt; ") has "
&lt;&lt; i-&gt;size() &lt;&lt; " instructions.\n";
</pre>
</div>
@ -728,14 +728,14 @@ a <tt>BasicBlock</tt>:</p>
for (BasicBlock::iterator i = blk-&gt;begin(), e = blk-&gt;end(); i != e; ++i)
// <i>The next statement works since operator&lt;&lt;(ostream&amp;,...)</i>
// <i>is overloaded for Instruction&amp;</i>
std::cerr &lt;&lt; *i &lt;&lt; "\n";
llvm::cerr &lt;&lt; *i &lt;&lt; "\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 &lt;&lt; *blk &lt;&lt; "\n";</tt>.</p>
basic block itself: <tt>llvm::cerr &lt;&lt; *blk &lt;&lt; "\n";</tt>.</p>
</div>
@ -761,7 +761,7 @@ small example that shows how to dump all instructions in a function to the stand
// <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 &lt;&lt; *i &lt;&lt; "\n";
llvm::cerr &lt;&lt; *i &lt;&lt; "\n";
</pre>
</div>
@ -837,7 +837,7 @@ without actually obtaining it via iteration over some structure:</p>
void printNextInstruction(Instruction* inst) {
BasicBlock::iterator it(inst);
++it; // <i>After this line, it refers to the instruction after *inst</i>
if (it != inst-&gt;getParent()-&gt;end()) std::cerr &lt;&lt; *it &lt;&lt; "\n";
if (it != inst-&gt;getParent()-&gt;end()) llvm::cerr &lt;&lt; *it &lt;&lt; "\n";
}
</pre>
</div>
@ -956,8 +956,8 @@ Function* F = ...;
for (Value::use_iterator i = F-&gt;use_begin(), e = F-&gt;use_end(); i != e; ++i)
if (Instruction *Inst = dyn_cast&lt;Instruction&gt;(*i)) {
std::cerr &lt;&lt; "F is used in instruction:\n";
std::cerr &lt;&lt; *Inst &lt;&lt; "\n";
llvm::cerr &lt;&lt; "F is used in instruction:\n";
llvm::cerr &lt;&lt; *Inst &lt;&lt; "\n";
}
</pre>
</div>

View File

@ -257,7 +257,7 @@ time.</p>
<div class="doc_code"><pre>
<b>virtual bool</b> <a href="#runOnFunction">runOnFunction</a>(Function &amp;F) {
std::cerr &lt;&lt; "<i>Hello: </i>" &lt;&lt; F.getName() &lt;&lt; "\n";
llvm::cerr &lt;&lt; "<i>Hello: </i>" &lt;&lt; F.getName() &lt;&lt; "\n";
<b>return false</b>;
}
}; <i>// end of struct Hello</i>
@ -289,7 +289,7 @@ argument "<tt>hello</tt>", and a name "<tt>Hello World Pass</tt>".</p>
<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 &amp;F) {
std::cerr &lt;&lt; "<i>Hello: </i>" &lt;&lt; F.getName() &lt;&lt; "\n";
llvm::cerr &lt;&lt; "<i>Hello: </i>" &lt;&lt; F.getName() &lt;&lt; "\n";
<b>return false</b>;
}
};
@ -863,7 +863,7 @@ implement the virtual <tt>print</tt> method:</p>
<div class="doc_text">
<div class="doc_code"><pre>
<b>virtual void</b> print(std::ostream &amp;O, <b>const</b> Module *M) <b>const</b>;
<b>virtual void</b> print(llvm::OStream &amp;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
@ -871,7 +871,7 @@ a human readable version of the analysis results. This is useful for debugging
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

View File

@ -21,9 +21,7 @@
#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;
@ -589,10 +587,10 @@ const char *AnchorDesc::getTypeString() const {
#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
@ -664,14 +662,14 @@ const char *CompileUnitDesc::getAnchorString() const {
#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
@ -718,17 +716,17 @@ const char *TypeDesc::getTypeString() const {
#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
@ -766,13 +764,13 @@ const char *BasicTypeDesc::getTypeString() const {
#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
@ -823,15 +821,15 @@ const char *DerivedTypeDesc::getTypeString() const {
#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
@ -880,16 +878,16 @@ const char *CompositeTypeDesc::getTypeString() const {
#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
@ -929,11 +927,11 @@ const char *SubrangeDesc::getTypeString() const {
#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
@ -973,11 +971,11 @@ const char *EnumeratorDesc::getTypeString() const {
#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
@ -1031,14 +1029,14 @@ const char *VariableDesc::getTypeString() const {
#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
@ -1114,19 +1112,19 @@ const char *GlobalVariableDesc::getAnchorString() const {
#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
@ -1168,18 +1166,18 @@ const char *SubprogramDesc::getAnchorString() const {
#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
@ -1217,10 +1215,10 @@ const char *BlockDesc::getTypeString() const {
#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

View File

@ -758,7 +758,7 @@ void RA::AllocateBasicBlock(MachineBasicBlock &MBB) {
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?");

View File

@ -38,8 +38,6 @@
#include "llvm/Support/Compiler.h"
#include "llvm/Support/CommandLine.h"
#include <algorithm>
#include <iostream>
#include <algorithm>
using namespace llvm;
namespace {
@ -101,9 +99,9 @@ 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);
@ -152,9 +150,9 @@ namespace {
// 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);
@ -455,9 +453,9 @@ void DAGCombiner::Run(bool RunningAfterLegalize) {
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);
@ -2801,9 +2799,9 @@ bool DAGCombiner::CombineToPreIndexedLoadStore(SDNode *N) {
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),
@ -2924,9 +2922,9 @@ bool DAGCombiner::CombineToPostIndexedLoadStore(SDNode *N) {
: 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),

View File

@ -24,7 +24,6 @@
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Compiler.h"
#include "llvm/ADT/SmallVector.h"
#include <iostream>
#include <map>
using namespace llvm;
@ -556,7 +555,7 @@ SDOperand SelectionDAGLegalize::LegalizeOp(SDOperand Op) {
}
// 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();
@ -2975,7 +2974,7 @@ SDOperand SelectionDAGLegalize::PromoteOp(SDOperand Op) {
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();
@ -4371,7 +4370,7 @@ void SelectionDAGLegalize::ExpandOp(SDOperand Op, SDOperand &Lo, SDOperand &Hi){
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();
@ -5020,7 +5019,7 @@ SDOperand SelectionDAGLegalize::PackVectorOp(SDOperand Op,
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:

View File

@ -24,10 +24,8 @@
#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.
@ -430,9 +428,9 @@ void ScheduleDAG::EmitNode(SDNode *Node,
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;
@ -614,7 +612,7 @@ void ScheduleDAG::dumpSchedule() const {
if (SUnit *SU = Sequence[i])
SU->dump(&DAG);
else
std::cerr << "**** NOOP ****\n";
cerr << "**** NOOP ****\n";
}
}
@ -634,14 +632,14 @@ MachineBasicBlock *ScheduleDAG::Run() {
/// 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";
}
}
}
@ -649,35 +647,35 @@ void SUnit::dump(const SelectionDAG *G) const {
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";
}

View File

@ -31,7 +31,6 @@
#include "llvm/Support/Compiler.h"
#include "llvm/ADT/Statistic.h"
#include <climits>
#include <iostream>
#include <queue>
using namespace llvm;
@ -93,7 +92,7 @@ HazardRecognizer::~HazardRecognizer() {}
/// Schedule - Schedule the DAG using list scheduling.
void ScheduleDAGList::Schedule() {
DEBUG(std::cerr << "********** List Scheduling **********\n");
DOUT << "********** List Scheduling **********\n";
// Build scheduling units.
BuildSchedUnits();
@ -104,9 +103,9 @@ void ScheduleDAGList::Schedule() {
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();
@ -155,7 +154,7 @@ void ScheduleDAGList::ReleaseSucc(SUnit *SuccSU, bool isChain) {
/// 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);
@ -259,7 +258,7 @@ void ScheduleDAGList::ListScheduleTopDown() {
} 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;
@ -267,7 +266,7 @@ void ScheduleDAGList::ListScheduleTopDown() {
// 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;
@ -281,9 +280,9 @@ void ScheduleDAGList::ListScheduleTopDown() {
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;
}
}

View File

@ -27,7 +27,6 @@
#include "llvm/Support/Compiler.h"
#include "llvm/ADT/Statistic.h"
#include <climits>
#include <iostream>
#include <queue>
#include "llvm/Support/CommandLine.h"
using namespace llvm;
@ -85,7 +84,7 @@ private:
/// Schedule - Schedule the DAG using list scheduling.
void ScheduleDAGRRList::Schedule() {
DEBUG(std::cerr << "********** List Scheduling **********\n");
DOUT << "********** List Scheduling **********\n";
// Build scheduling units.
BuildSchedUnits();
@ -107,9 +106,9 @@ void ScheduleDAGRRList::Schedule() {
CommuteNodesToReducePressure();
DEBUG(std::cerr << "*** Final schedule ***\n");
DOUT << "*** Final schedule ***\n";
DEBUG(dumpSchedule());
DEBUG(std::cerr << "\n");
DOUT << "\n";
// Emit in scheduled order
EmitSchedule();
@ -186,9 +185,9 @@ void ScheduleDAGRRList::ReleasePred(SUnit *PredSU, bool isChain,
#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
@ -206,7 +205,7 @@ void ScheduleDAGRRList::ReleasePred(SUnit *PredSU, bool isChain,
/// 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;
@ -268,9 +267,9 @@ void ScheduleDAGRRList::ListScheduleBottomUp() {
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;
}
}
@ -299,9 +298,9 @@ void ScheduleDAGRRList::ReleaseSucc(SUnit *SuccSU, bool isChain,
#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
@ -317,7 +316,7 @@ void ScheduleDAGRRList::ReleaseSucc(SUnit *SuccSU, bool isChain,
/// 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;
@ -374,9 +373,9 @@ void ScheduleDAGRRList::ListScheduleTopDown() {
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;
}
}
@ -707,8 +706,8 @@ void BURegReductionPriorityQueue<SF>::AddPseudoTwoAddrDeps() {
(!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))

View File

@ -25,10 +25,8 @@
#include "llvm/Support/Debug.h"
#include "llvm/Support/Compiler.h"
#include <algorithm>
#include <iostream>
using namespace llvm;
namespace {
static RegisterScheduler
@ -475,7 +473,7 @@ private:
/// print - Print ordering to specified output stream.
///
void print(std::ostream &O) const;
void print(OStream &O) const;
void dump(const char *tag) const;
@ -487,7 +485,7 @@ private:
/// 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.
///
@ -638,7 +636,7 @@ void ScheduleDAGSimple::AddToGroup(NodeInfo *D, NodeInfo *U) {
/// 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++) {
@ -659,11 +657,11 @@ void ScheduleDAGSimple::print(std::ostream &O) const {
}
void ScheduleDAGSimple::dump(const char *tag) const {
std::cerr << tag; dump();
cerr << tag; dump();
}
void ScheduleDAGSimple::dump() const {
print(std::cerr);
print(cerr);
}
@ -712,7 +710,7 @@ static bool isFlagUser(SDNode *A) {
/// 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 << " "
@ -741,25 +739,25 @@ void ScheduleDAGSimple::printChanges(unsigned Index) const {
}
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
}

View File

@ -559,7 +559,7 @@ void SelectionDAG::RemoveNodeFromCSEMaps(SDNode *N) {
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
@ -2860,102 +2860,102 @@ const char *SDNode::getIndexedModeName(ISD::MemIndexedMode AM) {
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;
}
}
@ -2964,16 +2964,16 @@ static void DumpNodes(const SDNode *N, unsigned indent, const SelectionDAG *G) {
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)
@ -2988,7 +2988,7 @@ void SelectionDAG::dump() const {
if (getRoot().Val) DumpNodes(getRoot().Val, 2, this);
std::cerr << "\n\n";
cerr << "\n\n";
}
const Type *ConstantPoolSDNode::getType() const {

View File

@ -44,7 +44,6 @@
#include "llvm/Support/MathExtras.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/Compiler.h"
#include <iostream>
#include <algorithm>
using namespace llvm;
@ -2614,8 +2613,8 @@ void SelectionDAGLowering::visitInlineAsm(CallInst &I) {
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);
}
@ -2686,8 +2685,8 @@ void SelectionDAGLowering::visitInlineAsm(CallInst &I) {
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);
}
@ -2826,9 +2825,9 @@ void SelectionDAGLowering::visitFree(FreeInst &I) {
// 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;
}
@ -3757,7 +3756,7 @@ static void SplitEdgeNicely(TerminatorInst *TI, unsigned SuccNum, Pass *P) {
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.
//
@ -4092,14 +4091,14 @@ void SelectionDAGISel::CodeGenAndEmitDAG(SelectionDAG &DAG) {
// 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.
@ -4111,7 +4110,7 @@ void SelectionDAGISel::CodeGenAndEmitDAG(SelectionDAG &DAG) {
// code to the MachineBasicBlock.
InstructionSelectBasicBlock(DAG);
DEBUG(std::cerr << "Selected machine code:\n");
DOUT << "Selected machine code:\n";
DEBUG(BB->dump());
}
@ -4353,7 +4352,7 @@ SelectInlineAsmMemoryOperands(std::vector<SDOperand> &Ops, SelectionDAG &DAG) {
// 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);
}

View File

@ -24,7 +24,6 @@
#include "llvm/Config/config.h"
#include <fstream>
#include <sstream>
#include <iostream>
using namespace llvm;
namespace llvm {
@ -185,8 +184,8 @@ void SelectionDAG::viewGraph() {
#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
}
@ -197,8 +196,8 @@ void SelectionDAG::clearGraphAttrs() {
#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
}
@ -209,8 +208,8 @@ void SelectionDAG::setGraphAttrs(const SDNode *N, const char *Attrs) {
#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
}
@ -227,8 +226,8 @@ const std::string SelectionDAG::getGraphAttrs(const SDNode *N) const {
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
}
@ -239,8 +238,8 @@ void SelectionDAG::setGraphColor(const SDNode *N, const char *Color) {
#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
}

View File

@ -21,7 +21,6 @@
#include "llvm/Support/CallSite.h"
#include "llvm/Target/TargetData.h"
#include "llvm/Support/DataTypes.h"
#include <iostream>
namespace llvm {
@ -158,7 +157,7 @@ public:
void visitAShr(ShiftInst &I);
void visitVAArgInst(VAArgInst &I);
void visitInstruction(Instruction &I) {
std::cerr << I;
cerr << I;
assert(0 && "Instruction not interpretable yet!");
}

View File

@ -18,7 +18,6 @@
#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,
@ -115,8 +114,8 @@ void *JIT::getPointerToNamedFunction(const std::string &Name) {
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;
}

View File

@ -27,7 +27,6 @@
#include "llvm/Target/TargetData.h"
#include "llvm/Target/TargetMachine.h"
#include "llvm/Target/TargetJITInfo.h"
#include <iostream>
using namespace llvm;
#ifdef __APPLE__
@ -64,7 +63,7 @@ JIT::JIT(ModuleProvider *MP, TargetMachine &tm, TargetJITInfo &tji)
// 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();
}
@ -279,8 +278,8 @@ void *JIT::getPointerToFunction(Function *F) {
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();
}
}
@ -323,8 +322,8 @@ void *JIT::getOrEmitGlobalVariable(const GlobalVariable *GV) {
#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 {

View File

@ -30,7 +30,6 @@
#include "llvm/ADT/Statistic.h"
#include "llvm/System/Memory.h"
#include <algorithm>
#include <iostream>
using namespace llvm;
namespace {
@ -410,7 +409,7 @@ unsigned char *JITMemoryManager::allocateStub(unsigned StubSize,
~(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;
@ -422,8 +421,8 @@ sys::MemoryBlock JITMemoryManager::getNewMemoryBlock(unsigned size) {
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);
@ -562,8 +561,8 @@ void *JITResolver::getFunctionStub(Function *F) {
// 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!
@ -583,8 +582,8 @@ void *JITResolver::getExternalFunctionStub(void *FnAddr) {
// 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;
}
@ -593,8 +592,8 @@ unsigned JITResolver::getGOTIndexForAddr(void* addr) {
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;
@ -618,8 +617,8 @@ void *JITResolver::JITCompilerFn(void *Stub) {
// 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();
}
@ -630,9 +629,9 @@ void *JITResolver::JITCompilerFn(void *Stub) {
// 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);
@ -693,7 +692,7 @@ namespace {
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);
@ -788,7 +787,7 @@ void JITEmitter::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();
}
@ -837,9 +836,9 @@ bool JITEmitter::finishFunction(MachineFunction &F) {
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;
}
}
@ -853,8 +852,8 @@ bool JITEmitter::finishFunction(MachineFunction &F) {
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;
}
}
@ -862,10 +861,10 @@ bool JITEmitter::finishFunction(MachineFunction &F) {
// 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;
}
@ -890,8 +889,8 @@ void JITEmitter::emitConstantPool(MachineConstantPool *MCP) {
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);

View File

@ -18,7 +18,6 @@
#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>
@ -45,9 +44,9 @@ ExecutionEngine *JIT::create(ModuleProvider *MP) {
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

View File

@ -62,13 +62,13 @@ static bool ResolveFunctions(Module &M, std::vector<GlobalValue*> &Globals,
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
@ -82,14 +82,14 @@ static bool ResolveFunctions(Module &M, std::vector<GlobalValue*> &Globals,
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;
}
@ -164,8 +164,8 @@ static bool ProcessGlobalsWithSameName(Module &M, TargetData &TD,
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!
}
@ -192,9 +192,9 @@ static bool ProcessGlobalsWithSameName(Module &M, TargetData &TD,
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;
@ -251,11 +251,11 @@ static bool ProcessGlobalsWithSameName(Module &M, TargetData &TD,
}
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";
}
}

View File

@ -42,7 +42,6 @@
#include "llvm/ADT/PostOrderIterator.h"
#include "llvm/ADT/Statistic.h"
#include <algorithm>
#include <iostream>
using namespace llvm;
namespace {
@ -336,7 +335,7 @@ bool CEE::TransformRegion(BasicBlock *BB, std::set<BasicBlock*> &VisitedBlocks){
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);
@ -517,11 +516,10 @@ void CEE::ForwardSuccessorTo(TerminatorInst *TI, unsigned SuccNo,
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
@ -628,7 +626,7 @@ void CEE::ForwardSuccessorTo(TerminatorInst *TI, unsigned SuccNo,
// 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
@ -921,9 +919,9 @@ void CEE::PropagateRelation(Instruction::BinaryOps Opcode, Value *Op0,
//
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;
}
@ -1033,8 +1031,7 @@ bool CEE::SimplifyBasicBlock(BasicBlock &BB, const RegionInfo &RI) {
// 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.
@ -1061,8 +1058,8 @@ bool CEE::SimplifyInstruction(Instruction *I, const RegionInfo &RI) {
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;
@ -1090,7 +1087,7 @@ Relation::KnownResult CEE::getSetCCResult(SetCondInst *SCI,
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;
}
@ -1313,6 +1310,6 @@ void Relation::print(std::ostream &OS) const {
}
// 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()); }

View File

@ -88,7 +88,6 @@
#include "llvm/Transforms/Utils/Local.h"
#include <algorithm>
#include <deque>
#include <iostream>
#include <sstream>
#include <map>
using namespace llvm;
@ -272,7 +271,7 @@ namespace {
}
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.");
@ -561,7 +560,7 @@ namespace {
}
void addToWorklist(Instruction *I) {
//DEBUG(std::cerr << "addToWorklist: " << *I << "\n");
//DOUT << "addToWorklist: " << *I << "\n";
if (!isa<BinaryOperator>(I) && !isa<SelectInst>(I)) return;
@ -574,7 +573,7 @@ namespace {
}
void addRecursive(Value *V) {
//DEBUG(std::cerr << "addRecursive: " << *V << "\n");
//DOUT << "addRecursive: " << *V << "\n";
Instruction *I = dyn_cast<Instruction>(V);
if (I)
@ -582,7 +581,7 @@ namespace {
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.
@ -594,14 +593,14 @@ namespace {
}
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:
@ -660,8 +659,7 @@ namespace {
// 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);
@ -694,8 +692,8 @@ namespace {
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;
@ -772,8 +770,7 @@ namespace {
}
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.
@ -837,9 +834,9 @@ namespace {
}
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();
@ -847,8 +844,8 @@ namespace {
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)),
@ -1135,17 +1132,17 @@ namespace {
// 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)) {
@ -1158,8 +1155,7 @@ namespace {
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();
@ -1173,16 +1169,16 @@ namespace {
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";
}
};
@ -1190,7 +1186,7 @@ namespace {
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()));
@ -1236,15 +1232,15 @@ namespace {
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);

View File

@ -33,7 +33,6 @@
#include "llvm/ADT/PostOrderIterator.h"
#include "llvm/ADT/Statistic.h"
#include <algorithm>
#include <iostream>
using namespace llvm;
namespace {
@ -57,10 +56,10 @@ 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;
}
@ -169,8 +168,8 @@ unsigned Reassociate::getRank(Value *V) {
(!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;
}
@ -212,7 +211,7 @@ void Reassociate::LinearizeExpr(BinaryOperator *I) {
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.
@ -225,7 +224,7 @@ void Reassociate::LinearizeExpr(BinaryOperator *I) {
++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()))
@ -320,10 +319,10 @@ void Reassociate::RewriteExprTree(BinaryOperator *I,
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;
@ -336,9 +335,9 @@ void Reassociate::RewriteExprTree(BinaryOperator *I,
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;
}
@ -419,7 +418,7 @@ static Instruction *BreakUpSubtract(Instruction *Sub) {
Sub->replaceAllUsesWith(New);
Sub->eraseFromParent();
DEBUG(std::cerr << "Negated: " << *New);
DOUT << "Negated: " << *New;
return New;
}
@ -693,8 +692,7 @@ Value *Reassociate::OptimizeExpression(BinaryOperator *I,
// 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
@ -807,8 +805,7 @@ void Reassociate::ReassociateExpression(BinaryOperator *I) {
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
@ -823,7 +820,7 @@ void Reassociate::ReassociateExpression(BinaryOperator *I) {
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;
@ -841,8 +838,7 @@ void Reassociate::ReassociateExpression(BinaryOperator *I) {
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,

View File

@ -31,7 +31,6 @@
#include "llvm/Support/MathExtras.h"
#include "llvm/Support/Streams.h"
#include <algorithm>
#include <iostream>
using namespace llvm;
namespace llvm {
@ -1328,11 +1327,11 @@ void Argument::print(std::ostream &o) const {
// 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

View File

@ -22,7 +22,6 @@
#include <algorithm>
#include <cstdarg>
#include <cstdlib>
#include <iostream>
#include <map>
using namespace llvm;
@ -83,7 +82,7 @@ Module::~Module() {
// Module::dump() - Allow printing from debugger
void Module::dump() const {
print(std::cerr);
print(*cerr.stream());
}
/// Target endian information...

View File

@ -20,7 +20,6 @@
#include "llvm/ADT/STLExtras.h"
#include "llvm/Support/ManagedStatic.h"
#include "llvm/Support/TypeInfo.h"
#include <iostream>
#include <set>
using namespace llvm;
@ -68,7 +67,7 @@ bool FunctionPassManager::doInitialization() {
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);
@ -114,49 +113,49 @@ void PMDebug::PrintArgumentInformation(const Pass *P) {
// 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";
}
}
@ -174,7 +173,7 @@ bool Pass::mustPreserveAnalysisID(const PassInfo *AnalysisID) const {
// 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.
@ -193,9 +192,9 @@ void Pass::print(std::ostream &O,const Module*) const {
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);
}
//===----------------------------------------------------------------------===//

View File

@ -27,7 +27,6 @@
#include "llvm/Support/LeakDetector.h"
#include "llvm/Support/Timer.h"
#include <algorithm>
#include <iostream>
namespace llvm {
@ -62,9 +61,9 @@ struct PMDebug {
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)
@ -289,8 +288,8 @@ public:
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;
@ -300,7 +299,7 @@ public:
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);
}
}
@ -543,13 +542,13 @@ public:
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));
}
@ -632,13 +631,13 @@ private:
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));