[cfe-dev] [RfC] A proposal of adding SPIR-V Toolchain in Clang

James Courtier-Dutton via cfe-dev cfe-dev at lists.llvm.org
Sun Sep 16 04:11:09 PDT 2018


On 10 September 2018 at 16:10, Anastasia Stulova via cfe-dev <
cfe-dev at lists.llvm.org> wrote:

>
> An example of how Clang can be used to target SPIR-V:
>
> clang -c test.cl -target spirv[32|64]-unknown-unknown -o test.spv
>
> This will result in the following Clang actions:
>
> (1) clang -cc1 -triple spirv[32|64]-unknown-unknown test.cl -emit-llvm-bc
> -o test.bc
>
> (2) llvm-spirv test.bc -o test.spv
>
>
Hi,

At a high level, one can view the output of backends as being "lower" than
LLVM IR.
If we wish to output representations that are at a similar level to LLVM
IR, then it might be sensible not to use the backends method.
How about a new output method.
e.g.
Instead of:
(1) clang -cc1 -triple spirv[32|64]-unknown-unknown test.cl -emit-llvm-bc
-o test.bc
(2) llvm-spirv test.bc -o test.spv
Use:
clang -cc1 -triple spirv[32|64]-unknown-unknown test.cl -emit-spirv -o
test.spv
With -emit-xxxx  being plugins that do not fit well with the existing
backend api.
This could also be used for output representations that are higher than
LLVM IR, e.g. C
We could treat them as a final LLVM IR Module pass, that results in some
file output

Kind Regards

James
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20180916/e6fcbd79/attachment.html>


More information about the cfe-dev mailing list