[block-freq] Add the equivalent methods to MachineBlockFrequencyInfo and BlockFrequen...
authorMichael Gottesman <mgottesman@apple.com>
Sat, 14 Dec 2013 00:06:03 +0000 (00:06 +0000)
committerMichael Gottesman <mgottesman@apple.com>
Sat, 14 Dec 2013 00:06:03 +0000 (00:06 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@197287 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Analysis/BlockFrequencyInfo.h
include/llvm/CodeGen/MachineBlockFrequencyInfo.h
lib/Analysis/BlockFrequencyInfo.cpp
lib/CodeGen/MachineBlockFrequencyInfo.cpp

index a123d0b8c1360f4e784af45d2f24a886b2bb45ee..bd44ae34e5b9c663d45421798b3511459c9c2637 100644 (file)
@@ -50,6 +50,15 @@ public:
   /// comparison to the other block frequencies. We do this to avoid using of
   /// floating points.
   BlockFrequency getBlockFreq(const BasicBlock *BB) const;
   /// comparison to the other block frequencies. We do this to avoid using of
   /// floating points.
   BlockFrequency getBlockFreq(const BasicBlock *BB) const;
+
+  // Print the block frequency Freq to OS using the current functions entry
+  // frequency to convert freq into a relative decimal form.
+  raw_ostream &printBlockFreq(raw_ostream &OS, const BlockFrequency Freq) const;
+
+  // Convenience method that attempts to look up the frequency associated with
+  // BB and print it to OS.
+  raw_ostream &printBlockFreq(raw_ostream &OS, const BasicBlock *BB) const;
+
 };
 
 }
 };
 
 }
index 2bd51e8a75dafafd7681b7c7301ca5f3857cc273..761b59cb1d2c4225486c64e967d2c3dd2fa31e13 100644 (file)
@@ -52,6 +52,18 @@ public:
 
   MachineFunction *getFunction() const;
   void view() const;
 
   MachineFunction *getFunction() const;
   void view() const;
+
+  // Print the block frequency Freq to OS using the current functions entry
+  // frequency to convert freq into a relative decimal form.
+  raw_ostream &printBlockFreq(raw_ostream &OS, const BlockFrequency Freq) const;
+
+  // Convenience method that attempts to look up the frequency associated with
+  // BB and print it to OS.
+  raw_ostream &printBlockFreq(raw_ostream &OS,
+                              const MachineBasicBlock *MBB) const;
+
+  uint64_t getEntryFrequency() const;
+
 };
 
 }
 };
 
 }
index 62f3ab16ca7ca12f7c88058cf043b6688c363985..3c6f67811e6f1f58e75d57415bde3cc48e2c2745 100644 (file)
@@ -159,3 +159,14 @@ void BlockFrequencyInfo::view() const {
 const Function *BlockFrequencyInfo::getFunction() const {
   return BFI->Fn;
 }
 const Function *BlockFrequencyInfo::getFunction() const {
   return BFI->Fn;
 }
+
+raw_ostream &BlockFrequencyInfo::
+printBlockFreq(raw_ostream &OS, const BlockFrequency Freq) const {
+  return BFI->printBlockFreq(OS, Freq);
+}
+
+raw_ostream &
+BlockFrequencyInfo::printBlockFreq(raw_ostream &OS,
+                                   const BasicBlock *BB) const {
+  return BFI->printBlockFreq(OS, BB);
+}
index 64e8ecdec9ea159a46e85e2a2a0dbe5a1ddb2baa..86d30949a32d1b3efdf9e5ac2b8219e66023aedf 100644 (file)
@@ -168,3 +168,19 @@ getBlockFreq(const MachineBasicBlock *MBB) const {
 MachineFunction *MachineBlockFrequencyInfo::getFunction() const {
   return MBFI->Fn;
 }
 MachineFunction *MachineBlockFrequencyInfo::getFunction() const {
   return MBFI->Fn;
 }
+
+raw_ostream &
+MachineBlockFrequencyInfo::printBlockFreq(raw_ostream &OS,
+                                          const BlockFrequency Freq) const {
+  return MBFI->printBlockFreq(OS, Freq);
+}
+
+raw_ostream &
+MachineBlockFrequencyInfo::printBlockFreq(raw_ostream &OS,
+                                          const MachineBasicBlock *MBB) const {
+  return MBFI->printBlockFreq(OS, MBB);
+}
+
+uint64_t MachineBlockFrequencyInfo::getEntryFrequency() const {
+  return MBFI->getEntryFrequency();
+}