[PATCH] D130879: [AsmPrinter] Emit PCs into requested PCSections

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 2 20:34:33 PDT 2022


MaskRay added inline comments.


================
Comment at: llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp:1425
+void AsmPrinter::emitPCSectionsLabel(const MachineFunction &MF,
+                                     const MDNode *MD) {
+  MCSymbol *S = MF.getContext().createTempSymbol("pcsection");
----------------
prefer const reference if non-null


================
Comment at: llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp:1449
+    OutStreamer->switchSection(S);
+    Prev = Sec;
+  };
----------------
What does `Prev = Sec;` do?


================
Comment at: llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp:1486
+  if (const MDNode *MD = F.getMetadata(LLVMContext::MD_pcsections)) {
+    EmitForMD(*MD, {getFunctionBegin(), getFunctionEnd()}, true);
+  }
----------------
omit braces for one-line single statements


================
Comment at: llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp:1490
+  for (const auto &MS : PCSectionsSymbols) {
+    EmitForMD(*MS.first, MS.second, false);
+  }
----------------
omit braces for one-line single statements


================
Comment at: llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp:1490
+  for (const auto &MS : PCSectionsSymbols) {
+    EmitForMD(*MS.first, MS.second, false);
+  }
----------------
MaskRay wrote:
> omit braces for one-line single statements
As of this patch, no test exercises this line.

If you add tests to later patches, I think they should be moved here.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D130879



More information about the llvm-commits mailing list