[LLVMdev] [RFC] Module Flags Metadata

Bill Wendling wendling at apple.com
Thu Jan 26 21:58:38 PST 2012


On Jan 24, 2012, at 9:11 PM, Nick Lewycky wrote:

> Yeah, I can't think of any use for something that would pull out NamedMDNodes for no reason. That said, if you want this to work, please audit the module cloner at the very least (it should copy the NamedMDNodes).
> 
> But what would you do with llvm-extract?

llvm-extract already copies over named metadata. 

> Should it keep a copy of every global metadata node that references a function?

What do you mean by this? MDNodes cannot have references to global values. Or do you mean something like:

!0 = metadata !{ metadata !"some_function" }

> The same applies to bugpoint.

Yup!

> What if the NamedMDNode is used in codegen, and removing it removes the crash?

Then it's a bug and should be fixed.

> Simply put, I don't like this design, but my objections are weak and I lack an alternative plan.

:-(

The only other design I can think of (and have thought of) is "module attributes" as an IR-level feature. They would be similar to function attributes. But if we can get away without creating a new IR feature, all the better!

> On the other side, there is a precedent for doing this. For example, RenderScript uses metadata to carry reflection information in the .bc files; their pipeline has that nothing else will touch the .bc files from the time their SDK produces it to the time the phone consumes it, so they assume the metadata wil still be there. RS would break if NamedMDNodes were stripped out.
> 
> It seems to make sense to treat NamedMDNodes not unlike GlobalVariables in most regards, but the MDNodes they contain may change as much as any mdnode.

-bw




More information about the llvm-dev mailing list