llvm-project/llvm/lib/CodeGen/AsmPrinter
Adrian Prantl 8c59921ca3 Add DWARF for discriminated unions
n Rust, an enum that carries data in the variants is, essentially, a
discriminated union. Furthermore, the Rust compiler will perform
space optimizations on such enums in some situations. Previously,
DWARF for these constructs was emitted using a hack (a magic field
name); but this approach stopped working when more space optimizations
were added in https://github.com/rust-lang/rust/pull/45225.

This patch changes LLVM to allow discriminated unions to be
represented in DWARF. It adds createDiscriminatedUnionType and
createDiscriminatedMemberType to DIBuilder and then arranges for this
to be emitted using DWARF's DW_TAG_variant_part and DW_TAG_variant.

Note that DWARF requires that a discriminated union be represented as
a structure with a variant part. However, as Rust only needs to emit
pure discriminated unions, this is what I chose to expose on
DIBuilder.

Patch by Tom Tromey!

Differential Revision: https://reviews.llvm.org/D42082

llvm-svn: 324426
2018-02-06 23:45:59 +00:00
..
ARMException.cpp MachineFunction: Return reference from getFunction(); NFC 2017-12-15 22:22:58 +00:00
AccelTable.cpp [AccelTable] Move print methods to implementation. NFC 2018-01-30 13:36:30 +00:00
AddressPool.cpp Fix a bunch more layering of CodeGen headers that are in Target 2017-11-17 01:07:10 +00:00
AddressPool.h [CodeGen] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC). 2017-08-17 21:26:39 +00:00
AsmPrinter.cpp [CodeGen] Simplify conditional. NFC 2018-01-29 20:28:04 +00:00
AsmPrinterDwarf.cpp [DWARF][NFC] Overload AsmPrinter::emitDwarfStringOffsets() to take a DwarfStringPoolEntry 2018-01-11 02:35:00 +00:00
AsmPrinterHandler.h
AsmPrinterInlineAsm.cpp MachineFunction: Return reference from getFunction(); NFC 2017-12-15 22:22:58 +00:00
ByteStreamer.h [DebugInfo] Align comments in debug_loc section 2018-01-05 22:20:30 +00:00
CMakeLists.txt [NFC] Rename DwarfAccelTable and move header. 2018-01-29 14:52:41 +00:00
CodeViewDebug.cpp [CodeView] Class record member counts should include base classes and ... 2018-02-01 20:37:38 +00:00
CodeViewDebug.h [CodeView] Teach clang to emit the .debug$H COFF section. 2017-12-13 22:33:58 +00:00
DIE.cpp [DWARF] Generate DWARF v5 string offsets tables along with strx* index forms. 2018-01-26 18:52:58 +00:00
DIEHash.cpp Move Object format code to lib/BinaryFormat. 2017-06-07 03:48:56 +00:00
DIEHash.h DebugInfo: Include .dwo file name when hashing multiple CUs in a single file 2017-05-29 06:32:34 +00:00
DIEHashAttributes.def Fix DIEHash refactoring that dropped the DW_AT_name from the hash 2017-05-23 18:36:07 +00:00
DbgValueHistoryCalculator.cpp Fix a bunch more layering of CodeGen headers that are in Target 2017-11-17 01:07:10 +00:00
DbgValueHistoryCalculator.h Add a few missing headers for modularization/IWYU/etc 2017-10-27 22:12:46 +00:00
DebugHandlerBase.cpp Re-land "Fix faulty assertion in debug info" 2018-01-05 23:01:04 +00:00
DebugHandlerBase.h [codeview] Generalize DIExpression parsing to handle load chains 2017-08-31 15:56:49 +00:00
DebugLocEntry.h Reverting r315590; it did not include changes for llvm-tblgen, which is causing link errors for several people. 2017-10-15 14:32:27 +00:00
DebugLocStream.cpp
DebugLocStream.h Sort the remaining #include lines in include/... and lib/.... 2017-06-06 11:49:48 +00:00
DwarfCFIException.cpp MachineFunction: Return reference from getFunction(); NFC 2017-12-15 22:22:58 +00:00
DwarfCompileUnit.cpp Fix a crash when emitting DIEs for variable-length arrays 2018-02-06 22:17:45 +00:00
DwarfCompileUnit.h [DWARFv5] CodeGen support for MD5 file checksums 2018-01-12 19:17:50 +00:00
DwarfDebug.cpp [NFC] Rename DwarfAccelTable and move header. 2018-01-29 14:52:41 +00:00
DwarfDebug.h [NFC] Rename DwarfAccelTable and move header. 2018-01-29 14:52:41 +00:00
DwarfException.h Emit .cfi_sections before the first .cfi_startproc 2017-01-02 18:05:27 +00:00
DwarfExpression.cpp Fix a bunch more layering of CodeGen headers that are in Target 2017-11-17 01:07:10 +00:00
DwarfExpression.h [CodeGen] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC). 2017-08-17 21:26:39 +00:00
DwarfFile.cpp Fix a crash when emitting DIEs for variable-length arrays 2018-02-06 22:17:45 +00:00
DwarfFile.h Fix a crash when emitting DIEs for variable-length arrays 2018-02-06 22:17:45 +00:00
DwarfStringPool.cpp [DWARF] Generate DWARF v5 string offsets tables along with strx* index forms. 2018-01-26 18:52:58 +00:00
DwarfStringPool.h [DWARF] Generate DWARF v5 string offsets tables along with strx* index forms. 2018-01-26 18:52:58 +00:00
DwarfUnit.cpp Add DWARF for discriminated unions 2018-02-06 23:45:59 +00:00
DwarfUnit.h Add DWARF for discriminated unions 2018-02-06 23:45:59 +00:00
EHStreamer.cpp Tidy some grammar in some comments 2018-01-09 23:25:38 +00:00
EHStreamer.h [NFC] fix trivial typos in comments and documents 2018-01-26 08:15:29 +00:00
ErlangGCPrinter.cpp Fix a bunch more layering of CodeGen headers that are in Target 2017-11-17 01:07:10 +00:00
LLVMBuild.txt Update libdeps to add BinaryFormat, introduced in r304864. 2017-06-07 04:48:49 +00:00
OcamlGCPrinter.cpp Fix a bunch more layering of CodeGen headers that are in Target 2017-11-17 01:07:10 +00:00
WinCFGuard.cpp Reland "Emit Function IDs table for Control Flow Guard" 2018-01-09 23:49:30 +00:00
WinCFGuard.h Reland "Emit Function IDs table for Control Flow Guard" 2018-01-09 23:49:30 +00:00
WinException.cpp MachineFunction: Return reference from getFunction(); NFC 2017-12-15 22:22:58 +00:00
WinException.h [WinEH] Don't assume endFunction is called while in .text 2016-12-28 19:05:12 +00:00