mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-25 00:24:26 +00:00
Support: Add BranchProbability::scale() and ::scaleByInverse()
Add API to `BranchProbability` for scaling big integers. Next job is to rip the logic out of `BlockMass` and `BlockFrequency`. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207544 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -50,6 +50,30 @@ public:
|
||||
|
||||
void dump() const;
|
||||
|
||||
/// \brief Scale a large integer.
|
||||
///
|
||||
/// Scales \c Num. Guarantees full precision. Returns the floor of the
|
||||
/// result.
|
||||
///
|
||||
/// \return \c Num times \c this.
|
||||
///
|
||||
/// \note This code should be shared with (or replaced by) the implementation
|
||||
/// of \a BlockFrequency::scale(), which seems to be calculating something
|
||||
/// similar.
|
||||
uint64_t scale(uint64_t Num) const;
|
||||
|
||||
/// \brief Scale a large integer by the inverse.
|
||||
///
|
||||
/// Scales \c Num by the inverse of \c this. Guarantees full precision.
|
||||
/// Returns the floor of the result.
|
||||
///
|
||||
/// \return \c Num divided by \c this.
|
||||
///
|
||||
/// \note This code should be shared with (or replaced by) the implementation
|
||||
/// of \a BlockFrequency::scale(), which seems to be calculating something
|
||||
/// similar.
|
||||
uint64_t scaleByInverse(uint64_t Num) const;
|
||||
|
||||
bool operator==(BranchProbability RHS) const {
|
||||
return (uint64_t)N * RHS.D == (uint64_t)D * RHS.N;
|
||||
}
|
||||
|
Reference in New Issue
Block a user