[PATCH] D105916: [AsmPrinter][CallGraphSection] Emit call graph section

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jul 18 14:20:43 PDT 2021


MaskRay added a comment.

The usage is similar to .stack_sizes (metadata section not referenced by text) , so SHF_LINK_ORDER suffices, no need for `comdat noduplicates`.



================
Comment at: llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp:1323
+    // Emit the pairs.
+    for (const auto &El : CallSiteLabels) {
+      auto TypeId = El.first;
----------------
expand auto https://llvm.org/docs/CodingStandards.html#use-auto-type-deduction-to-make-code-more-readable


================
Comment at: llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp:1384
+    // it is not a callback, then anything could call it.
+    auto &Func = MF->getFunction();
+    FunctionLabels[&Func].IsIndirectTarget =
----------------
expand auto

https://llvm.org/docs/CodingStandards.html#use-auto-type-deduction-to-make-code-more-readable


================
Comment at: llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp:1388
+        Func.hasAddressTaken(nullptr,
+                             /* IgnoreCallbackUses */ true,
+                             /* IgnoreAssumeLikeCalls */ true,
----------------
clang-format and clang-tidy bugprone-argument-comment prefer `/*IgnoreCallbackUses=*/true`


================
Comment at: llvm/lib/MC/MCObjectFileInfo.cpp:1013
+  static unsigned UniqueID = 1;
+  return Ctx->getELFSection(".callgraph", ELF::SHT_PROGBITS,
+                            ELF::SHF_LINK_ORDER, 0, nullptr, false, UniqueID++,
----------------
Use the style of getStackSizesSection. Pass in the MCSection &TextSec, and do SHF_LINK_ORDER/SHF_GROUP here, instead of at the call site.


================
Comment at: llvm/test/CodeGen/call-graph-section.ll:5
+; RUN: llvm-readelf -x .callgraph - | FileCheck %s
+; XFAIL: *
+
----------------
Why is this XFAIL?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D105916



More information about the llvm-commits mailing list