diff options
Diffstat (limited to 'llvm/lib/CodeGen/MachineBlockFrequencyInfo.cpp')
-rw-r--r-- | llvm/lib/CodeGen/MachineBlockFrequencyInfo.cpp | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/llvm/lib/CodeGen/MachineBlockFrequencyInfo.cpp b/llvm/lib/CodeGen/MachineBlockFrequencyInfo.cpp index 76b7285..7ee72e2 100644 --- a/llvm/lib/CodeGen/MachineBlockFrequencyInfo.cpp +++ b/llvm/lib/CodeGen/MachineBlockFrequencyInfo.cpp @@ -75,7 +75,7 @@ static cl::opt<bool> PrintMachineBlockFreq( // Command line option to specify the name of the function for block frequency // dump. Defined in Analysis/BlockFrequencyInfo.cpp. -extern cl::opt<std::string> PrintBlockFreqFuncName; +extern cl::opt<std::string> PrintBFIFuncName; } // namespace llvm static GVDAGType getGVDT() { @@ -203,8 +203,7 @@ void MachineBlockFrequencyInfo::calculate( view("MachineBlockFrequencyDAGS." + F.getName()); } if (PrintMachineBlockFreq && - (PrintBlockFreqFuncName.empty() || - F.getName().equals(PrintBlockFreqFuncName))) { + (PrintBFIFuncName.empty() || F.getName().equals(PrintBFIFuncName))) { MBFI->print(dbgs()); } } @@ -274,18 +273,18 @@ const MachineBranchProbabilityInfo *MachineBlockFrequencyInfo::getMBPI() const { return MBFI ? &MBFI->getBPI() : nullptr; } -raw_ostream & -MachineBlockFrequencyInfo::printBlockFreq(raw_ostream &OS, - const BlockFrequency Freq) const { - return MBFI ? MBFI->printBlockFreq(OS, Freq) : OS; +BlockFrequency MachineBlockFrequencyInfo::getEntryFreq() const { + return MBFI ? MBFI->getEntryFreq() : BlockFrequency(0); } -raw_ostream & -MachineBlockFrequencyInfo::printBlockFreq(raw_ostream &OS, - const MachineBasicBlock *MBB) const { - return MBFI ? MBFI->printBlockFreq(OS, MBB) : OS; +Printable llvm::printBlockFreq(const MachineBlockFrequencyInfo &MBFI, + BlockFrequency Freq) { + return Printable([&MBFI, Freq](raw_ostream &OS) { + printBlockFreqImpl(OS, MBFI.getEntryFreq(), Freq); + }); } -BlockFrequency MachineBlockFrequencyInfo::getEntryFreq() const { - return MBFI ? MBFI->getEntryFreq() : BlockFrequency(0); +Printable llvm::printBlockFreq(const MachineBlockFrequencyInfo &MBFI, + const MachineBasicBlock &MBB) { + return printBlockFreq(MBFI, MBFI.getBlockFreq(&MBB)); } |