BranchProbability.h (223017) | BranchProbability.h (224145) |
---|---|
1//===- BranchProbability.h - Branch Probability Analysis --------*- C++ -*-===// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is distributed under the University of Illinois Open Source 6// License. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// --- 5 unchanged lines hidden (view full) --- 14#ifndef LLVM_SUPPORT_BRANCHPROBABILITY_H 15#define LLVM_SUPPORT_BRANCHPROBABILITY_H 16 17#include "llvm/Support/DataTypes.h" 18 19namespace llvm { 20 21class raw_ostream; | 1//===- BranchProbability.h - Branch Probability Analysis --------*- C++ -*-===// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is distributed under the University of Illinois Open Source 6// License. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// --- 5 unchanged lines hidden (view full) --- 14#ifndef LLVM_SUPPORT_BRANCHPROBABILITY_H 15#define LLVM_SUPPORT_BRANCHPROBABILITY_H 16 17#include "llvm/Support/DataTypes.h" 18 19namespace llvm { 20 21class raw_ostream; |
22class BranchProbabilityInfo; 23class MachineBranchProbabilityInfo; 24class MachineBasicBlock; | |
25 26// This class represents Branch Probability as a non-negative fraction. 27class BranchProbability { | 22 23// This class represents Branch Probability as a non-negative fraction. 24class BranchProbability { |
28 friend class BranchProbabilityInfo; 29 friend class MachineBranchProbabilityInfo; 30 friend class MachineBasicBlock; | |
31 32 // Numerator 33 uint32_t N; 34 35 // Denominator 36 uint32_t D; 37 | 25 26 // Numerator 27 uint32_t N; 28 29 // Denominator 30 uint32_t D; 31 |
32public: |
|
38 BranchProbability(uint32_t n, uint32_t d); 39 | 33 BranchProbability(uint32_t n, uint32_t d); 34 |
40public: | 35 uint32_t getNumerator() const { return N; } 36 uint32_t getDenominator() const { return D; } 37 38 // Return (1 - Probability). 39 BranchProbability getCompl() { 40 return BranchProbability(D - N, D); 41 } 42 |
41 raw_ostream &print(raw_ostream &OS) const; 42 43 void dump() const; 44}; 45 46raw_ostream &operator<<(raw_ostream &OS, const BranchProbability &Prob); 47 48} 49 50#endif | 43 raw_ostream &print(raw_ostream &OS) const; 44 45 void dump() const; 46}; 47 48raw_ostream &operator<<(raw_ostream &OS, const BranchProbability &Prob); 49 50} 51 52#endif |