diff options
Diffstat (limited to 'contrib/llvm-project/llvm/lib/CodeGen/MachineBlockFrequencyInfo.cpp')
| -rw-r--r-- | contrib/llvm-project/llvm/lib/CodeGen/MachineBlockFrequencyInfo.cpp | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/contrib/llvm-project/llvm/lib/CodeGen/MachineBlockFrequencyInfo.cpp b/contrib/llvm-project/llvm/lib/CodeGen/MachineBlockFrequencyInfo.cpp index b1cbe525d7e6..7ee72e214426 100644 --- a/contrib/llvm-project/llvm/lib/CodeGen/MachineBlockFrequencyInfo.cpp +++ b/contrib/llvm-project/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()); } } @@ -228,7 +227,7 @@ void MachineBlockFrequencyInfo::view(const Twine &Name, bool isSimple) const { BlockFrequency MachineBlockFrequencyInfo::getBlockFreq(const MachineBasicBlock *MBB) const { - return MBFI ? MBFI->getBlockFreq(MBB) : 0; + return MBFI ? MBFI->getBlockFreq(MBB) : BlockFrequency(0); } std::optional<uint64_t> MachineBlockFrequencyInfo::getBlockProfileCount( @@ -241,7 +240,7 @@ std::optional<uint64_t> MachineBlockFrequencyInfo::getBlockProfileCount( } std::optional<uint64_t> -MachineBlockFrequencyInfo::getProfileCountFromFreq(uint64_t Freq) const { +MachineBlockFrequencyInfo::getProfileCountFromFreq(BlockFrequency Freq) const { if (!MBFI) return std::nullopt; @@ -263,7 +262,7 @@ void MachineBlockFrequencyInfo::onEdgeSplit( auto NewSuccFreq = MBFI->getBlockFreq(&NewPredecessor) * MBPI.getEdgeProbability(&NewPredecessor, &NewSuccessor); - MBFI->setBlockFreq(&NewSuccessor, NewSuccFreq.getFrequency()); + MBFI->setBlockFreq(&NewSuccessor, NewSuccFreq); } const MachineFunction *MachineBlockFrequencyInfo::getFunction() const { @@ -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); + }); } -uint64_t MachineBlockFrequencyInfo::getEntryFreq() const { - return MBFI ? MBFI->getEntryFreq() : 0; +Printable llvm::printBlockFreq(const MachineBlockFrequencyInfo &MBFI, + const MachineBasicBlock &MBB) { + return printBlockFreq(MBFI, MBFI.getBlockFreq(&MBB)); } |
