mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-12 13:30:51 +00:00
BranchProb: Simplify printing code
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207559 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
a70510a1c6
commit
67f5fcac4b
@ -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