[PATCH] D76519: [NFC] Refactor how CFI move sections are represented in AsmPrinter

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Apr 24 00:26:40 PDT 2021


MaskRay added a comment.

> Refactor how CFI move sections

Since 'move' is coined term which is not accurate, just avoid using it.

Can you rephrase why we need both .eh_frame & .debug_frame?

See also D100251 <https://reviews.llvm.org/D100251>. The logic here is subtle. I enumerate {-g,-g0} x {-fno-exceptions,-fexceptions} x {-fno-asynchronous-unwind-tables,-fasynchronous-unwind-tables} and compare the result with GCC to ensure the behaviors are reasonable.



================
Comment at: llvm/include/llvm/CodeGen/AsmPrinter.h:210
+  /// Cached bitwise OR of CFISection flags for all functions in the module.
+  unsigned ModuleCFISections = CFISection::None;
 
----------------
Just use `CFISection`. You can consider `enum class`.


================
Comment at: llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp:1039
   if (MAI->getExceptionHandlingType() == ExceptionHandling::DwarfCFI &&
-      MF->getFunction().needsUnwindTableEntry())
-    return CFI_M_EH;
+      F.needsUnwindTableEntry()) {
+    CFISections = AsmPrinter::CFISection::EH;
----------------
Drop braces around one-line simple statements.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D76519



More information about the llvm-commits mailing list