mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-12 17:32:19 +00:00
Convert ScalarEvolution to use raw_ostream instead of OStream.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69640 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
3e3702d00b
commit
b7ef72963b
@ -93,7 +93,8 @@ namespace llvm {
|
|||||||
/// print - Print out the internal representation of this scalar to the
|
/// print - Print out the internal representation of this scalar to the
|
||||||
/// specified stream. This should really only be used for debugging
|
/// specified stream. This should really only be used for debugging
|
||||||
/// purposes.
|
/// purposes.
|
||||||
virtual void print(std::ostream &OS) const = 0;
|
virtual void print(raw_ostream &OS) const = 0;
|
||||||
|
void print(std::ostream &OS) const;
|
||||||
void print(std::ostream *OS) const { if (OS) print(*OS); }
|
void print(std::ostream *OS) const { if (OS) print(*OS); }
|
||||||
|
|
||||||
/// dump - This method is used for debugging.
|
/// dump - This method is used for debugging.
|
||||||
@ -101,6 +102,11 @@ namespace llvm {
|
|||||||
void dump() const;
|
void dump() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
inline raw_ostream &operator<<(raw_ostream &OS, const SCEV &S) {
|
||||||
|
S.print(OS);
|
||||||
|
return OS;
|
||||||
|
}
|
||||||
|
|
||||||
inline std::ostream &operator<<(std::ostream &OS, const SCEV &S) {
|
inline std::ostream &operator<<(std::ostream &OS, const SCEV &S) {
|
||||||
S.print(OS);
|
S.print(OS);
|
||||||
return OS;
|
return OS;
|
||||||
@ -118,8 +124,7 @@ namespace llvm {
|
|||||||
virtual bool isLoopInvariant(const Loop *L) const;
|
virtual bool isLoopInvariant(const Loop *L) const;
|
||||||
virtual const Type *getType() const;
|
virtual const Type *getType() const;
|
||||||
virtual bool hasComputableLoopEvolution(const Loop *L) const;
|
virtual bool hasComputableLoopEvolution(const Loop *L) const;
|
||||||
virtual void print(std::ostream &OS) const;
|
virtual void print(raw_ostream &OS) const;
|
||||||
void print(std::ostream *OS) const { if (OS) print(*OS); }
|
|
||||||
virtual SCEVHandle
|
virtual SCEVHandle
|
||||||
replaceSymbolicValuesWithConcrete(const SCEVHandle &Sym,
|
replaceSymbolicValuesWithConcrete(const SCEVHandle &Sym,
|
||||||
const SCEVHandle &Conc,
|
const SCEVHandle &Conc,
|
||||||
@ -331,6 +336,7 @@ namespace llvm {
|
|||||||
virtual bool runOnFunction(Function &F);
|
virtual bool runOnFunction(Function &F);
|
||||||
virtual void releaseMemory();
|
virtual void releaseMemory();
|
||||||
virtual void getAnalysisUsage(AnalysisUsage &AU) const;
|
virtual void getAnalysisUsage(AnalysisUsage &AU) const;
|
||||||
|
void print(raw_ostream &OS, const Module* = 0) const;
|
||||||
virtual void print(std::ostream &OS, const Module* = 0) const;
|
virtual void print(std::ostream &OS, const Module* = 0) const;
|
||||||
void print(std::ostream *OS, const Module* M = 0) const {
|
void print(std::ostream *OS, const Module* M = 0) const {
|
||||||
if (OS) print(*OS, M);
|
if (OS) print(*OS, M);
|
||||||
|
@ -63,8 +63,7 @@ namespace llvm {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void print(std::ostream &OS) const;
|
virtual void print(raw_ostream &OS) const;
|
||||||
void print(std::ostream *OS) const { if (OS) print(*OS); }
|
|
||||||
|
|
||||||
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
||||||
static inline bool classof(const SCEVConstant *S) { return true; }
|
static inline bool classof(const SCEVConstant *S) { return true; }
|
||||||
@ -107,8 +106,7 @@ namespace llvm {
|
|||||||
|
|
||||||
virtual bool dominates(BasicBlock *BB, DominatorTree *DT) const;
|
virtual bool dominates(BasicBlock *BB, DominatorTree *DT) const;
|
||||||
|
|
||||||
virtual void print(std::ostream &OS) const;
|
virtual void print(raw_ostream &OS) const;
|
||||||
void print(std::ostream *OS) const { if (OS) print(*OS); }
|
|
||||||
|
|
||||||
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
||||||
static inline bool classof(const SCEVTruncateExpr *S) { return true; }
|
static inline bool classof(const SCEVTruncateExpr *S) { return true; }
|
||||||
@ -151,8 +149,7 @@ namespace llvm {
|
|||||||
|
|
||||||
bool dominates(BasicBlock *BB, DominatorTree *DT) const;
|
bool dominates(BasicBlock *BB, DominatorTree *DT) const;
|
||||||
|
|
||||||
virtual void print(std::ostream &OS) const;
|
virtual void print(raw_ostream &OS) const;
|
||||||
void print(std::ostream *OS) const { if (OS) print(*OS); }
|
|
||||||
|
|
||||||
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
||||||
static inline bool classof(const SCEVZeroExtendExpr *S) { return true; }
|
static inline bool classof(const SCEVZeroExtendExpr *S) { return true; }
|
||||||
@ -195,8 +192,7 @@ namespace llvm {
|
|||||||
|
|
||||||
bool dominates(BasicBlock *BB, DominatorTree *DT) const;
|
bool dominates(BasicBlock *BB, DominatorTree *DT) const;
|
||||||
|
|
||||||
virtual void print(std::ostream &OS) const;
|
virtual void print(raw_ostream &OS) const;
|
||||||
void print(std::ostream *OS) const { if (OS) print(*OS); }
|
|
||||||
|
|
||||||
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
||||||
static inline bool classof(const SCEVSignExtendExpr *S) { return true; }
|
static inline bool classof(const SCEVSignExtendExpr *S) { return true; }
|
||||||
@ -266,8 +262,7 @@ namespace llvm {
|
|||||||
virtual const char *getOperationStr() const = 0;
|
virtual const char *getOperationStr() const = 0;
|
||||||
|
|
||||||
virtual const Type *getType() const { return getOperand(0)->getType(); }
|
virtual const Type *getType() const { return getOperand(0)->getType(); }
|
||||||
virtual void print(std::ostream &OS) const;
|
virtual void print(raw_ostream &OS) const;
|
||||||
void print(std::ostream *OS) const { if (OS) print(*OS); }
|
|
||||||
|
|
||||||
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
||||||
static inline bool classof(const SCEVCommutativeExpr *S) { return true; }
|
static inline bool classof(const SCEVCommutativeExpr *S) { return true; }
|
||||||
@ -360,8 +355,7 @@ namespace llvm {
|
|||||||
|
|
||||||
virtual const Type *getType() const;
|
virtual const Type *getType() const;
|
||||||
|
|
||||||
void print(std::ostream &OS) const;
|
void print(raw_ostream &OS) const;
|
||||||
void print(std::ostream *OS) const { if (OS) print(*OS); }
|
|
||||||
|
|
||||||
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
||||||
static inline bool classof(const SCEVUDivExpr *S) { return true; }
|
static inline bool classof(const SCEVUDivExpr *S) { return true; }
|
||||||
@ -453,8 +447,7 @@ namespace llvm {
|
|||||||
|
|
||||||
bool dominates(BasicBlock *BB, DominatorTree *DT) const;
|
bool dominates(BasicBlock *BB, DominatorTree *DT) const;
|
||||||
|
|
||||||
virtual void print(std::ostream &OS) const;
|
virtual void print(raw_ostream &OS) const;
|
||||||
void print(std::ostream *OS) const { if (OS) print(*OS); }
|
|
||||||
|
|
||||||
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
||||||
static inline bool classof(const SCEVAddRecExpr *S) { return true; }
|
static inline bool classof(const SCEVAddRecExpr *S) { return true; }
|
||||||
@ -538,8 +531,7 @@ namespace llvm {
|
|||||||
|
|
||||||
virtual const Type *getType() const;
|
virtual const Type *getType() const;
|
||||||
|
|
||||||
virtual void print(std::ostream &OS) const;
|
virtual void print(raw_ostream &OS) const;
|
||||||
void print(std::ostream *OS) const { if (OS) print(*OS); }
|
|
||||||
|
|
||||||
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
||||||
static inline bool classof(const SCEVUnknown *S) { return true; }
|
static inline bool classof(const SCEVUnknown *S) { return true; }
|
||||||
|
@ -79,7 +79,7 @@
|
|||||||
#include "llvm/Support/InstIterator.h"
|
#include "llvm/Support/InstIterator.h"
|
||||||
#include "llvm/Support/ManagedStatic.h"
|
#include "llvm/Support/ManagedStatic.h"
|
||||||
#include "llvm/Support/MathExtras.h"
|
#include "llvm/Support/MathExtras.h"
|
||||||
#include "llvm/Support/Streams.h"
|
#include "llvm/Support/raw_ostream.h"
|
||||||
#include "llvm/ADT/Statistic.h"
|
#include "llvm/ADT/Statistic.h"
|
||||||
#include "llvm/ADT/STLExtras.h"
|
#include "llvm/ADT/STLExtras.h"
|
||||||
#include <ostream>
|
#include <ostream>
|
||||||
@ -115,8 +115,13 @@ char ScalarEvolution::ID = 0;
|
|||||||
//
|
//
|
||||||
SCEV::~SCEV() {}
|
SCEV::~SCEV() {}
|
||||||
void SCEV::dump() const {
|
void SCEV::dump() const {
|
||||||
print(cerr);
|
print(errs());
|
||||||
cerr << '\n';
|
errs() << '\n';
|
||||||
|
}
|
||||||
|
|
||||||
|
void SCEV::print(std::ostream &o) const {
|
||||||
|
raw_os_ostream OS(o);
|
||||||
|
print(OS);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SCEV::isZero() const {
|
bool SCEV::isZero() const {
|
||||||
@ -150,7 +155,7 @@ replaceSymbolicValuesWithConcrete(const SCEVHandle &Sym,
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SCEVCouldNotCompute::print(std::ostream &OS) const {
|
void SCEVCouldNotCompute::print(raw_ostream &OS) const {
|
||||||
OS << "***COULDNOTCOMPUTE***";
|
OS << "***COULDNOTCOMPUTE***";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -181,7 +186,7 @@ SCEVHandle ScalarEvolution::getConstant(const APInt& Val) {
|
|||||||
|
|
||||||
const Type *SCEVConstant::getType() const { return V->getType(); }
|
const Type *SCEVConstant::getType() const { return V->getType(); }
|
||||||
|
|
||||||
void SCEVConstant::print(std::ostream &OS) const {
|
void SCEVConstant::print(raw_ostream &OS) const {
|
||||||
WriteAsOperand(OS, V, false);
|
WriteAsOperand(OS, V, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -210,7 +215,7 @@ bool SCEVTruncateExpr::dominates(BasicBlock *BB, DominatorTree *DT) const {
|
|||||||
return Op->dominates(BB, DT);
|
return Op->dominates(BB, DT);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SCEVTruncateExpr::print(std::ostream &OS) const {
|
void SCEVTruncateExpr::print(raw_ostream &OS) const {
|
||||||
OS << "(truncate " << *Op << " to " << *Ty << ")";
|
OS << "(truncate " << *Op << " to " << *Ty << ")";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -235,7 +240,7 @@ bool SCEVZeroExtendExpr::dominates(BasicBlock *BB, DominatorTree *DT) const {
|
|||||||
return Op->dominates(BB, DT);
|
return Op->dominates(BB, DT);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SCEVZeroExtendExpr::print(std::ostream &OS) const {
|
void SCEVZeroExtendExpr::print(raw_ostream &OS) const {
|
||||||
OS << "(zeroextend " << *Op << " to " << *Ty << ")";
|
OS << "(zeroextend " << *Op << " to " << *Ty << ")";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -262,7 +267,7 @@ bool SCEVSignExtendExpr::dominates(BasicBlock *BB, DominatorTree *DT) const {
|
|||||||
return Op->dominates(BB, DT);
|
return Op->dominates(BB, DT);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SCEVSignExtendExpr::print(std::ostream &OS) const {
|
void SCEVSignExtendExpr::print(raw_ostream &OS) const {
|
||||||
OS << "(signextend " << *Op << " to " << *Ty << ")";
|
OS << "(signextend " << *Op << " to " << *Ty << ")";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -278,7 +283,7 @@ SCEVCommutativeExpr::~SCEVCommutativeExpr() {
|
|||||||
Operands.end())));
|
Operands.end())));
|
||||||
}
|
}
|
||||||
|
|
||||||
void SCEVCommutativeExpr::print(std::ostream &OS) const {
|
void SCEVCommutativeExpr::print(raw_ostream &OS) const {
|
||||||
assert(Operands.size() > 1 && "This plus expr shouldn't exist!");
|
assert(Operands.size() > 1 && "This plus expr shouldn't exist!");
|
||||||
const char *OpStr = getOperationStr();
|
const char *OpStr = getOperationStr();
|
||||||
OS << "(" << *Operands[0];
|
OS << "(" << *Operands[0];
|
||||||
@ -342,7 +347,7 @@ bool SCEVUDivExpr::dominates(BasicBlock *BB, DominatorTree *DT) const {
|
|||||||
return LHS->dominates(BB, DT) && RHS->dominates(BB, DT);
|
return LHS->dominates(BB, DT) && RHS->dominates(BB, DT);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SCEVUDivExpr::print(std::ostream &OS) const {
|
void SCEVUDivExpr::print(raw_ostream &OS) const {
|
||||||
OS << "(" << *LHS << " /u " << *RHS << ")";
|
OS << "(" << *LHS << " /u " << *RHS << ")";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -403,7 +408,7 @@ bool SCEVAddRecExpr::isLoopInvariant(const Loop *QueryLoop) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SCEVAddRecExpr::print(std::ostream &OS) const {
|
void SCEVAddRecExpr::print(raw_ostream &OS) const {
|
||||||
OS << "{" << *Operands[0];
|
OS << "{" << *Operands[0];
|
||||||
for (unsigned i = 1, e = Operands.size(); i != e; ++i)
|
for (unsigned i = 1, e = Operands.size(); i != e; ++i)
|
||||||
OS << ",+," << *Operands[i];
|
OS << ",+," << *Operands[i];
|
||||||
@ -435,7 +440,7 @@ const Type *SCEVUnknown::getType() const {
|
|||||||
return V->getType();
|
return V->getType();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SCEVUnknown::print(std::ostream &OS) const {
|
void SCEVUnknown::print(raw_ostream &OS) const {
|
||||||
if (isa<PointerType>(V->getType()))
|
if (isa<PointerType>(V->getType()))
|
||||||
OS << "(ptrtoint " << *V->getType() << " ";
|
OS << "(ptrtoint " << *V->getType() << " ";
|
||||||
WriteAsOperand(OS, V, false);
|
WriteAsOperand(OS, V, false);
|
||||||
@ -2245,10 +2250,10 @@ SCEVHandle ScalarEvolutionsImpl::ComputeBackedgeTakenCount(const Loop *L) {
|
|||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
#if 0
|
#if 0
|
||||||
cerr << "ComputeBackedgeTakenCount ";
|
errs() << "ComputeBackedgeTakenCount ";
|
||||||
if (ExitCond->getOperand(0)->getType()->isUnsigned())
|
if (ExitCond->getOperand(0)->getType()->isUnsigned())
|
||||||
cerr << "[unsigned] ";
|
errs() << "[unsigned] ";
|
||||||
cerr << *LHS << " "
|
errs() << *LHS << " "
|
||||||
<< Instruction::getOpcodeName(Instruction::ICmp)
|
<< Instruction::getOpcodeName(Instruction::ICmp)
|
||||||
<< " " << *RHS << "\n";
|
<< " " << *RHS << "\n";
|
||||||
#endif
|
#endif
|
||||||
@ -2369,9 +2374,9 @@ ComputeLoadConstantCompareBackedgeTakenCount(LoadInst *LI, Constant *RHS,
|
|||||||
if (!isa<ConstantInt>(Result)) break; // Couldn't decide for sure
|
if (!isa<ConstantInt>(Result)) break; // Couldn't decide for sure
|
||||||
if (cast<ConstantInt>(Result)->getValue().isMinValue()) {
|
if (cast<ConstantInt>(Result)->getValue().isMinValue()) {
|
||||||
#if 0
|
#if 0
|
||||||
cerr << "\n***\n*** Computed loop count " << *ItCst
|
errs() << "\n***\n*** Computed loop count " << *ItCst
|
||||||
<< "\n*** From global " << *GV << "*** BB: " << *L->getHeader()
|
<< "\n*** From global " << *GV << "*** BB: " << *L->getHeader()
|
||||||
<< "***\n";
|
<< "***\n";
|
||||||
#endif
|
#endif
|
||||||
++NumArrayLenItCounts;
|
++NumArrayLenItCounts;
|
||||||
return SE.getConstant(ItCst); // Found terminating iteration!
|
return SE.getConstant(ItCst); // Found terminating iteration!
|
||||||
@ -2873,8 +2878,8 @@ SCEVHandle ScalarEvolutionsImpl::HowFarToZero(SCEV *V, const Loop *L) {
|
|||||||
SCEVConstant *R2 = dyn_cast<SCEVConstant>(Roots.second);
|
SCEVConstant *R2 = dyn_cast<SCEVConstant>(Roots.second);
|
||||||
if (R1) {
|
if (R1) {
|
||||||
#if 0
|
#if 0
|
||||||
cerr << "HFTZ: " << *V << " - sol#1: " << *R1
|
errs() << "HFTZ: " << *V << " - sol#1: " << *R1
|
||||||
<< " sol#2: " << *R2 << "\n";
|
<< " sol#2: " << *R2 << "\n";
|
||||||
#endif
|
#endif
|
||||||
// Pick the smallest positive root value.
|
// Pick the smallest positive root value.
|
||||||
if (ConstantInt *CB =
|
if (ConstantInt *CB =
|
||||||
@ -3326,7 +3331,7 @@ void ScalarEvolution::deleteValueFromRecords(Value *V) const {
|
|||||||
return ((ScalarEvolutionsImpl*)Impl)->deleteValueFromRecords(V);
|
return ((ScalarEvolutionsImpl*)Impl)->deleteValueFromRecords(V);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void PrintLoopInfo(std::ostream &OS, const ScalarEvolution *SE,
|
static void PrintLoopInfo(raw_ostream &OS, const ScalarEvolution *SE,
|
||||||
const Loop *L) {
|
const Loop *L) {
|
||||||
// Print all inner loops first
|
// Print all inner loops first
|
||||||
for (Loop::iterator I = L->begin(), E = L->end(); I != E; ++I)
|
for (Loop::iterator I = L->begin(), E = L->end(); I != E; ++I)
|
||||||
@ -3348,7 +3353,7 @@ static void PrintLoopInfo(std::ostream &OS, const ScalarEvolution *SE,
|
|||||||
OS << "\n";
|
OS << "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScalarEvolution::print(std::ostream &OS, const Module* ) const {
|
void ScalarEvolution::print(raw_ostream &OS, const Module* ) const {
|
||||||
Function &F = ((ScalarEvolutionsImpl*)Impl)->F;
|
Function &F = ((ScalarEvolutionsImpl*)Impl)->F;
|
||||||
LoopInfo &LI = ((ScalarEvolutionsImpl*)Impl)->LI;
|
LoopInfo &LI = ((ScalarEvolutionsImpl*)Impl)->LI;
|
||||||
|
|
||||||
@ -3379,3 +3384,8 @@ void ScalarEvolution::print(std::ostream &OS, const Module* ) const {
|
|||||||
for (LoopInfo::iterator I = LI.begin(), E = LI.end(); I != E; ++I)
|
for (LoopInfo::iterator I = LI.begin(), E = LI.end(); I != E; ++I)
|
||||||
PrintLoopInfo(OS, this, *I);
|
PrintLoopInfo(OS, this, *I);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ScalarEvolution::print(std::ostream &o, const Module *M) const {
|
||||||
|
raw_os_ostream OS(o);
|
||||||
|
print(OS, M);
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user