#include "llvm/CodeGen/MachineBranchProbabilityInfo.h"
#include "llvm/CodeGen/MachineBasicBlock.h"
#include "llvm/InitializePasses.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/raw_ostream.h"
usingnamespacellvm;
INITIALIZE_PASS_BEGIN(MachineBranchProbabilityInfoWrapperPass,
"machine-branch-prob",
"Machine Branch Probability Analysis", false, true)
INITIALIZE_PASS_END(MachineBranchProbabilityInfoWrapperPass,
"machine-branch-prob",
"Machine Branch Probability Analysis", false, true)
namespace llvm {
cl::opt<unsigned>
StaticLikelyProb("static-likely-prob",
cl::desc("branch probability threshold in percentage"
"to be considered very likely"),
cl::init(80), cl::Hidden);
cl::opt<unsigned> ProfileLikelyProb(
"profile-likely-prob",
cl::desc("branch probability threshold in percentage to be considered"
" very likely when profile is available"),
cl::init(51), cl::Hidden);
}
MachineBranchProbabilityAnalysis::Result
MachineBranchProbabilityAnalysis::run(MachineFunction &,
MachineFunctionAnalysisManager &) { … }
PreservedAnalyses
MachineBranchProbabilityPrinterPass::run(MachineFunction &MF,
MachineFunctionAnalysisManager &MFAM) { … }
char MachineBranchProbabilityInfoWrapperPass::ID = …;
MachineBranchProbabilityInfoWrapperPass::
MachineBranchProbabilityInfoWrapperPass()
: … { … }
void MachineBranchProbabilityInfoWrapperPass::anchor() { … }
AnalysisKey MachineBranchProbabilityAnalysis::Key;
bool MachineBranchProbabilityInfo::invalidate(
MachineFunction &, const PreservedAnalyses &PA,
MachineFunctionAnalysisManager::Invalidator &) { … }
BranchProbability MachineBranchProbabilityInfo::getEdgeProbability(
const MachineBasicBlock *Src,
MachineBasicBlock::const_succ_iterator Dst) const { … }
BranchProbability MachineBranchProbabilityInfo::getEdgeProbability(
const MachineBasicBlock *Src, const MachineBasicBlock *Dst) const { … }
bool MachineBranchProbabilityInfo::isEdgeHot(
const MachineBasicBlock *Src, const MachineBasicBlock *Dst) const { … }
raw_ostream &MachineBranchProbabilityInfo::printEdgeProbability(
raw_ostream &OS, const MachineBasicBlock *Src,
const MachineBasicBlock *Dst) const { … }