| #
bed67f3a |
| 29-Dec-2014 |
Rafael Espindola <[email protected]> |
Refactor duplicated code.
No intended functionality change.
llvm-svn: 224935
|
|
Revision tags: llvmorg-3.5.1, llvmorg-3.5.1-rc2 |
|
| #
5bf8fef5 |
| 09-Dec-2014 |
Duncan P. N. Exon Smith <[email protected]> |
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 |
|
| #
c98ec0e7 |
| 21-Nov-2014 |
Manman Ren <[email protected]> |
[Objective-C] Support a new special module flag that will be put into the objc_imageinfo struct.
rdar://17954668
llvm-svn: 222558
|
| #
83f0ea89 |
| 06-Nov-2014 |
Rafael Espindola <[email protected]> |
Add three other sections when L symbols are allowed.
llvm-svn: 221436
|
| #
bf77ed68 |
| 06-Nov-2014 |
Rafael Espindola <[email protected]> |
Allow L symbols in no_dead_strip sections.
If a section cannot be dead stripped, it is safe to use L symbols, since the linker will keep all of it in the end.
llvm-svn: 221431
|
| #
597be2de |
| 22-Sep-2014 |
David Majnemer <[email protected]> |
MC: ReadOnlyWithRel section kinds should map to rdata in COFF
Don't consider ReadOnlyWithRel as a writable section in COFF, they really belong in .rdata.
llvm-svn: 218268
|
| #
b8dbebb3 |
| 20-Sep-2014 |
David Majnemer <[email protected]> |
MC: Treat ReadOnlyWithRel and ReadOnlyWithRelLocal as ReadOnly for COFF
A problem with our old behavior becomes observable under x86-64 COFF when we need a read-only GV which has an initializer whic
MC: Treat ReadOnlyWithRel and ReadOnlyWithRelLocal as ReadOnly for COFF
A problem with our old behavior becomes observable under x86-64 COFF when we need a read-only GV which has an initializer which is referenced using a relocation: we would mark the section as writable. Marking the section as writable interferes with section merging.
This fixes PR21009.
llvm-svn: 218179
show more ...
|
| #
c0f0c511 |
| 19-Sep-2014 |
Hans Wennborg <[email protected]> |
Fix an it's vs. its typo.
llvm-svn: 218093
|
| #
b582372e |
| 05-Sep-2014 |
Rafael Espindola <[email protected]> |
Revert "Disable the fix for pr20793 because of a gnu ld bug."
This reverts commit r217211.
Both the bfd ld and gold outputs were valid. They were using a Rela relocation, so the value present in th
Revert "Disable the fix for pr20793 because of a gnu ld bug."
This reverts commit r217211.
Both the bfd ld and gold outputs were valid. They were using a Rela relocation, so the value present in the relocated location was not used, which caused me to misread the output.
llvm-svn: 217264
show more ...
|
| #
7eb3b06c |
| 05-Sep-2014 |
Rafael Espindola <[email protected]> |
Disable the fix for pr20793 because of a gnu ld bug.
llvm-svn: 217211
|
| #
7c7d7b92 |
| 05-Sep-2014 |
Rafael Espindola <[email protected]> |
Refactor to avoid code duplication. NFC.
llvm-svn: 217207
|
| #
c4b4253f |
| 04-Sep-2014 |
Rafael Espindola <[email protected]> |
Fix pr20793.
With this patch the third field of llvm.global_ctors is also used on ELF.
llvm-svn: 217202
|
| #
7c4059eb |
| 04-Sep-2014 |
Reid Kleckner <[email protected]> |
MC Win64: Put unwind info for COMDAT code into the same COMDAT group
Summary: This fixes a long standing issue where we would emit many little .text sections and only one .pdata and .xdata section.
MC Win64: Put unwind info for COMDAT code into the same COMDAT group
Summary: This fixes a long standing issue where we would emit many little .text sections and only one .pdata and .xdata section. Now we generate one .pdata / .xdata pair per .text section and associate them correctly.
Fixes PR19667.
Reviewers: majnemer
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D5181
llvm-svn: 217176
show more ...
|
|
Revision tags: llvmorg-3.5.0 |
|
| #
b43d51de |
| 28-Aug-2014 |
Rafael Espindola <[email protected]> |
On MachO, don't put non-private constants in mergeable sections.
On MachO, putting a symbol that doesn't start with a 'L' or 'l' in one of the __TEXT,__literal* sections prevents the linker from mer
On MachO, don't put non-private constants in mergeable sections.
On MachO, putting a symbol that doesn't start with a 'L' or 'l' in one of the __TEXT,__literal* sections prevents the linker from merging the context of the section.
Since private GVs are the ones the get mangled to start with 'L' or 'l', we now only put those on the __TEXT,__literal* sections.
llvm-svn: 216682
show more ...
|
|
Revision tags: llvmorg-3.5.0-rc4, llvmorg-3.5.0-rc3, llvmorg-3.5.0-rc2 |
|
| #
d913448b |
| 04-Aug-2014 |
Eric Christopher <[email protected]> |
Remove the TargetMachine forwards for TargetSubtargetInfo based information and update all callers. No functional change.
llvm-svn: 214781
|
|
Revision tags: llvmorg-3.5.0-rc1 |
|
| #
8bce66b0 |
| 14-Jul-2014 |
David Majnemer <[email protected]> |
CodeGen: Stick constant pool entries in COMDAT sections for WinCOFF
COFF lacks a feature that other object file formats support: mergeable sections.
To work around this, MSVC sticks constant pool e
CodeGen: Stick constant pool entries in COMDAT sections for WinCOFF
COFF lacks a feature that other object file formats support: mergeable sections.
To work around this, MSVC sticks constant pool entries in special COMDAT sections so that each constant is in it's own section. This permits unused constants to be dropped and it also allows duplicate constants in different translation units to get merged together.
This fixes PR20262.
Differential Revision: http://reviews.llvm.org/D4482
llvm-svn: 213006
show more ...
|
| #
6cbe670d |
| 07-Jul-2014 |
Benjamin Kramer <[email protected]> |
Make helper functions static.
llvm-svn: 212460
|
| #
dad0a645 |
| 27-Jun-2014 |
David Majnemer <[email protected]> |
IR: Add COMDATs to the IR
This new IR facility allows us to represent the object-file semantic of a COMDAT group.
COMDATs allow us to tie together sections and make the inclusion of one dependent o
IR: Add COMDATs to the IR
This new IR facility allows us to represent the object-file semantic of a COMDAT group.
COMDATs allow us to tie together sections and make the inclusion of one dependent on another. This is required to implement features like MS ABI VFTables and optimizing away certain kinds of initialization in C++.
This functionality is only representable in COFF and ELF, Mach-O has no similar mechanism.
Differential Revision: http://reviews.llvm.org/D4178
llvm-svn: 211920
show more ...
|
| #
102ff696 |
| 24-Jun-2014 |
David Majnemer <[email protected]> |
CodeGen: Avoid multiple strlen calls
Use a StringRef to hold our section prefix. This avoids multiple calls to strlen.
llvm-svn: 211602
|
| #
0766ae08 |
| 06-Jun-2014 |
Rafael Espindola <[email protected]> |
Fix a few issues with comdat handling on COFF.
* Section association cannot use just the section name as many sections can have the same name. With this patch, the comdat symbol in an assoc section
Fix a few issues with comdat handling on COFF.
* Section association cannot use just the section name as many sections can have the same name. With this patch, the comdat symbol in an assoc section is interpreted to mean a symbol in the associated section and the mapping is discovered from it.
* Comdat symbols were not being set correctly. Instead we were getting whatever was output first for that section.
A consequence is that associative sections now must use .section to set the association. Using .linkonce would not work since it is not possible to change a sections comdat symbol (it is used to decide if we should create a new section or reuse an existing one).
This includes r210298, which was reverted because it was asserting on an associated section having the same comdat as the associated section.
llvm-svn: 210367
show more ...
|
| #
c0029810 |
| 30-May-2014 |
Logan Chien <[email protected]> |
Fix MIPS exception personality encoding.
For MIPS, we have to encode the personality routine with an indirect pointer to absptr; otherwise, some link warning warning will be raised, and the program
Fix MIPS exception personality encoding.
For MIPS, we have to encode the personality routine with an indirect pointer to absptr; otherwise, some link warning warning will be raised, and the program might crash in some early MIPS Android device.
llvm-svn: 209907
show more ...
|
|
Revision tags: llvmorg-3.4.2, llvmorg-3.4.2-rc1 |
|
| #
fceb76f5 |
| 16-May-2014 |
Reid Kleckner <[email protected]> |
Add comdat key field to llvm.global_ctors and llvm.global_dtors
This allows us to put dynamic initializers for weak data into the same comdat group as the data being initialized. This is necessary
Add comdat key field to llvm.global_ctors and llvm.global_dtors
This allows us to put dynamic initializers for weak data into the same comdat group as the data being initialized. This is necessary for MSVC ABI compatibility. Once we have comdats for guard variables, we can use the combination to help GlobalOpt fire more often for weak data with guarded initialization on other platforms.
Reviewers: nlewycky
Differential Revision: http://reviews.llvm.org/D3499
llvm-svn: 209015
show more ...
|
|
Revision tags: llvmorg-3.4.1, llvmorg-3.4.1-rc2 |
|
| #
c0196b1b |
| 14-Apr-2014 |
Craig Topper <[email protected]> |
[C++11] More 'nullptr' conversion. In some cases just using a boolean check instead of comparing to nullptr.
llvm-svn: 206142
|
|
Revision tags: llvmorg-3.4.1-rc1 |
|
| #
a9bdb32f |
| 08-Apr-2014 |
David Majnemer <[email protected]> |
WinCOFF: Emit common symbols as specified in the COFF spec
Summary: Local common symbols were properly inserted into the .bss section. However, putting external common symbols in the .bss section wo
WinCOFF: Emit common symbols as specified in the COFF spec
Summary: Local common symbols were properly inserted into the .bss section. However, putting external common symbols in the .bss section would give them a strong definition.
Instead, encode them as undefined, external symbols who's symbol value is equivalent to their size.
Reviewers: Bigcheese, rafael, rnk
CC: llvm-commits
Differential Revision: http://reviews.llvm.org/D3324
llvm-svn: 205811
show more ...
|
| #
273bff47 |
| 25-Mar-2014 |
David Majnemer <[email protected]> |
WinCOFF: Add support for -fdata-sections
This is a pretty straight forward translation for COFF, we just need to stick the data in a COMDAT section marked as IMAGE_COMDAT_SELECT_NODUPLICATES.
N.B.
WinCOFF: Add support for -fdata-sections
This is a pretty straight forward translation for COFF, we just need to stick the data in a COMDAT section marked as IMAGE_COMDAT_SELECT_NODUPLICATES.
N.B. We must be careful to avoid sticking entities with private linkage in COMDAT groups. COFF is pretty hostile to the renaming of entities so we must be careful to disallow GlobalVariables with unstable names.
llvm-svn: 204703
show more ...
|