diff options
author | Michael Buch <michaelbuch12@gmail.com> | 2025-06-16 16:58:00 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-06-16 16:58:00 +0100 |
commit | 711f6a8603717a6dc7e6202c614433ea2f9c0967 (patch) | |
tree | 6540b774fa99f4c9e49047b6c0d896faee716b7f /llvm/lib/CodeGen/MachineBasicBlock.cpp | |
parent | dfb14b65bc0a277f920c797b4557e79685055b4f (diff) | |
download | llvm-711f6a8603717a6dc7e6202c614433ea2f9c0967.zip llvm-711f6a8603717a6dc7e6202c614433ea2f9c0967.tar.gz llvm-711f6a8603717a6dc7e6202c614433ea2f9c0967.tar.bz2 |
[llvm][DebugInfo] Encode DW_AT_object_pointer on method declarations with DW_FORM_implicit_const (#124790)
We started attaching `DW_AT_object_pointer`s on method declarations in
https://github.com/llvm/llvm-project/pull/122742. However, that caused
the `.debug_info` section size to increase significantly (by around ~10%
on some projects). This was mainly due to the large number of new
`DW_FORM_ref4` values. This patch tries to address that regression by
changing the `DW_FORM_ref4` to a `DW_FORM_implicit_const` for
declarations. The value of `DW_FORM_implicit_const` will be the *index*
of the object parameter in the list of formal parameters of the
subprogram (i.e., if the first `DW_TAG_formal_parameter` is the object
pointer, the `DW_FORM_implicit_const` would be `0`). The DWARFv5 spec
only mentions the use of the `reference` attribute class to for
`DW_AT_object_pointer`. So using a `DW_FORM_impilicit_const` would be an
extension to (and not something mandated/specified by) the standard.
Though it'd make sense to extend the wording in the spec to allow for
this optimization.
That way we don't pay for the 4 byte references on every attribute
occurrence. In a local build of clang this barely affected the
`.debug_info` section size (but did increase `.debug_abbrev` by up to
10%, which doesn't impact the total debug-info size much however).
We guarded this on LLDB tuning (since using `DW_FORM_implicit_const` for
this purpose may surprise consumers) and DWARFv5 (since that's where
`DW_FORM_implicit_const` was first standardized).
Diffstat (limited to 'llvm/lib/CodeGen/MachineBasicBlock.cpp')
0 files changed, 0 insertions, 0 deletions