diff options
| author | Jessica Paquette <jpaquette@apple.com> | 2018-06-28 17:45:43 +0000 |
|---|---|---|
| committer | Jessica Paquette <jpaquette@apple.com> | 2018-06-28 17:45:43 +0000 |
| commit | dafa198c96d29b5cb3694494a3cb01da72745772 (patch) | |
| tree | b4e7a6bdd39285946278c987701eef1cc4579fad /llvm/lib/CodeGen | |
| parent | 9c70d48cb2e9aafbfb3193aa366a53fccd3c7b2f (diff) | |
| download | bcm5719-llvm-dafa198c96d29b5cb3694494a3cb01da72745772.tar.gz bcm5719-llvm-dafa198c96d29b5cb3694494a3cb01da72745772.zip | |
[MachineOutliner] Define MachineOutliner support in TargetOptions
Targets should be able to define whether or not they support the outliner
without the outliner being added to the pass pipeline. Before this, the
outliner pass would be added, and ask the target whether or not it supports the
outliner.
After this, it's possible to query the target in TargetPassConfig, before the
outliner pass is created. This ensures that passing -enable-machine-outliner
will not modify the pass pipeline of any target that does not support it.
https://reviews.llvm.org/D48683
llvm-svn: 335887
Diffstat (limited to 'llvm/lib/CodeGen')
| -rw-r--r-- | llvm/lib/CodeGen/MachineOutliner.cpp | 9 | ||||
| -rw-r--r-- | llvm/lib/CodeGen/TargetPassConfig.cpp | 3 |
2 files changed, 2 insertions, 10 deletions
diff --git a/llvm/lib/CodeGen/MachineOutliner.cpp b/llvm/lib/CodeGen/MachineOutliner.cpp index 8f78240e1f7..8e92cd482d8 100644 --- a/llvm/lib/CodeGen/MachineOutliner.cpp +++ b/llvm/lib/CodeGen/MachineOutliner.cpp @@ -1331,15 +1331,6 @@ bool MachineOutliner::runOnModule(Module &M) { const TargetRegisterInfo *TRI = STI.getRegisterInfo(); const TargetInstrInfo *TII = STI.getInstrInfo(); - // Does the target implement the MachineOutliner? If it doesn't, quit here. - if (!TII->useMachineOutliner()) { - // No. So we're done. - LLVM_DEBUG( - dbgs() - << "Skipping pass: Target does not support the MachineOutliner.\n"); - return false; - } - // If the user specifies that they want to outline from linkonceodrs, set // it here. OutlineFromLinkOnceODRs = EnableLinkOnceODROutlining; diff --git a/llvm/lib/CodeGen/TargetPassConfig.cpp b/llvm/lib/CodeGen/TargetPassConfig.cpp index 8c5bdde888e..0ac89917012 100644 --- a/llvm/lib/CodeGen/TargetPassConfig.cpp +++ b/llvm/lib/CodeGen/TargetPassConfig.cpp @@ -906,7 +906,8 @@ void TargetPassConfig::addMachinePasses() { addPass(&XRayInstrumentationID, false); addPass(&PatchableFunctionID, false); - if (EnableMachineOutliner) + if (TM->Options.EnableMachineOutliner && + EnableMachineOutliner) addPass(createMachineOutlinerPass()); // Add passes that directly emit MI after all other MI passes. |

