[cfe-dev] Adding a new pragma to Clang

Alp Toker alp at nuanti.com
Mon Jan 6 07:42:01 PST 2014


On 06/01/2014 15:32, Renato Golin wrote:
> On 6 January 2014 15:20, Hal Finkel <hfinkel at anl.gov 
> <mailto:hfinkel at anl.gov>> wrote:
>
>     I think he'll need something very close to the OpenMP syntax.
>
>
> Or that.
>
> I don't really mind *how* it's represented in C code, as long as it 
> does what we need in IR in the long run: lexical block level metadata.

The C frontend syntax is the one that's going to ship and get used in 
tens of thousands of software projects, and which we might still be 
having to support 15 years later when the CPU architectures have all 
changed. It's quite likely in that lifetime that other vendors will try 
to do a compatible implementation too if it sees adoption.

So from my point of view the backend implementation, and even the AST 
representation if there is any, is a secondary almost trivial issue 
compared to specifying a new extension to the language. But that's my 
take as a parser maintainer  :-)

Incidentally I don't think there needs to be an AST representation as 
such. This looks like it can be supported with a lookup map for 
statements / expressions, and synthesized attributes for functions.

The list of commands you posted in the previous email is a good starting 
point, but I'd like to see real code samples of what you want to work.

Can it annotate statements, declarations or both? Is it expected to 
survive through template instantiations? Do the directives require 
semantic analysis? Those are the questions that'll determine how this is 
implemented.

Hal's suggestion to plug into the OpenMP directives is also very 
interesting.

Alp.

>
> cheers,
> --renato

-- 
http://www.nuanti.com
the browser experts




More information about the cfe-dev mailing list