diff options
| author | Adam Nemet <anemet@apple.com> | 2017-02-14 17:21:09 +0000 |
|---|---|---|
| committer | Adam Nemet <anemet@apple.com> | 2017-02-14 17:21:09 +0000 |
| commit | bbb141c734d7dff41e1c41919362aa6f041e26cf (patch) | |
| tree | fa67fe12770fcee2b5c2be0fbc8a6306825ed0f8 /llvm/lib/CodeGen/MachineOptimizationRemarkEmitter.cpp | |
| parent | 24984e1238f507c7a6770283a855dced341552c8 (diff) | |
| download | bcm5719-llvm-bbb141c734d7dff41e1c41919362aa6f041e26cf.tar.gz bcm5719-llvm-bbb141c734d7dff41e1c41919362aa6f041e26cf.zip | |
Add new pass LazyMachineBlockFrequencyInfo
And use it in MachineOptimizationRemarkEmitter. A test will follow on top of
Justin's changes to enable MachineORE in AsmPrinter.
The approach is similar to the IR-level pass. It's a bit simpler because BPI
is immutable at the Machine level so we don't need to make that lazy.
Because of this, a new function mapping is introduced (BPIPassTrait::getBPI).
This function extracts BPI from the pass. In case of the lazy pass, this is
when the calculation of the BFI occurs. For Machine-level, this is the
identity function.
Differential Revision: https://reviews.llvm.org/D29836
llvm-svn: 295072
Diffstat (limited to 'llvm/lib/CodeGen/MachineOptimizationRemarkEmitter.cpp')
| -rw-r--r-- | llvm/lib/CodeGen/MachineOptimizationRemarkEmitter.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/llvm/lib/CodeGen/MachineOptimizationRemarkEmitter.cpp b/llvm/lib/CodeGen/MachineOptimizationRemarkEmitter.cpp index 0fc286969eb..b76e75a4bd4 100644 --- a/llvm/lib/CodeGen/MachineOptimizationRemarkEmitter.cpp +++ b/llvm/lib/CodeGen/MachineOptimizationRemarkEmitter.cpp @@ -14,7 +14,7 @@ ///===---------------------------------------------------------------------===// #include "llvm/CodeGen/MachineOptimizationRemarkEmitter.h" -#include "llvm/CodeGen/MachineBlockFrequencyInfo.h" +#include "llvm/CodeGen/LazyMachineBlockFrequencyInfo.h" #include "llvm/IR/DebugInfo.h" #include "llvm/IR/DiagnosticInfo.h" #include "llvm/IR/LLVMContext.h" @@ -64,7 +64,7 @@ bool MachineOptimizationRemarkEmitterPass::runOnMachineFunction( MachineBlockFrequencyInfo *MBFI; if (MF.getFunction()->getContext().getDiagnosticHotnessRequested()) - MBFI = &getAnalysis<MachineBlockFrequencyInfo>(); + MBFI = &getAnalysis<LazyMachineBlockFrequencyInfoPass>().getBFI(); else MBFI = nullptr; @@ -74,7 +74,7 @@ bool MachineOptimizationRemarkEmitterPass::runOnMachineFunction( void MachineOptimizationRemarkEmitterPass::getAnalysisUsage( AnalysisUsage &AU) const { - AU.addRequired<MachineBlockFrequencyInfo>(); + LazyMachineBlockFrequencyInfoPass::getLazyMachineBFIAnalysisUsage(AU); AU.setPreservesAll(); MachineFunctionPass::getAnalysisUsage(AU); } @@ -85,6 +85,6 @@ static const char ore_name[] = "Machine Optimization Remark Emitter"; INITIALIZE_PASS_BEGIN(MachineOptimizationRemarkEmitterPass, ORE_NAME, ore_name, false, true) -INITIALIZE_PASS_DEPENDENCY(MachineBlockFrequencyInfo) +INITIALIZE_PASS_DEPENDENCY(LazyMachineBFIPass) INITIALIZE_PASS_END(MachineOptimizationRemarkEmitterPass, ORE_NAME, ore_name, false, true) |

