<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On 10 September 2018 at 16:10, Anastasia Stulova via cfe-dev <span dir="ltr"><<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
An example of how Clang can be used to target SPIR-V:<br>
<br>
clang -c <a href="http://test.cl" rel="noreferrer" target="_blank">test.cl</a> -target spirv[32|64]-unknown-unknown -o test.spv<br>
<br>
This will result in the following Clang actions:<br>
<br>
(1) clang -cc1 -triple spirv[32|64]-unknown-unknown <a href="http://test.cl" rel="noreferrer" target="_blank">test.cl</a> -emit-llvm-bc -o test.bc<br>
<br>
(2) llvm-spirv test.bc -o test.spv<br>
<br></blockquote></div></div><div class="gmail_extra"><br></div><div class="gmail_extra">Hi,</div><div class="gmail_extra"><br></div><div class="gmail_extra">At a high level, one can view the output of backends as being "lower" than LLVM IR.</div><div class="gmail_extra">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.</div><div class="gmail_extra">How about a new output method.</div><div class="gmail_extra">e.g.</div><div class="gmail_extra">Instead of:</div><div class="gmail_extra">(1) clang -cc1 -triple spirv[32|64]-unknown-unknown <a href="http://test.cl" rel="noreferrer" target="_blank">test.cl</a> -emit-llvm-bc -o test.bc<br>

(2) llvm-spirv test.bc -o test.spv<br>
</div><div class="gmail_extra">Use:</div><div class="gmail_extra">clang -cc1 -triple spirv[32|64]-unknown-unknown <a href="http://test.cl" rel="noreferrer" target="_blank">test.cl</a> -emit-spirv -o test.spv</div><div class="gmail_extra">With -emit-xxxx  being plugins that do not fit well with the existing backend api.</div><div class="gmail_extra">This could also be used for output representations that are higher than LLVM IR, e.g. C</div><div class="gmail_extra">We could treat them as a final LLVM IR Module pass, that results in some file output</div><div class="gmail_extra"><br></div><div class="gmail_extra">Kind Regards</div><div class="gmail_extra"><br></div><div class="gmail_extra">James</div><div class="gmail_extra"><br></div><div class="gmail_extra"><br></div><div class="gmail_extra"><br></div></div>