<feed xmlns='http://www.w3.org/2005/Atom'>
<title>llvm-project.git/llvm/lib/CodeGen/AsmPrinter/DebugHandlerBase.cpp, branch users/ojhunt/ptrauth-additions</title>
<subtitle>Unnamed repository; edit this file 'description' to name the repository.
</subtitle>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/'/>
<entry>
<title>[DWARF] Ignore DW_ATE_lo_user to hi_user in DebugHandlerBase assertion (#161695)</title>
<updated>2025-10-07T07:54:42+00:00</updated>
<author>
<name>Orlando Cazalet-Hyams</name>
<email>orlando.hyams@sony.com</email>
</author>
<published>2025-10-07T07:54:42+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=592cdbdfcb03a69c10b1666b85da27afc37dd1ff'/>
<id>592cdbdfcb03a69c10b1666b85da27afc37dd1ff</id>
<content type='text'>
Fixes #140362</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Fixes #140362</pre>
</div>
</content>
</entry>
<entry>
<title>Reland "[DebugInfo][DwarfDebug] Separate creation and population of abstract subprogram DIEs" (#160786)</title>
<updated>2025-09-29T12:40:15+00:00</updated>
<author>
<name>Vladislav Dzhidzhoev</name>
<email>vdzhidzhoev@accesssoftek.com</email>
</author>
<published>2025-09-29T12:40:15+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=2d1f9c95d9f82217e8e35df0b2f622fa227fe53a'/>
<id>2d1f9c95d9f82217e8e35df0b2f622fa227fe53a</id>
<content type='text'>
This is an attempt to reland
https://github.com/llvm/llvm-project/pull/159104 with the fix for
https://github.com/llvm/llvm-project/issues/160197.

The original patch had the following problem: when an abstract
subprogram DIE is constructed from within
`DwarfDebug::endFunctionImpl()`,
`DwarfDebug::constructAbstractSubprogramScopeDIE()` acknowledges `unit:`
field of DISubprogram. But an abstract subprogram DIE constructed from
`DwarfDebug::beginModule()` was put in the same compile unit to which
global variable referencing the subprogram belonged, regardless of
subprogram's `unit:`.

This is fixed by adding `DwarfDebug::getOrCreateAbstractSubprogramCU()`
used by both`DwarfDebug:: constructAbstractSubprogramScopeDIE()` and
`DwarfCompileUnit::getOrCreateSubprogramDIE()` when abstract subprogram
is queried during the creation of DIEs for globals in
`DwarfDebug::beginModule()`.

The fix and the already-reviewed code from
https://github.com/llvm/llvm-project/pull/159104 are two separate
commits in this PR.

=====
The original commit message follows:

With this change, construction of abstract subprogram DIEs is split in
two stages/functions: creation of DIE (in
DwarfCompileUnit::getOrCreateAbstractSubprogramDIE) and its population
with children (in
DwarfCompileUnit::constructAbstractSubprogramScopeDIE).

With that, abstract subprograms can be created/referenced from
DwarfDebug::beginModule, which should solve the issue with static local
variables DIE creation of inlined functons with optimized-out
definitions. It fixes https://github.com/llvm/llvm-project/issues/29985.

LexicalScopes class now stores mapping from DISubprograms to their
corresponding llvm::Function's. It is supposed to be built before
processing of each function (so, now LexicalScopes class has a method
for "module initialization" alongside the method for "function
initialization"). It is used by DwarfCompileUnit to determine whether a
DISubprogram needs an abstract DIE before DwarfDebug::beginFunction is
invoked.

DwarfCompileUnit::getOrCreateSubprogramDIE method is added, which can
create an abstract or a concrete DIE for a subprogram. It accepts
llvm::Function* argument to determine whether a concrete DIE must be
created.

This is a temporary fix for
https://github.com/llvm/llvm-project/issues/29985. Ideally, it will be
fixed by moving global variables and types emission to
DwarfDebug::endModule (https://reviews.llvm.org/D144007,
https://reviews.llvm.org/D144005).

Some code proposed by Ellis Hoag &lt;ellis.sparky.hoag@gmail.com&gt; in
https://github.com/llvm/llvm-project/pull/90523 was taken for this
commit.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This is an attempt to reland
https://github.com/llvm/llvm-project/pull/159104 with the fix for
https://github.com/llvm/llvm-project/issues/160197.

The original patch had the following problem: when an abstract
subprogram DIE is constructed from within
`DwarfDebug::endFunctionImpl()`,
`DwarfDebug::constructAbstractSubprogramScopeDIE()` acknowledges `unit:`
field of DISubprogram. But an abstract subprogram DIE constructed from
`DwarfDebug::beginModule()` was put in the same compile unit to which
global variable referencing the subprogram belonged, regardless of
subprogram's `unit:`.

This is fixed by adding `DwarfDebug::getOrCreateAbstractSubprogramCU()`
used by both`DwarfDebug:: constructAbstractSubprogramScopeDIE()` and
`DwarfCompileUnit::getOrCreateSubprogramDIE()` when abstract subprogram
is queried during the creation of DIEs for globals in
`DwarfDebug::beginModule()`.

The fix and the already-reviewed code from
https://github.com/llvm/llvm-project/pull/159104 are two separate
commits in this PR.

=====
The original commit message follows:

With this change, construction of abstract subprogram DIEs is split in
two stages/functions: creation of DIE (in
DwarfCompileUnit::getOrCreateAbstractSubprogramDIE) and its population
with children (in
DwarfCompileUnit::constructAbstractSubprogramScopeDIE).

With that, abstract subprograms can be created/referenced from
DwarfDebug::beginModule, which should solve the issue with static local
variables DIE creation of inlined functons with optimized-out
definitions. It fixes https://github.com/llvm/llvm-project/issues/29985.

LexicalScopes class now stores mapping from DISubprograms to their
corresponding llvm::Function's. It is supposed to be built before
processing of each function (so, now LexicalScopes class has a method
for "module initialization" alongside the method for "function
initialization"). It is used by DwarfCompileUnit to determine whether a
DISubprogram needs an abstract DIE before DwarfDebug::beginFunction is
invoked.

DwarfCompileUnit::getOrCreateSubprogramDIE method is added, which can
create an abstract or a concrete DIE for a subprogram. It accepts
llvm::Function* argument to determine whether a concrete DIE must be
created.

This is a temporary fix for
https://github.com/llvm/llvm-project/issues/29985. Ideally, it will be
fixed by moving global variables and types emission to
DwarfDebug::endModule (https://reviews.llvm.org/D144007,
https://reviews.llvm.org/D144005).

Some code proposed by Ellis Hoag &lt;ellis.sparky.hoag@gmail.com&gt; in
https://github.com/llvm/llvm-project/pull/90523 was taken for this
commit.</pre>
</div>
</content>
</entry>
<entry>
<title>Revert "[DebugInfo][DwarfDebug] Separate creation and population of abstract subprogram DIEs" (#160349)</title>
<updated>2025-09-23T17:44:34+00:00</updated>
<author>
<name>Vladislav Dzhidzhoev</name>
<email>vdzhidzhoev@accesssoftek.com</email>
</author>
<published>2025-09-23T17:44:34+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=310811af6de889292aa8253af23362c3b70d99aa'/>
<id>310811af6de889292aa8253af23362c3b70d99aa</id>
<content type='text'>
Reverts llvm/llvm-project#159104 due to the issues reported in
https://github.com/llvm/llvm-project/issues/160197.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Reverts llvm/llvm-project#159104 due to the issues reported in
https://github.com/llvm/llvm-project/issues/160197.</pre>
</div>
</content>
</entry>
<entry>
<title>[DebugInfo][DwarfDebug] Separate creation and population of abstract subprogram DIEs (#159104)</title>
<updated>2025-09-17T18:06:49+00:00</updated>
<author>
<name>Vladislav Dzhidzhoev</name>
<email>vdzhidzhoev@accesssoftek.com</email>
</author>
<published>2025-09-17T18:06:49+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=432b58915ad7257c432a403efe194e5033a53ab0'/>
<id>432b58915ad7257c432a403efe194e5033a53ab0</id>
<content type='text'>
With this change, construction of abstract subprogram DIEs is split in
two stages/functions:
creation of DIE (in DwarfCompileUnit::getOrCreateAbstractSubprogramDIE)
and its population with children (in
DwarfCompileUnit::constructAbstractSubprogramScopeDIE).
With that, abstract subprograms can be created/referenced from
DwarfDebug::beginModule, which should solve the issue with static local
variables DIE creation of inlined functons with optimized-out
definitions. It fixes https://github.com/llvm/llvm-project/issues/29985.

LexicalScopes class now stores mapping from DISubprograms to their
corresponding llvm::Function's. It is supposed to be built before
processing of each function (so, now LexicalScopes class has a method
for "module initialization" alongside the method for "function
initialization"). It is used by DwarfCompileUnit to determine whether a
DISubprogram needs an abstract DIE before DwarfDebug::beginFunction is
invoked.

DwarfCompileUnit::getOrCreateSubprogramDIE method is added, which can
create an abstract or a concrete DIE for a subprogram. It accepts
llvm::Function* argument to determine whether a concrete DIE must be
created.

This is a temporary fix for
https://github.com/llvm/llvm-project/issues/29985. Ideally, it will be
fixed by moving global variables and types emission to
DwarfDebug::endModule (https://reviews.llvm.org/D144007,
https://reviews.llvm.org/D144005).

Some code proposed by Ellis Hoag &lt;ellis.sparky.hoag@gmail.com&gt; in
https://github.com/llvm/llvm-project/pull/90523 was taken for this
commit.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
With this change, construction of abstract subprogram DIEs is split in
two stages/functions:
creation of DIE (in DwarfCompileUnit::getOrCreateAbstractSubprogramDIE)
and its population with children (in
DwarfCompileUnit::constructAbstractSubprogramScopeDIE).
With that, abstract subprograms can be created/referenced from
DwarfDebug::beginModule, which should solve the issue with static local
variables DIE creation of inlined functons with optimized-out
definitions. It fixes https://github.com/llvm/llvm-project/issues/29985.

LexicalScopes class now stores mapping from DISubprograms to their
corresponding llvm::Function's. It is supposed to be built before
processing of each function (so, now LexicalScopes class has a method
for "module initialization" alongside the method for "function
initialization"). It is used by DwarfCompileUnit to determine whether a
DISubprogram needs an abstract DIE before DwarfDebug::beginFunction is
invoked.

DwarfCompileUnit::getOrCreateSubprogramDIE method is added, which can
create an abstract or a concrete DIE for a subprogram. It accepts
llvm::Function* argument to determine whether a concrete DIE must be
created.

This is a temporary fix for
https://github.com/llvm/llvm-project/issues/29985. Ideally, it will be
fixed by moving global variables and types emission to
DwarfDebug::endModule (https://reviews.llvm.org/D144007,
https://reviews.llvm.org/D144005).

Some code proposed by Ellis Hoag &lt;ellis.sparky.hoag@gmail.com&gt; in
https://github.com/llvm/llvm-project/pull/90523 was taken for this
commit.</pre>
</div>
</content>
</entry>
<entry>
<title>[CodeGen] Use MCRegister in DbgVariableLocation. NFC</title>
<updated>2025-03-15T07:46:17+00:00</updated>
<author>
<name>Craig Topper</name>
<email>craig.topper@sifive.com</email>
</author>
<published>2025-03-15T07:46:17+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=3b5413c77fd5ce2488e3f45c1ba967e3d3dfa2c8'/>
<id>3b5413c77fd5ce2488e3f45c1ba967e3d3dfa2c8</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Add DISubrangeType (#126772)</title>
<updated>2025-02-24T18:11:53+00:00</updated>
<author>
<name>Tom Tromey</name>
<email>tromey@adacore.com</email>
</author>
<published>2025-02-24T18:11:53+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=e298fc2da97120a30ee2f120ac184ab209fc1eb4'/>
<id>e298fc2da97120a30ee2f120ac184ab209fc1eb4</id>
<content type='text'>
An Ada program can have types that are subranges of other types. This
patch adds a new DIType node, DISubrangeType, to represent this concept.
    
I considered extending the existing DISubrange to do this, but as
DISubrange does not derive from DIType, that approach seemed more
disruptive.
    
A DISubrangeType can be used both as an ordinary type, but also as the
type of an array index. This is also important for Ada.

Ada subrange types can also be stored using a bias. Representing this in
the DWARF required the use of an extension. GCC has been emitting this
extension for years, so I've reused it here.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
An Ada program can have types that are subranges of other types. This
patch adds a new DIType node, DISubrangeType, to represent this concept.
    
I considered extending the existing DISubrange to do this, but as
DISubrange does not derive from DIType, that approach seemed more
disruptive.
    
A DISubrangeType can be used both as an ordinary type, but also as the
type of an array index. This is also important for Ada.

Ada subrange types can also be stored using a bias. Representing this in
the DWARF required the use of an extension. GCC has been emitting this
extension for years, so I've reused it here.</pre>
</div>
</content>
</entry>
<entry>
<title>CodeGen: Remove MachineModuleInfo reference from MachineFunction (#100357)</title>
<updated>2024-07-26T09:10:08+00:00</updated>
<author>
<name>Matt Arsenault</name>
<email>Matthew.Arsenault@amd.com</email>
</author>
<published>2024-07-26T09:10:08+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=63e1647827f3427c5f3ad37461d84a63ba5fcdaf'/>
<id>63e1647827f3427c5f3ad37461d84a63ba5fcdaf</id>
<content type='text'>
This avoids another unserializable field. Move the DbgInfoAvailable
field into the AsmPrinter, which is only really a cache/convenience
bit for checking a direct IR module metadata check.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This avoids another unserializable field. Move the DbgInfoAvailable
field into the AsmPrinter, which is only really a cache/convenience
bit for checking a direct IR module metadata check.</pre>
</div>
</content>
</entry>
<entry>
<title>DebugInfo: Avoid some MMI::hasDebugInfo checks (#100333)</title>
<updated>2024-07-26T09:06:27+00:00</updated>
<author>
<name>Matt Arsenault</name>
<email>Matthew.Arsenault@amd.com</email>
</author>
<published>2024-07-26T09:06:27+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=4ce3993ee2b6ee883ef62100df68db9e10ef1dc9'/>
<id>4ce3993ee2b6ee883ef62100df68db9e10ef1dc9</id>
<content type='text'>
I assume getSubprogram will do the correct thing in hasDebugInfo,
and this is redundant with the debug_compile_units distance check.
This is in preparation for removing the field.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
I assume getSubprogram will do the correct thing in hasDebugInfo,
and this is redundant with the debug_compile_units distance check.
This is in preparation for removing the field.</pre>
</div>
</content>
</entry>
<entry>
<title>[AsmPrinter] Reduce AsmPrinterHandlers virt. fn calls (#96785)</title>
<updated>2024-07-01T11:55:58+00:00</updated>
<author>
<name>Alexis Engelke</name>
<email>engelke@in.tum.de</email>
</author>
<published>2024-07-01T11:55:58+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=117b53ae38428ca66eaa886fb432e6f09db88fe4'/>
<id>117b53ae38428ca66eaa886fb432e6f09db88fe4</id>
<content type='text'>
Currently, an AsmPrinterHandler has several methods that allow to
dynamically hook in unwind or debug info emission, e.g. at begin/end of
every function or instruction. The class hierarchy and the actually
overridden functions are as follows:

    (SymSz=setSymbolSize, mFE=markFunctionEnd, BBS=BasicBlockSection,
     FL=Funclet; b=beginX, e=endX)
                          SymSz   Mod Fn  mFE BBS FL  Inst
    AsmPrinterHandler     -       -   -   -   -   -   -
    ` PseudoProbeHandler  -       -   -   -   -   -   -
    ` WinCFGuard          -       e   e   -   -   -   -
    ` EHStreamer          -       -   -   -   -   -   -
      ` DwarfCFIException -       e   be  -   be  -   -
      ` ARMException      -       -   be  e   -   -   -
      ` AIXException      -       -   e   -   -   -   -
      ` WinException      -       e   be  e   -   be  -
      ` WasmException     -       e   be  -   -   -   -
    ` DebugHandlerBase    -       b   be  -   be  -   be
      ` BTFDebug          -       e   -   -   -   -   b
      ` CodeViewDebug     -       be  -   -   -   -   b
      ` DWARFDebug        yes     be  -   -   -   -   b

Doing virtual function calls per instruction is costly and useless when
the called function does nothing.

This commit performs the following clean-up/improvements:

- PseudoProbeHandler is no longer an AsmPrinterHandler -- it used
nothing of its functionality to hook in at the possible points. This
avoids virtual function calls when a pseudo probe printer is present.

- DebugHandlerBase is no longer an AsmPrinterHandler, but a separate
base class. DebugHandlerBase is the only remaining "hook" for begin/end
instruction and setSymbolSize (only used by DWARFDebug). begin/end for
function and basic block sections are never overriden and therefore are
no longer virtual. (Originally I intended there to be only one debug
handler, but BPF as the only target supports two at the same time: DWARF
and BTF.)

- AsmPrinterHandler no longer has begin/end instruction and
setSymbolSize hooks -- these were only used by DebugHandlerBase. This
avoid iterating over handlers in every instruction.

    AsmPrinterHandler     Mod Fn  mFE BBS FL
    ` WinCFGuard          e   e   -   -   -
    ` EHStreamer          -   -   -   -   -
      ` DwarfCFIException e   be  -   be  -
      ` ARMException      -   be  e   -   -
      ` AIXException      -   e   -   -   -
      ` WinException      e   be  e   -   be
      ` WasmException     e   be  -   -   -

                          SymSz   Mod Fn  BBS Inst
    DebugHandlerBase      -       b   be  be  be
    ` BTFDebug            -       e           b
    ` CodeViewDebug       -       be          b
    ` DWARFDebug          yes     be          b

    PseudoProbeHandler (no shared methods)

To continue allowing external users (e.g., Julia) to hook in at every
instruction, a new method addDebugHandler is exposed.

This results in a performance improvement, especially in the -O0 -g0
case with unwind information (e.g., JIT baseline).</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Currently, an AsmPrinterHandler has several methods that allow to
dynamically hook in unwind or debug info emission, e.g. at begin/end of
every function or instruction. The class hierarchy and the actually
overridden functions are as follows:

    (SymSz=setSymbolSize, mFE=markFunctionEnd, BBS=BasicBlockSection,
     FL=Funclet; b=beginX, e=endX)
                          SymSz   Mod Fn  mFE BBS FL  Inst
    AsmPrinterHandler     -       -   -   -   -   -   -
    ` PseudoProbeHandler  -       -   -   -   -   -   -
    ` WinCFGuard          -       e   e   -   -   -   -
    ` EHStreamer          -       -   -   -   -   -   -
      ` DwarfCFIException -       e   be  -   be  -   -
      ` ARMException      -       -   be  e   -   -   -
      ` AIXException      -       -   e   -   -   -   -
      ` WinException      -       e   be  e   -   be  -
      ` WasmException     -       e   be  -   -   -   -
    ` DebugHandlerBase    -       b   be  -   be  -   be
      ` BTFDebug          -       e   -   -   -   -   b
      ` CodeViewDebug     -       be  -   -   -   -   b
      ` DWARFDebug        yes     be  -   -   -   -   b

Doing virtual function calls per instruction is costly and useless when
the called function does nothing.

This commit performs the following clean-up/improvements:

- PseudoProbeHandler is no longer an AsmPrinterHandler -- it used
nothing of its functionality to hook in at the possible points. This
avoids virtual function calls when a pseudo probe printer is present.

- DebugHandlerBase is no longer an AsmPrinterHandler, but a separate
base class. DebugHandlerBase is the only remaining "hook" for begin/end
instruction and setSymbolSize (only used by DWARFDebug). begin/end for
function and basic block sections are never overriden and therefore are
no longer virtual. (Originally I intended there to be only one debug
handler, but BPF as the only target supports two at the same time: DWARF
and BTF.)

- AsmPrinterHandler no longer has begin/end instruction and
setSymbolSize hooks -- these were only used by DebugHandlerBase. This
avoid iterating over handlers in every instruction.

    AsmPrinterHandler     Mod Fn  mFE BBS FL
    ` WinCFGuard          e   e   -   -   -
    ` EHStreamer          -   -   -   -   -
      ` DwarfCFIException e   be  -   be  -
      ` ARMException      -   be  e   -   -
      ` AIXException      -   e   -   -   -
      ` WinException      e   be  e   -   be
      ` WasmException     e   be  -   -   -

                          SymSz   Mod Fn  BBS Inst
    DebugHandlerBase      -       b   be  be  be
    ` BTFDebug            -       e           b
    ` CodeViewDebug       -       be          b
    ` DWARFDebug          yes     be          b

    PseudoProbeHandler (no shared methods)

To continue allowing external users (e.g., Julia) to hook in at every
instruction, a new method addDebugHandler is exposed.

This results in a performance improvement, especially in the -O0 -g0
case with unwind information (e.g., JIT baseline).</pre>
</div>
</content>
</entry>
<entry>
<title>[IR] Don't include Module.h in Analysis.h (NFC) (#97023)</title>
<updated>2024-06-28T12:30:47+00:00</updated>
<author>
<name>Nikita Popov</name>
<email>npopov@redhat.com</email>
</author>
<published>2024-06-28T12:30:47+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=4169338e75cdce73d34063532db598c95ee82ae4'/>
<id>4169338e75cdce73d34063532db598c95ee82ae4</id>
<content type='text'>
Replace it with a forward declaration instead. Analysis.h is pulled in
by all passes, but not all passes need to access the module.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Replace it with a forward declaration instead. Analysis.h is pulled in
by all passes, but not all passes need to access the module.</pre>
</div>
</content>
</entry>
</feed>
