aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/PrologEpilogInserter.cpp
diff options
context:
space:
mode:
authorEvgenii Stepanov <eugenis@google.com>2020-01-08 14:48:37 -0800
committerEvgenii Stepanov <eugenis@google.com>2020-01-17 15:19:29 -0800
commitd081962dead08ef0982081e78d679dd609947ca5 (patch)
treeaa2f3eb4dade4512144306c73aecb7f902cb5c47 /llvm/lib/CodeGen/PrologEpilogInserter.cpp
parent9f6c6ee6b9b6409c6cb2d200553815cec7f74cc3 (diff)
downloadllvm-d081962dead08ef0982081e78d679dd609947ca5.zip
llvm-d081962dead08ef0982081e78d679dd609947ca5.tar.gz
llvm-d081962dead08ef0982081e78d679dd609947ca5.tar.bz2
Merge memtag instructions with adjacent stack slots.
Summary: Detect a run of memory tagging instructions for adjacent stack frame slots, and replace them with a shorter instruction sequence * replace STG + STG with ST2G * replace STGloop + STGloop with STGloop This code needs to run when stack slot offsets are already known, but before FrameIndex operands in STG instructions are eliminated; that's the reason for the new hook in PrologueEpilogue. This change modifies STGloop and STZGloop pseudos to take the size as an immediate integer operand, and adds _untied variants of those pseudos that are allowed to take the base address as a FI operand. This is needed to simplify recognizing an STGloop instruction as operating on a stack slot post-regalloc. This improves memtag code size by ~0.25%, and it looks like an additional ~0.1% is possible by rearranging the stack frame such that consecutive STG instructions reference adjacent slots (patch pending). Reviewers: pcc, ostannard Subscribers: hiraditya, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D70286
Diffstat (limited to 'llvm/lib/CodeGen/PrologEpilogInserter.cpp')
-rw-r--r--llvm/lib/CodeGen/PrologEpilogInserter.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/PrologEpilogInserter.cpp b/llvm/lib/CodeGen/PrologEpilogInserter.cpp
index 3909b57..d583643 100644
--- a/llvm/lib/CodeGen/PrologEpilogInserter.cpp
+++ b/llvm/lib/CodeGen/PrologEpilogInserter.cpp
@@ -259,6 +259,10 @@ bool PEI::runOnMachineFunction(MachineFunction &MF) {
for (auto &I : EntryDbgValues)
I.first->insert(I.first->begin(), I.second.begin(), I.second.end());
+ // Allow the target machine to make final modifications to the function
+ // before the frame layout is finalized.
+ TFI->processFunctionBeforeFrameIndicesReplaced(MF, RS);
+
// Replace all MO_FrameIndex operands with physical register references
// and actual offsets.
//