mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 11:13:28 +01:00
BranchProb: Simplify printing code
llvm-svn: 207559
This commit is contained in:
parent
25e96ccaa5
commit
4098e101ab
@ -46,7 +46,7 @@ public:
|
||||
return BranchProbability(D - N, D);
|
||||
}
|
||||
|
||||
void print(raw_ostream &OS) const;
|
||||
raw_ostream &print(raw_ostream &OS) const;
|
||||
|
||||
void dump() const;
|
||||
|
||||
@ -80,7 +80,9 @@ public:
|
||||
bool operator>=(BranchProbability RHS) const { return !(*this < RHS); }
|
||||
};
|
||||
|
||||
raw_ostream &operator<<(raw_ostream &OS, const BranchProbability &Prob);
|
||||
inline raw_ostream &operator<<(raw_ostream &OS, const BranchProbability &Prob) {
|
||||
return Prob.print(OS);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -18,13 +18,12 @@
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
void BranchProbability::print(raw_ostream &OS) const {
|
||||
OS << N << " / " << D << " = " << format("%g%%", ((double)N / D) * 100.0);
|
||||
raw_ostream &BranchProbability::print(raw_ostream &OS) const {
|
||||
return OS << N << " / " << D << " = "
|
||||
<< format("%g%%", ((double)N / D) * 100.0);
|
||||
}
|
||||
|
||||
void BranchProbability::dump() const {
|
||||
dbgs() << *this << '\n';
|
||||
}
|
||||
void BranchProbability::dump() const { print(dbgs()) << '\n'; }
|
||||
|
||||
static uint64_t scale(uint64_t Num, uint32_t N, uint32_t D) {
|
||||
assert(D && "divide by 0");
|
||||
@ -72,8 +71,3 @@ uint64_t BranchProbability::scale(uint64_t Num) const {
|
||||
uint64_t BranchProbability::scaleByInverse(uint64_t Num) const {
|
||||
return ::scale(Num, D, N);
|
||||
}
|
||||
|
||||
raw_ostream &llvm::operator<<(raw_ostream &OS, const BranchProbability &Prob) {
|
||||
Prob.print(OS);
|
||||
return OS;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user