aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/StackMaps.cpp
diff options
context:
space:
mode:
authorSerguei Katkov <serguei.katkov@azul.com>2022-10-20 12:05:33 +0700
committerSerguei Katkov <serguei.katkov@azul.com>2023-01-09 13:30:57 +0700
commitfd64bd94eda0b93c2fb95e048e7919832f72a1cd (patch)
tree9ab25d12e477509a30bcabb647c4df854bb358de /llvm/lib/CodeGen/StackMaps.cpp
parent323782f6f1a7a41466714365aeeec86efe0e534c (diff)
downloadllvm-fd64bd94eda0b93c2fb95e048e7919832f72a1cd.zip
llvm-fd64bd94eda0b93c2fb95e048e7919832f72a1cd.tar.gz
llvm-fd64bd94eda0b93c2fb95e048e7919832f72a1cd.tar.bz2
[Inline Spiller] Extend the snippet by statepoint uses
Snippet is a tiny live interval which has copy or fill like def and copy or spill like use at the end (any of them might abcent). Snippet has only one use/def inside interval and interval is located in one basic block. When inline spiller spills some reg around uses it also forces the spilling of connected snippets those which got by splitting the same original reg and its def is a full copy of our reg or its last use is a full copy to our reg. The definition of snippet is extended to allow not only one use/def but more. However all other uses are statepoint instructions which will fold fill into its operand. That way we do not introduce new fills/spills. Reviewed By: qcolombet, dantrushin Differential Revision: https://reviews.llvm.org/D138093
Diffstat (limited to 'llvm/lib/CodeGen/StackMaps.cpp')
-rw-r--r--llvm/lib/CodeGen/StackMaps.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/StackMaps.cpp b/llvm/lib/CodeGen/StackMaps.cpp
index f9391d5..e5d8d772 100644
--- a/llvm/lib/CodeGen/StackMaps.cpp
+++ b/llvm/lib/CodeGen/StackMaps.cpp
@@ -146,6 +146,23 @@ unsigned StatepointOpers::getGCPointerMap(
return GCMapSize;
}
+bool StatepointOpers::isFoldableReg(Register Reg) const {
+ unsigned FoldableAreaStart = getVarIdx();
+ for (const MachineOperand &MO : MI->uses()) {
+ if (MI->getOperandNo(&MO) >= FoldableAreaStart)
+ break;
+ if (MO.isReg() && MO.getReg() == Reg)
+ return false;
+ }
+ return true;
+}
+
+bool StatepointOpers::isFoldableReg(const MachineInstr *MI, Register Reg) {
+ if (MI->getOpcode() != TargetOpcode::STATEPOINT)
+ return false;
+ return StatepointOpers(MI).isFoldableReg(Reg);
+}
+
StackMaps::StackMaps(AsmPrinter &AP) : AP(AP) {
if (StackMapVersion != 3)
llvm_unreachable("Unsupported stackmap version!");