llvm-6502/include/llvm
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
..
ADT Prune CRLFs. 2015-05-25 01:43:23 +00:00
Analysis Change Function::getIntrinsicID() to return an Intrinsic::ID. NFC. 2015-05-20 17:16:39 +00:00
AsmParser Pass a MemoryBufferRef when we can avoid taking ownership. 2014-08-26 21:49:01 +00:00
Bitcode Add initial support for the convergent attribute. 2015-05-26 23:48:40 +00:00
CodeGen Reapply "AsmPrinter: Change DIEValue to be stored by value" 2015-05-27 22:14:58 +00:00
Config [ADT][CMake][AutoConf] Fail-fast iterators for DenseMap 2015-03-26 19:25:01 +00:00
DebugInfo Revert part of r237975, "Fix Clang -Wmissing-override warning" in DIContext.h, to appease g++-4.7. 2015-05-22 05:52:50 +00:00
ExecutionEngine Reapply part of r237975, "Fix Clang -Wmissing-override warning", except for DIContext.h, to apease g++-4.7. 2015-05-22 10:11:07 +00:00
IR Revert r238305: [PM] Use a simpler technique to drop optional analysis 2015-05-27 09:36:33 +00:00
IRReader Pass a MemoryBufferRef when we can avoid taking ownership. 2014-08-26 21:49:01 +00:00
LineEditor Use 'override/final' instead of 'virtual' for overridden methods 2015-04-11 02:11:45 +00:00
Linker Linker: Add flag to override linkage rules 2015-04-22 04:11:00 +00:00
LTO LTO: Add API to choose whether to embed uselists 2015-04-27 23:38:54 +00:00
MC Rename and move getCurrentSectionData. 2015-05-27 21:04:14 +00:00
Object Object/COFF: Add accessors for import header bitfields. 2015-05-27 02:55:04 +00:00
Option Use 'override/final' instead of 'virtual' for overridden methods 2015-04-11 02:11:45 +00:00
Passes [PM] Create a separate library for high-level pass management code. 2015-03-07 09:02:36 +00:00
ProfileData Tidy comments in SampleProfile header. NFC. 2015-05-12 22:03:00 +00:00
Support ARMTargetParser: Normalising build attributes 2015-05-27 18:15:37 +00:00
TableGen [TableGen] Remove unnecessary include and just forward declare. NFC 2015-05-26 06:48:43 +00:00
Target [ShrinkWrap] Add a target hook to check whether or not 2015-05-27 06:25:48 +00:00
Transforms Extend EarlyCSE to handle basic cases from JumpThreading and CVP 2015-05-22 23:53:24 +00:00
CMakeLists.txt Remove llvm_headers_do_not_build for the benefit of XCode and Visual Studio users. 2014-08-14 00:51:47 +00:00
InitializePasses.h Resubmit r237954 (MIR Serialization: print and parse LLVM IR using MIR format). 2015-05-27 18:02:19 +00:00
LinkAllIR.h
LinkAllPasses.h Add a speculative execution pass 2015-05-15 17:54:48 +00:00
module.modulemap Fix modules build post-r235612. 2015-04-23 23:22:26 +00:00
module.modulemap.build
Pass.h Use 'override/final' instead of 'virtual' for overridden methods 2015-04-11 02:11:45 +00:00
PassAnalysisSupport.h Removing LLVM_DELETED_FUNCTION, as MSVC 2012 was the last reason for requiring the macro. NFC; LLVM edition. 2015-02-15 22:54:22 +00:00
PassInfo.h Removing LLVM_DELETED_FUNCTION, as MSVC 2012 was the last reason for requiring the macro. NFC; LLVM edition. 2015-02-15 22:54:22 +00:00
PassRegistry.h Revert r231276 (including r231277): Add a lock() function in PassRegistry to speed up multi-thread synchronization. 2015-03-05 17:53:00 +00:00
PassSupport.h Defining a new API for debug options that doesn't rely on static global cl::opts. 2014-10-15 21:54:35 +00:00