[PATCH] D132929: [WebAssembly][MC] Avoid the need for .size directives for functions

Sam Clegg via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 31 03:02:48 PDT 2022


sbc100 added inline comments.


================
Comment at: llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp:1702
   if (needFuncLabelsForEHOrDebugInfo(*MF) ||
-      MAI->hasDotTypeDotSizeDirective()) {
+      (MAI->hasDotTypeDotSizeDirective() && !TT.isWasm())) {
     // Create a symbol for the end of function.
----------------
dschuff wrote:
> This isn't for .size, but for the func_end symbol. It looks like (line 1727 below) the func end is stored in a list of MBB section ranges, and MBBSectionRanges is used for debug info generation. Does removing this symbol have an effect on debug info?
Right, but the func_end only has two possible uses.

1. needFuncLabelsForEHOrDebugInfo
2. For calculating the .size

If neither of these is true there is no possible usage of the symbol.   So we don't want to both creating this symbol at all except in these two cases.


================
Comment at: llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp:1710
   // it.
-  if (MAI->hasDotTypeDotSizeDirective()) {
+  if (MAI->hasDotTypeDotSizeDirective() && !TT.isWasm()) {
     // We can get the size as difference between the function label and the
----------------
dschuff wrote:
> It does seem odd that there's a target hook for whether there's a .type/.size directive but we can't use it. Is that just because we want .type (and .size for objects?) but not for functions?
I added a comment and a new local variable to explain the situation.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D132929



More information about the llvm-commits mailing list