summaryrefslogtreecommitdiff
path: root/src/passes
diff options
context:
space:
mode:
authorJérôme Vouillon <jerome.vouillon@gmail.com>2024-05-02 14:09:15 -0400
committerGitHub <noreply@github.com>2024-05-02 11:09:15 -0700
commitd58c54643eb97e5c35f8c14a38f3bf549aee92f4 (patch)
treea5a2888446708bc6a4da1ef53f13b15bbe2a291d /src/passes
parent58753f40d9ee51bbe5c3acb7656e0d4ab73d0f36 (diff)
downloadbinaryen-d58c54643eb97e5c35f8c14a38f3bf549aee92f4.tar.gz
binaryen-d58c54643eb97e5c35f8c14a38f3bf549aee92f4.tar.bz2
binaryen-d58c54643eb97e5c35f8c14a38f3bf549aee92f4.zip
Source map fixes (#6550)
* Keep debug locations at function start The `fn_prolog_epilog.debugInfo` test is failing otherwise, since there was debug information associated to the nop instruction at the beginning of the function. * Do not clear the debug information when reaching the end of the source map The last segment should extend to the end of the function. * Propagate debug location from the function prolog to its first instruction * Fix printing of epilogue location The text parser no longer propagates locations to the epilogue, so we should always print the location if there is one. * Fix debug location smearing The debug location of the last instruction should not smear into the function epilogue, and a debug location from a previous function should not smear into the prologue of the current function.
Diffstat (limited to 'src/passes')
-rw-r--r--src/passes/DebugLocationPropagation.cpp4
-rw-r--r--src/passes/Print.cpp3
2 files changed, 5 insertions, 2 deletions
diff --git a/src/passes/DebugLocationPropagation.cpp b/src/passes/DebugLocationPropagation.cpp
index 07ae53faa..e2d1ac50f 100644
--- a/src/passes/DebugLocationPropagation.cpp
+++ b/src/passes/DebugLocationPropagation.cpp
@@ -64,6 +64,10 @@ struct DebugLocationPropagation
if (auto it = locs.find(previous); it != locs.end()) {
locs[curr] = it->second;
}
+ } else if (self->getFunction()->prologLocation.size()) {
+ // Instructions may inherit their locations from the function
+ // prolog.
+ locs[curr] = *self->getFunction()->prologLocation.begin();
}
}
expressionStack.push_back(curr);
diff --git a/src/passes/Print.cpp b/src/passes/Print.cpp
index b30a1180d..1ecf382d9 100644
--- a/src/passes/Print.cpp
+++ b/src/passes/Print.cpp
@@ -3025,8 +3025,7 @@ void PrintSExpression::visitDefinedFunction(Function* curr) {
// Print the stack IR.
printStackIR(curr->stackIR.get(), *this);
}
- if (currFunction->epilogLocation.size() &&
- lastPrintedLocation != *currFunction->epilogLocation.begin()) {
+ if (currFunction->epilogLocation.size()) {
// Print last debug location: mix of decIndent and printDebugLocation
// logic.
doIndent(o, indent);