This is an archive of the discontinued LLVM Phabricator instance.

[MIR] Add support for debug metadata for fixed stack objects
ClosedPublic

Authored by thegameg on Apr 24 2018, 3:54 PM.

Details

Summary

Debug var, expr and loc were only supported for non-fixed stack objects.

This patch adds the following fields to the "fixedStack:" entries, and renames the ones from "stack:" to:

  • debug-info-variable
  • debug-info-expression
  • debug-info-location

Diff Detail

Repository
rL LLVM

Event Timeline

thegameg created this revision.Apr 24 2018, 3:54 PM
aprantl added inline comments.Apr 24 2018, 5:59 PM
include/llvm/CodeGen/MIRYamlMapping.h
329 ↗(On Diff #143826)

I find that spelling weird: I would either go for the full debug-info-variable, or debug-variable, or dbg-variable, if it has to be lower-case.

plotfi added inline comments.Apr 24 2018, 6:13 PM
include/llvm/CodeGen/MachineFunction.h
352 ↗(On Diff #143826)

Why the change in type here?

lib/CodeGen/MIRPrinter.cpp
277 ↗(On Diff #143826)

Could this be cleaned up? Something like:

SmallVector<T, 3> DebugValues = { Object.DebugVar.Value, Object.DebugExpr.Value, Object.DebugLoc.Value };
SmallVector<T, 3> DebugVars = { DebugVar.Var, DebugVar.Expr, DebugVar.Loc };

for (unsigned i = 0; i < DebugValues.size(); ++i) {
    raw_string_ostream StrOS(DebugValues[i]);
    DebugVars[i]->printAsOperand(StrOS, MST);
}
thegameg updated this revision to Diff 143888.Apr 25 2018, 3:15 AM
thegameg marked 2 inline comments as done.
thegameg edited the summary of this revision. (Show Details)
  • Rename di-* to debug-info-* for fixedStack: and stack:
  • Add comments to test to explain what they're testing
thegameg added inline comments.Apr 25 2018, 3:16 AM
include/llvm/CodeGen/MachineFunction.h
352 ↗(On Diff #143826)

Fixed stack objects have negative FrameIndex values.

lib/CodeGen/MIRPrinter.cpp
277 ↗(On Diff #143826)

I'm afraid this is not going to work since DebugVar.Var, .Expr and .Loc have different types.

thegameg updated this revision to Diff 143892.Apr 25 2018, 3:29 AM

Fix a few tests.

JDevlieghere added inline comments.Apr 25 2018, 4:09 AM
include/llvm/CodeGen/MachineFunction.h
352 ↗(On Diff #143826)

Might be worth adding a comment saying exactly that?

test/CodeGen/AArch64/GlobalISel/arm64-irtranslator.ll
36 ↗(On Diff #143892)

In the MappingTraits you say that it shouldn't print if it's empty, which makes sense, but then it's still being printed here?

thegameg updated this revision to Diff 143901.Apr 25 2018, 4:21 AM
thegameg marked 2 inline comments as done.

Add comment for int Slot;.

test/CodeGen/AArch64/GlobalISel/arm64-irtranslator.ll
36 ↗(On Diff #143892)

yaml::Output has a WriteDefaultValues flag which ignores default values when printing them. Passing -simplify-mir to llc will skip printing default values.

JDevlieghere accepted this revision.Apr 25 2018, 8:27 AM

Add comment for int Slot;.

Alright, fair enough. Thanks Francis, this LGTM.

This revision is now accepted and ready to land.Apr 25 2018, 8:27 AM
This revision was automatically updated to reflect the committed changes.