mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-24 22:32:47 +00:00
7102b617bf
50% is much more readable than 5.000000e-01. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142752 91177308-0d34-0410-b5e6-96231b3b80d8
37 lines
982 B
C++
37 lines
982 B
C++
//===-------------- lib/Support/BranchProbability.cpp -----------*- C++ -*-===//
|
|
//
|
|
// The LLVM Compiler Infrastructure
|
|
//
|
|
// This file is distributed under the University of Illinois Open Source
|
|
// License. See LICENSE.TXT for details.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
//
|
|
// This file implements Branch Probability class.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#include "llvm/Support/BranchProbability.h"
|
|
#include "llvm/Support/Debug.h"
|
|
#include "llvm/Support/Format.h"
|
|
#include "llvm/Support/raw_ostream.h"
|
|
|
|
using namespace llvm;
|
|
|
|
void BranchProbability::print(raw_ostream &OS) const {
|
|
OS << N << " / " << D << " = " << format("%g%%", ((double)N / D) * 100.0);
|
|
}
|
|
|
|
void BranchProbability::dump() const {
|
|
dbgs() << *this << '\n';
|
|
}
|
|
|
|
namespace llvm {
|
|
|
|
raw_ostream &operator<<(raw_ostream &OS, const BranchProbability &Prob) {
|
|
Prob.print(OS);
|
|
return OS;
|
|
}
|
|
|
|
}
|