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
dsymutil Reapply "AsmPrinter: Change DIEValue to be stored by value" 2015-05-27 22:14:58 +00:00
gold
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
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
llvm-config
llvm-cov InstrProf: Fix display of large numbers in llvm-cov 2015-05-13 22:41:48 +00:00
llvm-cxxdump
llvm-diff
llvm-dis Fix input validation issues in llvm-as/llvm-dis 2015-05-11 21:20:20 +00:00
llvm-dwarfdump
llvm-extract
llvm-go
llvm-jitlistener Prune CRLFs. 2015-05-25 01:43:23 +00:00
llvm-link
llvm-lto
llvm-mc
llvm-mcmarkup
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
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
llvm-size
llvm-stress
llvm-symbolizer A few fixes for llvm-symbolizer on Windows. 2015-05-06 22:26:30 +00:00
lto
macho-dump
msbuild
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
yaml2obj [yaml2elf] Replace error message by assert call in writeSectionContent methods 2015-05-08 07:05:04 +00:00
CMakeLists.txt
LLVMBuild.txt Reflow long lines of some LLVMBuild files 2015-05-14 15:38:27 +00:00
Makefile