IR: Store RAUW support and Context in the same pointer, NFC
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>
Mon, 19 Jan 2015 19:02:06 +0000 (19:02 +0000)
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>
Mon, 19 Jan 2015 19:02:06 +0000 (19:02 +0000)
commit2711ca7c28da9134bda2308bb46ec34d189a0126
tree9fc000a3b386042c7f0b0ccf33d0d9ae1e7f3cb1
parentfcd4569af67b19e04aec436dbd31ad158d6d1e72
IR: Store RAUW support and Context in the same pointer, NFC

Add an `LLVMContext &` to `ReplaceableMetadataImpl`, create a class that
either holds a reference to an `LLVMContext` or owns a
`ReplaceableMetadataImpl`, and use the new class in `MDNode`.

  - This saves a pointer in `UniquableMDNode` at the cost of a pointer
    in `ValueAsMetadata` (which didn't used to store the `LLVMContext`).
    There are far more of the former.
  - Unifies RAUW support between `MDNodeFwdDecl` (which is going away,
    see r226481) and `UniquableMDNode`.

llvm-svn: 226484
llvm/include/llvm/IR/Metadata.h
llvm/lib/IR/Metadata.cpp
llvm/lib/IR/MetadataTracking.cpp
llvm/unittests/IR/MetadataTest.cpp