cuda input for clang frontend

Hi there,

Is there anybody knows how to modified clang so it can get CUDA as it’s input and generate LLVM IR?


I see you didn't get any reply to your previous email; sorry about
that. (Note that a lot of the main clang developers are busy with the
Apple WWDC.)

Roughly, the following steps are needed:

1. Change clang to treat CUDA as a distinct C-like language (look for
how OpenCL is implemented for a template of what needs to be done).
2. Make the parser handle any differences in the C grammar and the CUDA grammar.
3. Implement an AST representation of any CUDA extensions.
4. Change semantic analysis to understand any differences between CUDA
and C, and build the AST for any extensions.
5. Extend the code generator to convert the new AST constructs to LLVM IR.
6. Add an automatically-included header to handle any calls to
specialized functions which CUDA requires.

Most of these steps aren't really specific to CUDA; I'm not really
familiar enough with it to provide specific guidance. That said, I
think this is a relatively large project if you're really interested
in completing it; OpenCL support required a large amount of work, and
the same is likely true of CUDA. If you need guidance for
implementing a specific feature, or have more general question, please
ask. One place to start would be to try to compile a complete list of
the changes necessary for full CUDA support.