llvm-6502/tools
Duncan P. N. Exon Smith 09fe4bf794 Reapply "AsmPrinter: Change DIEValue to be stored by value"
This reverts commit r238350, effectively reapplying r238349 after fixing
(all?) the problems, all somehow related to how I was using
`AlignedArrayCharUnion<>` inside `DIEValue`:

  - MSVC can only handle `sizeof()` on types, not values.  Change the
    assert.
  - GCC doesn't know the `is_trivially_copyable` type trait.  Instead of
    asserting it, add destructors.
  - Call placement new even when constructing POD (i.e., the pointers).
  - Instead of copying the char buffer, copy the casted classes.

I've left in a couple of `static_assert`s that I think both MSVC and GCC
know how to handle.  If the bots disagree with me, I'll remove them.

  - Check that the constructed type is either standard layout or a
    pointer.  This protects against a programming error: we really want
    the "small" `DIEValue`s to be small and simple, so don't
    accidentally change them not to be.
  - Similarly, check that the size of the buffer is no bigger than a
    `uint64_t` or a pointer.  (I thought checking against
    `sizeof(uint64_t)` would be good enough, but Chandler suggested that
    pointers might sometimes be bigger than that in the context of
    sanitizers.)

I've also committed r238359 in the meantime, which introduces a
DIEValue.def to simplify dispatching between the various types (thanks
to a review comment by David Blaikie).  Without that, this commit would
be almost unintelligible.

Here's the original commit message:
--
Change `DIEValue` to be stored/passed/etc. by value, instead of
reference.  It's now a discriminated union, with a `Val` field storing
the actual type.  The classes that used to inherit from `DIEValue` no
longer do.  There are two categories of these:

  - Small values fit in a single pointer and are stored by value.
  - Large values require auxiliary storage, and are stored by reference.

The only non-mechanical change is to tools/dsymutil/DwarfLinker.cpp.  It
was relying on `DIEInteger`s being passed around by reference, so I
replaced that assumption with a `PatchLocation` type that stores a safe
reference to where the `DIEInteger` lives instead.

This commit causes a temporary regression in memory usage, since I've
left merging `DIEAbbrevData` into `DIEValue` for a follow-up commit.  I
measured an increase from 845 MB to 879 MB, around 3.9%.  The follow-up
drops it lower than the starting point, and I've only recently brought
the memory this low anyway, so I'm committing these changes separately
to keep them incremental.  (I also considered swapping the commits, but
the other one first would cause a lot more code churn.)

(I'm looking at `llc` memory usage on `verify-uselistorder.lto.opt.bc`;
see r236629 for details.)
--

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238362 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-27 22:14:58 +00:00
..
bugpoint [bugpoint] Increase default memory limit to 400MB to fix bugpoint tests. 2015-05-05 16:29:40 +00:00
bugpoint-passes bugpoint Enhancement. 2015-04-20 23:42:22 +00:00
dsymutil Reapply "AsmPrinter: Change DIEValue to be stored by value" 2015-05-27 22:14:58 +00:00
gold Fix build error from r234957 2015-04-15 00:13:51 +00:00
llc Resubmit r237954 (MIR Serialization: print and parse LLVM IR using MIR format). 2015-05-27 18:02:19 +00:00
lli Migrate existing backends that care about software floating point 2015-05-12 01:26:05 +00:00
llvm-ar Purge unused includes throughout libSupport. 2015-03-23 18:07:13 +00:00
llvm-as Fix input validation issues in llvm-as/llvm-dis 2015-05-11 21:20:20 +00:00
llvm-bcanalyzer [llvm-bcanalyzer] Add -show-binary-blobs option. 2015-05-13 18:51:49 +00:00
llvm-c-test Fix build breakage caused by memory leaks in llvm-c-test 2015-01-28 18:32:31 +00:00
llvm-config Refactoring CMake CrossCompile module. 2015-03-12 17:33:34 +00:00
llvm-cov InstrProf: Fix display of large numbers in llvm-cov 2015-05-13 22:41:48 +00:00
llvm-cxxdump Change range-based for-loop to use const auto&. No functionality change. 2015-04-15 03:17:49 +00:00
llvm-diff Revert "Remove the explicit SDNodeIterator::operator= in favor of the implicit default" 2015-03-03 21:18:16 +00:00
llvm-dis Fix input validation issues in llvm-as/llvm-dis 2015-05-11 21:20:20 +00:00
llvm-dwarfdump Move DIContext.h to common DebugInfo location. 2015-04-23 17:37:47 +00:00
llvm-extract uselistorder: Remove the global bits 2015-04-15 03:14:06 +00:00
llvm-go llvm-go: Set $GCCGO instead of putting a gccgo executable on $PATH. 2015-02-14 01:45:57 +00:00
llvm-jitlistener Prune CRLFs. 2015-05-25 01:43:23 +00:00
llvm-link Linker: Add flag to override linkage rules 2015-04-22 04:11:00 +00:00
llvm-lto libLTO, llvm-lto, gold: Introduce flag for controlling optimization level. 2015-03-19 22:01:00 +00:00
llvm-mc Add targets to cmake for specific target components. 2015-04-20 18:22:05 +00:00
llvm-mcmarkup Explicitly pass ownership of the MemoryBuffer to AddNewSourceBuffer using std::unique_ptr 2014-08-21 20:44:56 +00:00
llvm-nm Fix llvm-nm -S option. 2015-05-22 13:28:35 +00:00
llvm-objdump Make it easier to use DwarfContext with MCJIT 2015-05-21 21:24:32 +00:00
llvm-pdbdump [llvm-pdbdump] Support dynamic load address and external symbols. 2015-05-01 20:24:26 +00:00
llvm-profdata Purge unused includes throughout libSupport. 2015-03-23 18:07:13 +00:00
llvm-readobj [llvm-readobj/ELF] Teach how to decode DF_1_XXX flags 2015-05-25 19:12:18 +00:00
llvm-rtdyld Make it easier to use DwarfContext with MCJIT 2015-05-21 21:24:32 +00:00
llvm-shlib Updating symbol wildcards one more time. 2015-04-16 21:58:22 +00:00
llvm-size Assigning and copying command line option objects shouldn't be allowed. 2015-01-22 01:49:59 +00:00
llvm-stress Verifier: Remove the separate -verify-di pass 2015-03-19 22:24:17 +00:00
llvm-symbolizer A few fixes for llvm-symbolizer on Windows. 2015-05-06 22:26:30 +00:00
lto LTO: Add API to choose whether to embed uselists 2015-04-27 23:38:54 +00:00
macho-dump Add printing the LC_LINKER_OPTION load command with llvm-objdump’s -private-headers. 2014-12-18 00:53:40 +00:00
msbuild MSBuild integration: fix the loop in install.bat 2014-09-30 22:30:06 +00:00
obj2yaml [obj2yaml/yaml2obj] Add SHT_MIPS_ABIFLAGS section support 2015-05-07 15:40:48 +00:00
opt Remove NoFramePointerElim and NoFramePointerElimOverride from TargetOptions and 2015-05-26 20:17:20 +00:00
verify-uselistorder uselistorder: Pull the assembly bit up out of the printer 2015-04-15 02:12:41 +00:00
yaml2obj [yaml2elf] Replace error message by assert call in writeSectionContent methods 2015-05-08 07:05:04 +00:00
CMakeLists.txt llvm-cxxdump: Rename llvm-vtabledump to llvm-cxxdump 2015-03-15 01:30:58 +00:00
LLVMBuild.txt Reflow long lines of some LLVMBuild files 2015-05-14 15:38:27 +00:00
Makefile llvm-cxxdump: Rename llvm-vtabledump to llvm-cxxdump 2015-03-15 01:30:58 +00:00