[PATCH] D39788: [MC] Function stack size section.

Matthias Braun via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 27 11:57:38 PST 2017


MatzeB added inline comments.


================
Comment at: docs/CommandGuide/llc.rst:135-141
+.. option:: -stack-size-section
+
+ Emit the .stack_sizes section which contains stack size metadata. The section
+ contains an array of pairs of function symbol references (8 byte) and stack
+ sizes (unsigned LEB128). The stack size values only include the space allocated
+ in the function prologue. Functions with dynamic stack allocations are not
+ included.
----------------
I'd rather move the documentation to a new (sub)section in `CodeGenerator.rst` as the main purpose would be to document the name and format of the new section.

Documenting the llc flag in addition to that is fine too of course.


================
Comment at: lib/MC/MCObjectFileInfo.cpp:597-598
       Ctx->getELFSection(".eh_frame", EHSectionType, EHSectionFlags);
+
+  StackSizesSection = Ctx->getELFSection(".stack_sizes", ELF::SHT_PROGBITS, 0);
 }
----------------
I'm no expert with ELF, but `PROGBITS` feels wrong to me as I would expect it to get loaded/memory mapped. Is `NOTE` a better fit?


================
Comment at: test/CodeGen/X86/stack-size-section.ll:3-14
+; CHECK-LABEL: func1:
+; CHECK: .section .stack_sizes,"", at progbits
+; CHECK-NEXT: .quad func1
+; CHECK-NEXT: .byte 8
+
+; CHECK-LABEL: func2:
+; CHECK: .section .stack_sizes,"", at progbits
----------------
I'd move the `CHECK` lines in front of the functions.


https://reviews.llvm.org/D39788





More information about the llvm-commits mailing list