blockfreq: Implement Pass::releaseMemory()

Implement Pass::releaseMemory() in BlockFrequencyInfo and
MachineBlockFrequencyInfo.  Just delete the private implementation when
not in use.  Switch to a std::unique_ptr to make the logic more clear.

<rdar://problem/14292693>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204741 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Duncan P. N. Exon Smith
2014-03-25 18:01:38 +00:00
parent 8451e1baa9
commit 27e1ca8189
4 changed files with 29 additions and 24 deletions

View File

@@ -28,9 +28,9 @@ class BlockFrequencyImpl;
/// MachineBlockFrequencyInfo pass uses BlockFrequencyImpl implementation to estimate
/// machine basic block frequencies.
class MachineBlockFrequencyInfo : public MachineFunctionPass {
BlockFrequencyImpl<MachineBasicBlock, MachineFunction,
MachineBranchProbabilityInfo> *MBFI;
typedef BlockFrequencyImpl<MachineBasicBlock, MachineFunction,
MachineBranchProbabilityInfo> ImplType;
std::unique_ptr<ImplType> MBFI;
public:
static char ID;
@@ -43,6 +43,8 @@ public:
bool runOnMachineFunction(MachineFunction &F) override;
void releaseMemory() override;
/// getblockFreq - Return block frequency. Return 0 if we don't have the
/// information. Please note that initial frequency is equal to 1024. It means
/// that we should not rely on the value itself, but only on the comparison to