[PATCH] D49542: DwarfDebug: Reduce duplication in addAccel*** methods

Pavel Labath via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 19 05:49:27 PDT 2018


labath created this revision.
labath added reviewers: JDevlieghere, aprantl, probinson.

Each of the four methods had a dozen lines and was doing almost exactly
the same thing: get the appropriate accelerator table kind and insert an
entry into it. I move this common logic to a helper function and make
these methods delegate to it.

This came up in the context of https://reviews.llvm.org/D49493, where I've needed to make adding
a string to a string pool slightly more complicated, and it seemed to
make sense to do it in one place instead of five.

To make this work I've needed to unify the interface of the AccelTable
data types, as some used to store DIE& and others DIE*. I chose to unify
to a reference as that's what the caller uses.

This technically isn't NFC, because it changes the StringPool used for
apple tables in the DWO case (now it uses the main file like DWARF v5
instead of the DWO file). However, that shouldn't matter, as DWO is not
a thing on apple targets (clang frontend simply ignores -gsplit-dwarf).


Repository:
  rL LLVM

https://reviews.llvm.org/D49542

Files:
  include/llvm/CodeGen/AccelTable.h
  lib/CodeGen/AsmPrinter/AccelTable.cpp
  lib/CodeGen/AsmPrinter/DwarfDebug.cpp
  lib/CodeGen/AsmPrinter/DwarfDebug.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D49542.156250.patch
Type: text/x-patch
Size: 6076 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180719/9f324a3f/attachment.bin>


More information about the llvm-commits mailing list