summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/MachineOutliner.cpp
diff options
context:
space:
mode:
authorEli Friedman <efriedma@codeaurora.org>2018-05-22 19:11:06 +0000
committerEli Friedman <efriedma@codeaurora.org>2018-05-22 19:11:06 +0000
commit042dc9e09288161e44746b52571f0b914d56537e (patch)
treebde563f50cdde29af1529ec3cc9c1b42e3b5f0f6 /llvm/lib/CodeGen/MachineOutliner.cpp
parent34c8c0d858824bb083231819558fbcd1de3c0363 (diff)
downloadbcm5719-llvm-042dc9e09288161e44746b52571f0b914d56537e.tar.gz
bcm5719-llvm-042dc9e09288161e44746b52571f0b914d56537e.zip
[MachineOutliner] Add "thunk" outlining for AArch64.
When we're outlining a sequence that ends in a call, we can save up to three instructions in the outlined function by turning the call into a tail-call. I refer to this as thunk outlining because the resulting outlined function looks like a thunk; suggestions welcome for a better name. In addition to making the outlined function shorter, thunk outlining allows outlining calls which would otherwise be illegal to outline: we don't need to save/restore LR, so we don't need to prove anything about the stack access patterns of the callee. To make this work effectively, I also added MachineOutlinerInstrType::LegalTerminator to the generic MachineOutliner code; this allows treating an arbitrary instruction as a terminator in the suffix tree. Differential Revision: https://reviews.llvm.org/D47173 llvm-svn: 333015
Diffstat (limited to 'llvm/lib/CodeGen/MachineOutliner.cpp')
-rw-r--r--llvm/lib/CodeGen/MachineOutliner.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/MachineOutliner.cpp b/llvm/lib/CodeGen/MachineOutliner.cpp
index be12b207b89..5aecc84481a 100644
--- a/llvm/lib/CodeGen/MachineOutliner.cpp
+++ b/llvm/lib/CodeGen/MachineOutliner.cpp
@@ -777,6 +777,13 @@ struct InstructionMapper {
mapToLegalUnsigned(It);
break;
+ case TargetInstrInfo::MachineOutlinerInstrType::LegalTerminator:
+ mapToLegalUnsigned(It);
+ InstrList.push_back(It);
+ UnsignedVec.push_back(IllegalInstrNumber);
+ IllegalInstrNumber--;
+ break;
+
case TargetInstrInfo::MachineOutlinerInstrType::Invisible:
break;
}
OpenPOWER on IntegriCloud