aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/MachineFunction.cpp
diff options
context:
space:
mode:
authorJeremy Morse <jeremy.morse@sony.com>2021-10-25 15:09:42 +0100
committerJeremy Morse <jeremy.morse@sony.com>2021-10-25 15:14:53 +0100
commitee3eee71e41547050040a8d1ef44b38f6d22f0d2 (patch)
tree93252120d30accd514409d8513def4d16ccd5dca /llvm/lib/CodeGen/MachineFunction.cpp
parent2d9ee590b6676053751ea5dc509662980b431954 (diff)
downloadllvm-ee3eee71e41547050040a8d1ef44b38f6d22f0d2.zip
llvm-ee3eee71e41547050040a8d1ef44b38f6d22f0d2.tar.gz
llvm-ee3eee71e41547050040a8d1ef44b38f6d22f0d2.tar.bz2
[DebugInfo][InstrRef] Track values fused into stack spills
During register allocation, some instructions can have stack spills fused into them. It means that when vregs are allocated on the stack we can convert: SETCCr %0 DBG_VALUE %0 to SETCCm %stack.0 DBG_VALUE %stack.0 Unfortunately instruction referencing finds this harder: a store to the stack doesn't have a specific operand number, therefore we don't substitute the old operand for a new operand, and the location is dropped. This patch implements a solution: just recognise the memory operand attached to an instruction with a Special Number (TM), and record a substitution between the old value and the new one. This patch adds substitution code to InlineSpiller to record such fused spills, and tracking in InstrRefBasedLDV to recognise such values, and produce the value numbers for them. Everything to do with the movement of stack-defined values is already handled in InstrRefBasedLDV. Differential Revision: https://reviews.llvm.org/D111317
Diffstat (limited to 'llvm/lib/CodeGen/MachineFunction.cpp')
-rw-r--r--llvm/lib/CodeGen/MachineFunction.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/MachineFunction.cpp b/llvm/lib/CodeGen/MachineFunction.cpp
index 4a838b8..d8f786e 100644
--- a/llvm/lib/CodeGen/MachineFunction.cpp
+++ b/llvm/lib/CodeGen/MachineFunction.cpp
@@ -974,6 +974,9 @@ void MachineFunction::makeDebugValueSubstitution(DebugInstrOperandPair A,
unsigned Subreg) {
// Catch any accidental self-loops.
assert(A.first != B.first);
+ // Don't allow any substitutions _from_ the memory operand number.
+ assert(A.second != DebugOperandMemNumber);
+
DebugValueSubstitutions.push_back({A, B, Subreg});
}
@@ -1239,6 +1242,9 @@ bool MachineFunction::useDebugInstrRef() const {
return false;
}
+// Use one million as a high / reserved number.
+const unsigned MachineFunction::DebugOperandMemNumber = 1000000;
+
/// \}
//===----------------------------------------------------------------------===//