summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen
diff options
context:
space:
mode:
authorJessica Paquette <jpaquette@apple.com>2018-04-04 19:13:31 +0000
committerJessica Paquette <jpaquette@apple.com>2018-04-04 19:13:31 +0000
commitbccd18b816c0413f63b14ccb77077cced6f033f7 (patch)
tree5229911afb5c62cfe8e4848899b504bc4e2523a5 /llvm/lib/CodeGen
parentf7c5a10e55103ea8c8c46c7d9f0bbae50e39f96e (diff)
downloadbcm5719-llvm-bccd18b816c0413f63b14ccb77077cced6f033f7.tar.gz
bcm5719-llvm-bccd18b816c0413f63b14ccb77077cced6f033f7.zip
[MachineOutliner] Add `useMachineOutliner` target hook
The MachineOutliner has a bunch of target hooks that will call llvm_unreachable if the target doesn't implement them. Therefore, if you enable the outliner on such a target, it'll just crash. It'd be much better if it'd just *not* run the outliner at all in this case. This commit adds a hook to TargetInstrInfo that returns false by default. Targets that implement the hook make it return true. The outliner checks the return value of this hook to decide whether or not to continue. llvm-svn: 329220
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r--llvm/lib/CodeGen/MachineOutliner.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/MachineOutliner.cpp b/llvm/lib/CodeGen/MachineOutliner.cpp
index 2a6a94dc882..932316f1fd1 100644
--- a/llvm/lib/CodeGen/MachineOutliner.cpp
+++ b/llvm/lib/CodeGen/MachineOutliner.cpp
@@ -1416,7 +1416,15 @@ bool MachineOutliner::runOnModule(Module &M) {
MMI.getOrCreateMachineFunction(*M.begin()).getSubtarget();
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.
+ DEBUG(dbgs()
+ << "Skipping pass: Target does not support the MachineOutliner.\n");
+ return false;
+ }
+
InstructionMapper Mapper;
// Build instruction mappings for each function in the module. Start by
OpenPOWER on IntegriCloud