llvm-project/llvm
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
..
bindings [NFC] fix trivial typos in comments and documents 2018-01-26 08:15:29 +00:00
cmake [cmake] Don't build Native llvm-config when cross compiling if passed by user. 2018-01-21 00:29:00 +00:00
docs [docs] Add out-of-date warnings to the BuildingAJIT tutorial text. 2018-02-06 21:25:20 +00:00
examples Add OrcJIT dependency for Kaleidoscope Chapter 9. 2018-02-06 22:22:10 +00:00
include Add DWARF for discriminated unions 2018-02-06 23:45:59 +00:00
lib Add DWARF for discriminated unions 2018-02-06 23:45:59 +00:00
projects
resources
runtimes [CMake] Support for cross-compilation when build runtimes 2018-01-08 23:50:59 +00:00
test Add DWARF for discriminated unions 2018-02-06 23:45:59 +00:00
tools [ORC] Remove some unused lambda captures. 2018-02-06 21:52:46 +00:00
unittests Add DWARF for discriminated unions 2018-02-06 23:45:59 +00:00
utils [CodeGenSchedule][NFC] Always emit ProcResourceUnits. 2018-02-05 12:23:51 +00:00
.arcconfig [llvm] Set up .arcconfig to point to Diffusion L repository 2018-01-12 15:37:41 +00:00
.clang-format
.clang-tidy
.gitattributes
.gitignore
CMakeLists.txt [CMake] Fix Bug Report URL 2018-01-25 19:16:46 +00:00
CODE_OWNERS.TXT
CREDITS.TXT Add myself to CREDITS.txt 2018-01-29 17:02:34 +00:00
LICENSE.TXT
LLVMBuild.txt
README.txt
RELEASE_TESTERS.TXT
configure
llvm.spec.in

README.txt

Low Level Virtual Machine (LLVM)
================================

This directory and its subdirectories contain source code for LLVM,
a toolkit for the construction of highly optimized compilers,
optimizers, and runtime environments.

LLVM is open source software. You may freely distribute it under the terms of
the license agreement found in LICENSE.txt.

Please see the documentation provided in docs/ for further
assistance with LLVM, and in particular docs/GettingStarted.rst for getting
started with LLVM and docs/README.txt for an overview of LLVM's
documentation setup.

If you are writing a package for LLVM, see docs/Packaging.rst for our
suggestions.