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

Renato Golin renato.golin at arm.com
Sat Oct 30 07:53:45 PDT 2010


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.

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.

I, for one, vote in favour of having module attributes.

cheers,
--renato




More information about the llvm-dev mailing list