Revision tags: llvmorg-3.5.1, llvmorg-3.5.1-rc2 |
|
#
06d6930b |
| 18-Dec-2014 |
Yaron Keren <yaron.keren@gmail.com> |
Fix Visual C++ error "'llvm::make_unique' : ambiguous call to overloaded function".
llvm-svn: 224506
|
#
7d727b5f |
| 18-Dec-2014 |
Rafael Espindola <rafael.espindola@gmail.com> |
Modernize the getStreamedBitcodeModule interface a bit. NFC.
llvm-svn: 224499
|
#
5bd34e56 |
| 12-Dec-2014 |
Duncan P. N. Exon Smith <dexonsmith@apple.com> |
Bitcode: Add missing "Remove in 4.0" comments
llvm-svn: 224090
|
#
5c7006e0 |
| 11-Dec-2014 |
Duncan P. N. Exon Smith <dexonsmith@apple.com> |
Bitcode: Add METADATA_NODE and METADATA_VALUE
This reflects the typelessness of `Metadata` in the bitcode format, removing types from all metadata operands.
`METADATA_VALUE` represents a `ValueAsMe
Bitcode: Add METADATA_NODE and METADATA_VALUE
This reflects the typelessness of `Metadata` in the bitcode format, removing types from all metadata operands.
`METADATA_VALUE` represents a `ValueAsMetadata`, and always has two fields: the type and the value.
`METADATA_NODE` represents an `MDNode`, and unlike `METADATA_OLD_NODE`, doesn't store types. It stores operands at their ID+1 so that `0` can reference `nullptr` operands.
Part of PR21532.
llvm-svn: 224073
show more ...
|
#
005f9f43 |
| 11-Dec-2014 |
Duncan P. N. Exon Smith <dexonsmith@apple.com> |
Bitcode: Add `OLD_` prefix to metadata node records
I'm about to change these, so move the old ones out of the way.
Part of PR21532.
llvm-svn: 224070
|
#
5bf8fef5 |
| 09-Dec-2014 |
Duncan P. N. Exon Smith <dexonsmith@apple.com> |
IR: Split Metadata from Value
Split `Metadata` away from the `Value` class hierarchy, as part of PR21532. Assembly and bitcode changes are in the wings, but this is the bulk of the change for the I
IR: Split Metadata from Value
Split `Metadata` away from the `Value` class hierarchy, as part of PR21532. Assembly and bitcode changes are in the wings, but this is the bulk of the change for the IR C++ API.
I have a follow-up patch prepared for `clang`. If this breaks other sub-projects, I apologize in advance :(. Help me compile it on Darwin I'll try to fix it. FWIW, the errors should be easy to fix, so it may be simpler to just fix it yourself.
This breaks the build for all metadata-related code that's out-of-tree. Rest assured the transition is mechanical and the compiler should catch almost all of the problems.
Here's a quick guide for updating your code:
- `Metadata` is the root of a class hierarchy with three main classes: `MDNode`, `MDString`, and `ValueAsMetadata`. It is distinct from the `Value` class hierarchy. It is typeless -- i.e., instances do *not* have a `Type`.
- `MDNode`'s operands are all `Metadata *` (instead of `Value *`).
- `TrackingVH<MDNode>` and `WeakVH` referring to metadata can be replaced with `TrackingMDNodeRef` and `TrackingMDRef`, respectively.
If you're referring solely to resolved `MDNode`s -- post graph construction -- just use `MDNode*`.
- `MDNode` (and the rest of `Metadata`) have only limited support for `replaceAllUsesWith()`.
As long as an `MDNode` is pointing at a forward declaration -- the result of `MDNode::getTemporary()` -- it maintains a side map of its uses and can RAUW itself. Once the forward declarations are fully resolved RAUW support is dropped on the ground. This means that uniquing collisions on changing operands cause nodes to become "distinct". (This already happened fairly commonly, whenever an operand went to null.)
If you're constructing complex (non self-reference) `MDNode` cycles, you need to call `MDNode::resolveCycles()` on each node (or on a top-level node that somehow references all of the nodes). Also, don't do that. Metadata cycles (and the RAUW machinery needed to construct them) are expensive.
- An `MDNode` can only refer to a `Constant` through a bridge called `ConstantAsMetadata` (one of the subclasses of `ValueAsMetadata`).
As a side effect, accessing an operand of an `MDNode` that is known to be, e.g., `ConstantInt`, takes three steps: first, cast from `Metadata` to `ConstantAsMetadata`; second, extract the `Constant`; third, cast down to `ConstantInt`.
The eventual goal is to introduce `MDInt`/`MDFloat`/etc. and have metadata schema owners transition away from using `Constant`s when the type isn't important (and they don't care about referring to `GlobalValue`s).
In the meantime, I've added transitional API to the `mdconst` namespace that matches semantics with the old code, in order to avoid adding the error-prone three-step equivalent to every call site. If your old code was:
MDNode *N = foo(); bar(isa <ConstantInt>(N->getOperand(0))); baz(cast <ConstantInt>(N->getOperand(1))); bak(cast_or_null <ConstantInt>(N->getOperand(2))); bat(dyn_cast <ConstantInt>(N->getOperand(3))); bay(dyn_cast_or_null<ConstantInt>(N->getOperand(4)));
you can trivially match its semantics with:
MDNode *N = foo(); bar(mdconst::hasa <ConstantInt>(N->getOperand(0))); baz(mdconst::extract <ConstantInt>(N->getOperand(1))); bak(mdconst::extract_or_null <ConstantInt>(N->getOperand(2))); bat(mdconst::dyn_extract <ConstantInt>(N->getOperand(3))); bay(mdconst::dyn_extract_or_null<ConstantInt>(N->getOperand(4)));
and when you transition your metadata schema to `MDInt`:
MDNode *N = foo(); bar(isa <MDInt>(N->getOperand(0))); baz(cast <MDInt>(N->getOperand(1))); bak(cast_or_null <MDInt>(N->getOperand(2))); bat(dyn_cast <MDInt>(N->getOperand(3))); bay(dyn_cast_or_null<MDInt>(N->getOperand(4)));
- A `CallInst` -- specifically, intrinsic instructions -- can refer to metadata through a bridge called `MetadataAsValue`. This is a subclass of `Value` where `getType()->isMetadataTy()`.
`MetadataAsValue` is the *only* class that can legally refer to a `LocalAsMetadata`, which is a bridged form of non-`Constant` values like `Argument` and `Instruction`. It can also refer to any other `Metadata` subclass.
(I'll break all your testcases in a follow-up commit, when I propagate this change to assembly.)
llvm-svn: 223802
show more ...
|
Revision tags: llvmorg-3.5.1-rc1 |
|
#
35303fd7 |
| 06-Dec-2014 |
Duncan P. N. Exon Smith <dexonsmith@apple.com> |
IR: Disallow function-local metadata attachments
Metadata attachments to instructions cannot be function-local.
This is part of PR21532.
llvm-svn: 223574
|
#
da41af9e |
| 06-Dec-2014 |
Duncan P. N. Exon Smith <dexonsmith@apple.com> |
IR: Disallow complicated function-local metadata
Disallow complex types of function-local metadata. The only valid function-local metadata is an `MDNode` whose sole argument is a non-metadata funct
IR: Disallow complicated function-local metadata
Disallow complex types of function-local metadata. The only valid function-local metadata is an `MDNode` whose sole argument is a non-metadata function-local value.
Part of PR21532.
llvm-svn: 223564
show more ...
|
#
2fa1e43a |
| 03-Dec-2014 |
Rafael Espindola <rafael.espindola@gmail.com> |
Ask the module for its the identified types.
When lazy reading a module, the types used in a function will not be visible to a TypeFinder until the body is read.
This patch fixes that by asking the
Ask the module for its the identified types.
When lazy reading a module, the types used in a function will not be visible to a TypeFinder until the body is read.
This patch fixes that by asking the module for its identified struct types. If a materializer is present, the module asks it. If not, it uses a TypeFinder.
This fixes pr21374.
I will be the first to say that this is ugly, but it was the best I could find.
Some of the options I looked at:
* Asking the LLVMContext. This could be made to work for gold, but not currently for ld64. ld64 will load multiple modules into a single context before merging them. This causes us to see types from future merges. Unfortunately, MappedTypes is not just a cache when it comes to opaque types. Once the mapping has been made, we have to remember it for as long as the key may be used. This would mean moving MappedTypes to the Linker class and having to drop the Linker::LinkModules static methods, which are visible from C.
* Adding an option to ignore function bodies in the TypeFinder. This would fix the PR by picking the worst result. It would work, but unfortunately we are currently quite dependent on the upfront type merging. I will try to reduce our dependency, but it is not clear that we will be able to get rid of it for now.
The only clean solution I could think of is making the Module own the types. This would have other advantages, but it is a much bigger change. I will propose it, but it is nice to have this fixed while that is discussed.
With the gold plugin, this patch takes the number of types in the LTO clang binary from 52817 to 49669.
llvm-svn: 223215
show more ...
|
#
51d2de7b |
| 03-Dec-2014 |
Peter Collingbourne <peter@pcc.me.uk> |
Prologue support
Patch by Ben Gamari!
This redefines the `prefix` attribute introduced previously and introduces a `prologue` attribute. There are a two primary usecases that these attributes aim
Prologue support
Patch by Ben Gamari!
This redefines the `prefix` attribute introduced previously and introduces a `prologue` attribute. There are a two primary usecases that these attributes aim to serve,
1. Function prologue sigils
2. Function hot-patching: Enable the user to insert `nop` operations at the beginning of the function which can later be safely replaced with a call to some instrumentation facility
3. Runtime metadata: Allow a compiler to insert data for use by the runtime during execution. GHC is one example of a compiler that needs this functionality for its tables-next-to-code functionality.
Previously `prefix` served cases (1) and (2) quite well by allowing the user to introduce arbitrary data at the entrypoint but before the function body. Case (3), however, was poorly handled by this approach as it required that prefix data was valid executable code.
Here we redefine the notion of prefix data to instead be data which occurs immediately before the function entrypoint (i.e. the symbol address). Since prefix data now occurs before the function entrypoint, there is no need for the data to be valid code.
The previous notion of prefix data now goes under the name "prologue data" to emphasize its duality with the function epilogue.
The intention here is to handle cases (1) and (2) with prologue data and case (3) with prefix data.
References ----------
This idea arose out of discussions[1] with Reid Kleckner in response to a proposal to introduce the notion of symbol offsets to enable handling of case (3).
[1] http://lists.cs.uiuc.edu/pipermail/llvmdev/2014-May/073235.html
Test Plan: testsuite
Differential Revision: http://reviews.llvm.org/D6454
llvm-svn: 223189
show more ...
|
#
e3d126cb |
| 21-Nov-2014 |
Richard Trieu <rtrieu@google.com> |
Add accessor marcos to ConstantPlaceHolder, similar to those in the base class.
llvm-svn: 222502
|
#
2d05db49 |
| 12-Nov-2014 |
Rafael Espindola <rafael.espindola@gmail.com> |
Return the number of read bytes in MemoryObject::readBytes.
Returning more information will allow BitstreamReader to be simplified a bit and changed to read 64 bits at a time.
llvm-svn: 221794
|
#
de1e5b8d |
| 12-Nov-2014 |
Rafael Espindola <rafael.espindola@gmail.com> |
Reduce code duplication a bit. NFC.
llvm-svn: 221785
|
#
246c4fb5 |
| 01-Nov-2014 |
Rafael Espindola <rafael.espindola@gmail.com> |
Remove redundant calls to isMaterializable.
This removes calls to isMaterializable in the following cases:
* It was redundant with a call to isDeclaration now that isDeclaration returns the corre
Remove redundant calls to isMaterializable.
This removes calls to isMaterializable in the following cases:
* It was redundant with a call to isDeclaration now that isDeclaration returns the correct answer for materializable functions. * It was followed by a call to Materialize. Just call Materialize and check EC.
llvm-svn: 221050
show more ...
|
#
32c87ace |
| 29-Oct-2014 |
NAKAMURA Takumi <geek4civic@gmail.com> |
Untabify.
llvm-svn: 220884
|
#
5a52e6dc |
| 24-Oct-2014 |
Rafael Espindola <rafael.espindola@gmail.com> |
Modernize the error handling of the Materialize function.
llvm-svn: 220600
|
#
d4bcefc7 |
| 24-Oct-2014 |
Rafael Espindola <rafael.espindola@gmail.com> |
Don't ever call materializeAllPermanently during LTO.
To do this, change the representation of lazy loaded functions.
The previous representation cannot differentiate between a function whose body
Don't ever call materializeAllPermanently during LTO.
To do this, change the representation of lazy loaded functions.
The previous representation cannot differentiate between a function whose body has been removed and one whose body hasn't been read from the .bc file. That means that in order to drop a function, the entire body had to be read.
llvm-svn: 220580
show more ...
|
#
1b47a28f |
| 23-Oct-2014 |
Rafael Espindola <rafael.espindola@gmail.com> |
clang-format two code snippets to make the next patch easy to read.
llvm-svn: 220484
|
#
7480e4db |
| 23-Sep-2014 |
Petar Jovanovic <petar.jovanovic@imgtec.com> |
Do not destroy external linkage when deleting function body
The function deleteBody() converts the linkage to external and thus destroys original linkage type value. Lack of correct linkage type cau
Do not destroy external linkage when deleting function body
The function deleteBody() converts the linkage to external and thus destroys original linkage type value. Lack of correct linkage type causes wrong relocations to be emitted later. Calling dropAllReferences() instead of deleteBody() will fix the issue.
Differential Revision: http://reviews.llvm.org/D5415
llvm-svn: 218302
show more ...
|
#
770163e4 |
| 19-Sep-2014 |
Chris Bieneman <beanz@apple.com> |
Eliminating static destructor for the BitCodeErrorCategory by converting to a ManagedStatic.
Summary: This is part of the overall goal of removing static initializers from LLVM.
Reviewers: chandler
Eliminating static destructor for the BitCodeErrorCategory by converting to a ManagedStatic.
Summary: This is part of the overall goal of removing static initializers from LLVM.
Reviewers: chandlerc
Reviewed By: chandlerc
Subscribers: chandlerc, llvm-commits
Differential Revision: http://reviews.llvm.org/D5416
llvm-svn: 218149
show more ...
|
#
68812157 |
| 03-Sep-2014 |
Rafael Espindola <rafael.espindola@gmail.com> |
Pass a && to getLazyBitcodeModule.
This forces callers to use std::move when calling it. It is somewhat odd to have code with std::move that doesn't always move, but it is also odd to have code with
Pass a && to getLazyBitcodeModule.
This forces callers to use std::move when calling it. It is somewhat odd to have code with std::move that doesn't always move, but it is also odd to have code without std::move that sometimes moves.
llvm-svn: 217049
show more ...
|
Revision tags: llvmorg-3.5.0 |
|
#
cdb871d7 |
| 27-Aug-2014 |
Rafael Espindola <rafael.espindola@gmail.com> |
Fix a double free in llvm::getBitcodeTargetTriple.
Unfortunately this is only used by ld64, so no testcase, but should fix the darwin LTO bootstrap.
llvm-svn: 216618
|
Revision tags: llvmorg-3.5.0-rc4 |
|
#
e2c1d77f |
| 26-Aug-2014 |
Rafael Espindola <rafael.espindola@gmail.com> |
Pass a std::unique_ptr<MemoryBuffer>& to getLazyBitcodeModule.
By taking a reference we can do the ownership transfer in one place instead of expecting every caller to do it.
llvm-svn: 216492
|
#
d96d553d |
| 26-Aug-2014 |
Rafael Espindola <rafael.espindola@gmail.com> |
Pass a MemoryBufferRef when we can avoid taking ownership.
The attached patch simplifies a few interfaces that don't need to take ownership of a buffer.
For example, both parseAssembly and parseBit
Pass a MemoryBufferRef when we can avoid taking ownership.
The attached patch simplifies a few interfaces that don't need to take ownership of a buffer.
For example, both parseAssembly and parseBitcodeFile will parse the entire buffer before returning. There is no need to take ownership.
Using a MemoryBufferRef makes it obvious in the type signature that there is no ownership transfer.
llvm-svn: 216488
show more ...
|
Revision tags: llvmorg-3.5.0-rc3 |
|
#
5a5fd7b1 |
| 16-Aug-2014 |
Duncan P. N. Exon Smith <dexonsmith@apple.com> |
BitcodeReader: Only create one basic block for each blockaddress
Block address forward-references are implemented by creating a `BasicBlock` ahead of time that gets inserted in the `Function` when i
BitcodeReader: Only create one basic block for each blockaddress
Block address forward-references are implemented by creating a `BasicBlock` ahead of time that gets inserted in the `Function` when it's eventually encountered.
However, if the same blockaddress was used in two separate functions that were parsed *before* the referenced function (and the blockaddress was never used at global scope), two separate basic blocks would get created, one of which would be forgotten creating invalid IR.
This commit changes the forward-reference logic to create only one basic block (and always return the same blockaddress).
llvm-svn: 215805
show more ...
|