[all-commits] [llvm/llvm-project] 58c108: [NFC][AsmPrinter] Refactor DbgVariable as a std::v...
Scott Linder via All-commits
all-commits at lists.llvm.org
Mon Sep 11 10:33:11 PDT 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 58c108cde70bd6f2c39f9d57200c959090fd861a
https://github.com/llvm/llvm-project/commit/58c108cde70bd6f2c39f9d57200c959090fd861a
Author: Scott Linder <Scott.Linder at amd.com>
Date: 2023-09-11 (Mon, 11 Sep 2023)
Changed paths:
M llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
M llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
M llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h
Log Message:
-----------
[NFC][AsmPrinter] Refactor DbgVariable as a std::variant
Only a subset of the fields of DbgVariable are meaningful at any time,
and some fields are re-used for multiple purposes (for example
FrameIndexExprs is used with a throw-away frame-index of 0 to hold a
single DIExpression without needing to add another member). The exact
invariants must be reverse-engineered by inspecting the actual use of
the class, its imprecise/outdated doc-comment, and some asserts.
Refactor DbgVariable into a sum type by inheriting from std::variant.
This makes the active fields for any given state explicit and removes
the need to re-use fields in disparate contexts. As a bonus, it seems to
reduce the size on my x86_64 linux box from 144 bytes to 96 bytes.
There is some potential cost to `std::get` as it must check the active
alternative even when context or an assert obviates it. To try to help
ensure the compiler can optimize out the checks the patch also adds a
helper `get` method which uses the noexcept `std::get_if`.
Some of the extra cost would also be avoided more cleanly with a
refactor that exposes the alternative types in the public interface,
which will come in another patch.
Differential Revision: https://reviews.llvm.org/D158675
Commit: 414ceffc9e8bd2cf0f3e357e7f0509acec8a593c
https://github.com/llvm/llvm-project/commit/414ceffc9e8bd2cf0f3e357e7f0509acec8a593c
Author: Scott Linder <Scott.Linder at amd.com>
Date: 2023-09-11 (Mon, 11 Sep 2023)
Changed paths:
M llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
M llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h
M llvm/lib/CodeGen/AsmPrinter/DwarfFile.cpp
M llvm/lib/CodeGen/AsmPrinter/DwarfFile.h
Log Message:
-----------
[NFC][AsmPrinter] Remove dead multi-MMI handling from DwarfFile::addScopeVariable
Differential Revision: https://reviews.llvm.org/D158676
Commit: 35e621f9ae65009c57b8e3e3c1aac7ba30b28d9a
https://github.com/llvm/llvm-project/commit/35e621f9ae65009c57b8e3e3c1aac7ba30b28d9a
Author: Scott Linder <Scott.Linder at amd.com>
Date: 2023-09-11 (Mon, 11 Sep 2023)
Changed paths:
M llvm/lib/CodeGen/AsmPrinter/DebugLocStream.cpp
M llvm/lib/CodeGen/AsmPrinter/DebugLocStream.h
M llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
M llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h
M llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
M llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h
Log Message:
-----------
[NFC][AsmPrinter] Expose std::variant-ness of DbgVariable
Differential Revision: https://reviews.llvm.org/D158677
Commit: 43331461954939032a03621998c30ac90299ad40
https://github.com/llvm/llvm-project/commit/43331461954939032a03621998c30ac90299ad40
Author: Scott Linder <Scott.Linder at amd.com>
Date: 2023-09-11 (Mon, 11 Sep 2023)
Changed paths:
M llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
M llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h
Log Message:
-----------
[NFC][AsmPrinter] Use std::visit in constructVariableDIEImpl
This potentially has a slightly positive performance impact, as
std::visit can be implemented as a `switch`-like jump rather than
a series of `if`s.
More importantly, the reader can be confident is no overlap between the
cases.
Differential Revision: https://reviews.llvm.org/D158678
Compare: https://github.com/llvm/llvm-project/compare/093aa3774446...433314619549
More information about the All-commits
mailing list