[llvm] [SHT_LLVM_FUNC_MAP][ObjectYaml]Introduce function address map section and emit dynamic instruction count(ObjectYaml part) (PR #124332)
Rahman Lavaee via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 30 10:48:24 PST 2025
================
@@ -535,6 +535,27 @@ Example of BBAddrMap with PGO data:
.uleb128 1000 # BB_3 basic block frequency (only when enabled)
.uleb128 0 # BB_3 successors count (only enabled with branch probabilities)
+``SHT_LLVM_FUNC_MAP`` Section (function address map)
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+This section stores the mapping from the binary address of function to its
+related metadata features. It is used to emit function-level analysis data and
+can be enabled through ``--func-map`` option. The fields are encoded in the
+following format:
+
+#. A version number byte used for backward compatibility.
----------------
rlavaee wrote:
So the SHT_LLVM_BB_ADDR_MAP section was implemented using SHF_LINK_ORDER It works because we create one section per function and each section is linked to exactly one function section. We also create this section late in the codegen. So we won't be affected by inlining.
For SHT_LLVM_FUNC_MAP, we can pay the price for gc-sections (given that we win on version field deduplication). The only missing part is how to assign zero addresses to sections corresponding to discarded functions (without making changes in the linker).
https://github.com/llvm/llvm-project/pull/124332
More information about the llvm-commits
mailing list