aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/MachineFunction.cpp
diff options
context:
space:
mode:
authorStephen Tozer <Stephen.Tozer@Sony.com>2023-01-03 10:11:22 +0000
committerStephen Tozer <Stephen.Tozer@Sony.com>2023-01-06 19:31:10 +0000
commitc383f4d6550e30866294a0e1907a4519245c03eb (patch)
treeb3d8a647cd0adec7fc8b1c4092d5d97a72279b35 /llvm/lib/CodeGen/MachineFunction.cpp
parent2f66c891307cbf1e506b04ac2f7add4dbd64c9c5 (diff)
downloadllvm-c383f4d6550e30866294a0e1907a4519245c03eb.zip
llvm-c383f4d6550e30866294a0e1907a4519245c03eb.tar.gz
llvm-c383f4d6550e30866294a0e1907a4519245c03eb.tar.bz2
[DebugInfo] Allow non-stack_value variadic expressions and use in DBG_INSTR_REF
Prior to this patch, variadic DIExpressions (i.e. ones that contain DW_OP_LLVM_arg) could only be created by salvaging debug values to create stack value expressions, resulting in a DBG_VALUE_LIST being created. As of the previous patch in this patch stack, DBG_INSTR_REF's syntax has been changed to match DBG_VALUE_LIST in preparation for supporting variadic expressions. This patch adds some minor changes needed to allow variadic expressions that aren't stack values to exist, and allows variadic expressions that are trivially reduceable to non-variadic expressions to be handled similarly to non-variadic expressions. Reviewed by: jmorse Differential Revision: https://reviews.llvm.org/D133926
Diffstat (limited to 'llvm/lib/CodeGen/MachineFunction.cpp')
-rw-r--r--llvm/lib/CodeGen/MachineFunction.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/MachineFunction.cpp b/llvm/lib/CodeGen/MachineFunction.cpp
index fad5981..9625099 100644
--- a/llvm/lib/CodeGen/MachineFunction.cpp
+++ b/llvm/lib/CodeGen/MachineFunction.cpp
@@ -44,6 +44,7 @@
#include "llvm/IR/BasicBlock.h"
#include "llvm/IR/Constant.h"
#include "llvm/IR/DataLayout.h"
+#include "llvm/IR/DebugInfoMetadata.h"
#include "llvm/IR/DerivedTypes.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/GlobalValue.h"
@@ -1153,6 +1154,10 @@ void MachineFunction::finalizeDebugInstrRefs() {
MakeUndefDbgValue(MI);
continue;
}
+ // Only convert Expr to variadic form when we're sure we're emitting a
+ // complete instruction reference.
+ MI.getDebugExpressionOp().setMetadata(
+ DIExpression::convertToVariadicExpression(MI.getDebugExpression()));
assert(Reg.isVirtual());
MachineInstr &DefMI = *RegInfo->def_instr_begin(Reg);