[LLVMdev] RFC: [Proposal] Module-Level Attributes

Bill Wendling wendling at apple.com
Sat Oct 30 19:03:14 PDT 2010


On Oct 30, 2010, at 7:53 AM, Renato Golin wrote:

> On 29 October 2010 01:46, Bill Wendling <wendling at apple.com> wrote:
>> Syntax:
>>    ml-attr ::= 'module' 'attr' NAME ('[' NAME (',' NAME)* ']')?
>> where the optional list of NAMEs in the square brackets represents sub-attributes
>> of the main attribute.
>> Semantics:
>> Module-level attributes are looked at only by those parts of the compiler which
>> care about them. Deleting a module attribute may effect code generation.
>> Each module-level attribute will have its own documented semantics for
>> how it may be used.
> 
> Hi Bill,
> 
> This sounds very similar with my proposal to introduce ARM build
> attributes as a module level property (pretty much like data layout
> and target triple). You can specify restrictions that you passed via
> the front-end and get them propagated all the way to the back end,
> even if you're compiling in separate steps, linking objects from
> different processes.
> 
Cool! I missed your proposal. Do you have a link to it?

> Allowing target-dependent attributes to be set (ie. not verified by
> the front-end), you wouldn't pollute x86 modules with ARM build
> attributes or C++ modules with Objective-C attributes.
> 
> An alternative would be to use metadata for that, as was proposed
> already due to it's non-checked nature, but metadata needs a real
> Value to remain in the module, and that's precisely what you're trying
> to avoid.
> 
The other problem with metadata is that it's not may be removed at any point in the compilation process. So you cannot depend upon it being there.

> I, for one, vote in favour of having module attributes.
> 
Thanks :-)

-bw






More information about the llvm-dev mailing list