mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-22 13:29:44 +00:00
Support for llvm_ostreams.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31988 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
f45148e113
commit
d96662360f
@ -29,7 +29,7 @@
|
|||||||
#include <bitset>
|
#include <bitset>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include <iostream>
|
#include <ostream>
|
||||||
|
|
||||||
namespace llvm {
|
namespace llvm {
|
||||||
|
|
||||||
@ -178,7 +178,7 @@ public:
|
|||||||
if (O.stream()) print(*O.stream());
|
if (O.stream()) print(*O.stream());
|
||||||
}
|
}
|
||||||
void print(std::ostream &O) const;
|
void print(std::ostream &O) const;
|
||||||
void dump() const { print(std::cerr); }
|
void dump() const { print(llvm_cerr); }
|
||||||
|
|
||||||
public:
|
public:
|
||||||
//
|
//
|
||||||
|
@ -43,8 +43,8 @@ namespace llvm {
|
|||||||
/// if (!I->isLeader()) continue; // Ignore non-leader sets.
|
/// if (!I->isLeader()) continue; // Ignore non-leader sets.
|
||||||
/// for (EquivalenceClasses<int>::member_iterator MI = EC.member_begin(I);
|
/// for (EquivalenceClasses<int>::member_iterator MI = EC.member_begin(I);
|
||||||
/// MI != EC.member_end(); ++MI) // Loop over members in this set.
|
/// MI != EC.member_end(); ++MI) // Loop over members in this set.
|
||||||
/// std::cerr << *MI << " "; // Print member.
|
/// llvm_cerr << *MI << " "; // Print member.
|
||||||
/// std::cerr << "\n"; // Finish set.
|
/// llvm_cerr << "\n"; // Finish set.
|
||||||
/// }
|
/// }
|
||||||
///
|
///
|
||||||
/// This example prints:
|
/// This example prints:
|
||||||
|
@ -71,8 +71,8 @@ class scc_iterator
|
|||||||
SCCNodeStack.push_back(N);
|
SCCNodeStack.push_back(N);
|
||||||
MinVisitNumStack.push_back(visitNum);
|
MinVisitNumStack.push_back(visitNum);
|
||||||
VisitStack.push_back(std::make_pair(N, GT::child_begin(N)));
|
VisitStack.push_back(std::make_pair(N, GT::child_begin(N)));
|
||||||
//DEBUG(std::cerr << "TarjanSCC: Node " << N <<
|
//DOUT << "TarjanSCC: Node " << N <<
|
||||||
// " : visitNum = " << visitNum << "\n");
|
// " : visitNum = " << visitNum << "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
// The stack-based DFS traversal; defined below.
|
// The stack-based DFS traversal; defined below.
|
||||||
@ -106,9 +106,9 @@ class scc_iterator
|
|||||||
if (!MinVisitNumStack.empty() && MinVisitNumStack.back() > minVisitNum)
|
if (!MinVisitNumStack.empty() && MinVisitNumStack.back() > minVisitNum)
|
||||||
MinVisitNumStack.back() = minVisitNum;
|
MinVisitNumStack.back() = minVisitNum;
|
||||||
|
|
||||||
//DEBUG(std::cerr << "TarjanSCC: Popped node " << visitingN <<
|
//DOUT << "TarjanSCC: Popped node " << visitingN <<
|
||||||
// " : minVisitNum = " << minVisitNum << "; Node visit num = " <<
|
// " : minVisitNum = " << minVisitNum << "; Node visit num = " <<
|
||||||
// nodeVisitNumbers[visitingN] << "\n");
|
// nodeVisitNumbers[visitingN] << "\n";
|
||||||
|
|
||||||
if (minVisitNum == nodeVisitNumbers[visitingN]) {
|
if (minVisitNum == nodeVisitNumbers[visitingN]) {
|
||||||
// A full SCC is on the SCCNodeStack! It includes all nodes below
|
// A full SCC is on the SCCNodeStack! It includes all nodes below
|
||||||
|
@ -378,9 +378,12 @@ public:
|
|||||||
|
|
||||||
/// print - Print a dot graph to the specified ostream...
|
/// print - Print a dot graph to the specified ostream...
|
||||||
///
|
///
|
||||||
|
void print(llvm_ostream &O) const {
|
||||||
|
if (O.stream()) print(*O.stream());
|
||||||
|
}
|
||||||
void print(std::ostream &O) const;
|
void print(std::ostream &O) const;
|
||||||
|
|
||||||
/// dump - call print(std::cerr), for use from the debugger...
|
/// dump - call print(llvm_cerr), for use from the debugger...
|
||||||
///
|
///
|
||||||
void dump() const;
|
void dump() const;
|
||||||
|
|
||||||
|
@ -362,6 +362,9 @@ public:
|
|||||||
///
|
///
|
||||||
void forwardNode(DSNode *To, unsigned Offset);
|
void forwardNode(DSNode *To, unsigned Offset);
|
||||||
|
|
||||||
|
void print(llvm_ostream &O, const DSGraph *G) const {
|
||||||
|
if (O.stream()) print(*O.stream(), G);
|
||||||
|
}
|
||||||
void print(std::ostream &O, const DSGraph *G) const;
|
void print(std::ostream &O, const DSGraph *G) const;
|
||||||
void dump() const;
|
void dump() const;
|
||||||
|
|
||||||
|
@ -20,16 +20,16 @@
|
|||||||
|
|
||||||
#include "llvm/Pass.h"
|
#include "llvm/Pass.h"
|
||||||
#include "llvm/Module.h"
|
#include "llvm/Module.h"
|
||||||
#include <iostream>
|
#include "llvm/Support/Streams.h"
|
||||||
|
|
||||||
namespace llvm {
|
namespace llvm {
|
||||||
|
|
||||||
class PrintModulePass : public ModulePass {
|
class PrintModulePass : public ModulePass {
|
||||||
std::ostream *Out; // ostream to print on
|
llvm_ostream *Out; // ostream to print on
|
||||||
bool DeleteStream; // Delete the ostream in our dtor?
|
bool DeleteStream; // Delete the ostream in our dtor?
|
||||||
public:
|
public:
|
||||||
PrintModulePass() : Out(&std::cerr), DeleteStream(false) {}
|
PrintModulePass() : Out(&llvm_cerr), DeleteStream(false) {}
|
||||||
PrintModulePass(std::ostream *o, bool DS = false)
|
PrintModulePass(llvm_ostream *o, bool DS = false)
|
||||||
: Out(o), DeleteStream(DS) {
|
: Out(o), DeleteStream(DS) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -49,11 +49,11 @@ public:
|
|||||||
|
|
||||||
class PrintFunctionPass : public FunctionPass {
|
class PrintFunctionPass : public FunctionPass {
|
||||||
std::string Banner; // String to print before each function
|
std::string Banner; // String to print before each function
|
||||||
std::ostream *Out; // ostream to print on
|
llvm_ostream *Out; // ostream to print on
|
||||||
bool DeleteStream; // Delete the ostream in our dtor?
|
bool DeleteStream; // Delete the ostream in our dtor?
|
||||||
public:
|
public:
|
||||||
PrintFunctionPass() : Banner(""), Out(&std::cerr), DeleteStream(false) {}
|
PrintFunctionPass() : Banner(""), Out(&llvm_cerr), DeleteStream(false) {}
|
||||||
PrintFunctionPass(const std::string &B, std::ostream *o = &std::cout,
|
PrintFunctionPass(const std::string &B, llvm_ostream *o = &llvm_cout,
|
||||||
bool DS = false)
|
bool DS = false)
|
||||||
: Banner(B), Out(o), DeleteStream(DS) {
|
: Banner(B), Out(o), DeleteStream(DS) {
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user