[PATCH] D95998: [Debug-Info] [NFC] use emitDwarfUnitLength to handle debug line section unit length field

Igor Kudrin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 10 01:39:23 PST 2021


ikudrin added a comment.

In D95998#2553440 <https://reviews.llvm.org/D95998#2553440>, @shchenz wrote:

> In D95998#2553412 <https://reviews.llvm.org/D95998#2553412>, @ikudrin wrote:
>
>> The idea was to remove the `Lo` argument from `MCStreamer::emitDwarfUnitLength(Hi, Lo, Comment)` so that it becomes just `MCStreamer::emitDwarfUnitLength(Hi, Comment)`. A temporary symbol can be created and emitted inside the method. And that should be a separate NFC patch.
>
> We need to differentiate the temp symbol names for different debug sections like debug info, debug pubnames, debug line to make a more readable assembly output. That's the first reason I put the temp symbol created outside.

The only usage of that symbol will be an expression just before it. The readability will not be harmed. It is also possible to pass the name as an additional argument to the function if anybody finds that useful.

> Another reason is for the debug line section, we need the temp symbol to generate the debug line prologue length in the following logics of function `MCDwarfLineTableHeader::Emit`. so to avoid returning the temp symbol to its caller (it is only used for debug line, but not used by other callers of `emitDwarfUnitLength`), I use the way to create the temp symbol in the caller site and to emit the temp symbol in callee site.

Returning a value is usually more preferable to changeable arguments; callers may just ignore it if they do not need it. But for this case, I would just create another temporary symbol in `MCDwarfLineTableHeader::Emit()`.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D95998/new/

https://reviews.llvm.org/D95998



More information about the llvm-commits mailing list