[PATCH] D29110: LangRef: Document the allowed metadata dropping transforms.

Peter Collingbourne via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 25 10:59:12 PST 2017


pcc added a comment.

In https://reviews.llvm.org/D29110#656490, @mehdi_amini wrote:

> In https://reviews.llvm.org/D29110#656480, @pcc wrote:
>
> > So would it solve the problem if we don't call it metadata? They are "attributes which happen to be represented using the MD* classes".
>
>
> You need to define a closed-list of these and their semantic. The key point about metadata is that they are extensible in an opaque way.


Sure, at the moment those would be type, absolute_symbol and (soon) associated. The idea I have is to define two functions on GlobalObject:

- `void copyAttributes(GlobalObject *GO, uint64_t FromBegin, uint64_t FromEnd, uint64_t ToBegin)` -- we are moving bytes [FromBegin, FromEnd) to offset ToBegin in "this". Copy "regular" attributes. Copy type, adjusting embedded offsets if necessary. If associated is set, add the global to llvm.compiler.used to make sure it is not dropped. Maybe error out on absolute_symbol (can only be present on declarations and would be replaced by an alias in the IR linker)? Opportunistically also copy dbg if possible (for example by using DW_OP_piece and DW_OP_plus). Copy nothing else.
- `void copyMetadata(GlobalObject *GO)` -- copy all metadata. This would be used in the IR linker, for example.


https://reviews.llvm.org/D29110





More information about the llvm-commits mailing list