This is an archive of the discontinued LLVM Phabricator instance.

Remove PrologEpilogInserter's usage of DBG_VALUE's offset field
ClosedPublic

Authored by aprantl on Jul 31 2017, 5:26 PM.

Details

Summary

In the last half-dozen commits to LLVM I removed code that became dead after removing the offset parameter from llvm.dbg.value gradually proceeding from IR towards the backend. Before I can move on to DwarfDebug and friends there is one last side-called offset I need to remove:

This patch modifies PrologEpilogInserter's use of the DBG_VALUE's offset argument to use a DIExpression instead. Because the PrologEpilogInserter runs at the Machine level I had to play a little trick with a named llvm.dbg.mir node to get the DIExpressions to print in MIR dumps (which print the llvm::Module followed by the MachineFunction dump).

I also had to add rudimentary DwarfExpression support to CodeView and as a side-effect also fixed a bug (CodeViewDebug::collectVariableInfo was supposed to give up on variables with complex DIExpressions, but would fail to do so for fragments, which are also modeled as DIExpressions).

With this last holdover removed we will have only one canonical way of representing offsets to debug locations which will simplify the code in DwarfDebug (and future versions of CodeViewDebug once it starts handling more complex expressions) and make it easier to reason about.

This patch is NFC-ish: All test case changes are for assembler comments and the binary output does not change.

Diff Detail

Repository
rL LLVM

Event Timeline

aprantl created this revision.Jul 31 2017, 5:26 PM
rnk accepted this revision.Aug 1 2017, 1:47 PM

lgtm

lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
992–997 ↗(On Diff #109034)

It'd be nice if DIExpressionCursor had a helper for peeling everything that extractIfOffset reads.

This revision is now accepted and ready to land.Aug 1 2017, 1:47 PM
This revision was automatically updated to reflect the committed changes.