[llvm] [RemoveDIs] Add documentation for IR debug records (PR #81156)
Felipe de Azevedo Piovezan via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 8 09:38:52 PST 2024
================
@@ -268,6 +279,60 @@ The formal LLVM-IR signature is:
See :doc:`AssignmentTracking` for more info.
+.. _debug_records:
+
+Debug Records
+----------------------------
+
+LLVM also has an alternative to intrinsic functions, debug records, which
+function similarly but are not instructions. The basic syntax for debug records
+is:
+
+.. code-block:: llvm
+
+ call void llvm.dbg.<type>([metadata <arg>, ]*), !dbg <DILocation> ; Intrinsic model
+ #dbg_<type>([<arg>, ]*, <DILocation>) ; Record model
+
+A debug intrinsic function can therefore be converted to a debug record with the
+following steps:
+
+1. Add an extra level of indentation.
+2. Replace everything prior to the intrinsic type (declare/value/assign) with
+ ``#dbg_``.
+3. Remove the leading ``metadata`` from the intrinsic's arguments.
+4. Transfer the ``!dbg`` attachment to be an argument, dropping the leading
+ ``!dbg``.
+
+For each variety of intrinsic function, there is an equivalent debug record.
----------------
felipepiovezan wrote:
Note how here we say "variety" instead of "type".
https://github.com/llvm/llvm-project/pull/81156
More information about the llvm-commits
mailing list