<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size: 12pt; color: rgb(0, 0, 0); font-family: Calibri, Helvetica, sans-serif, "EmojiFont", "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols;" dir="ltr">
<p style="margin-top:0;margin-bottom:0">This would work for us!<br>
</p>
<br>
<br>
<div style="color: rgb(0, 0, 0);">
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font style="font-size:11pt" face="Calibri, sans-serif" color="#000000"><b>From:</b> James Courtier-Dutton <james.dutton@gmail.com><br>
<b>Sent:</b> 16 September 2018 12:11<br>
<b>To:</b> Anastasia Stulova<br>
<b>Cc:</b> clang developer list; llvm-dev@lists.llvm.org; nd; Brian.Sumner@amd.com<br>
<b>Subject:</b> Re: [cfe-dev] [RfC] A proposal of adding SPIR-V Toolchain in Clang</font>
<div> </div>
</div>
<meta content="text/html; charset=utf-8">
<div>
<div dir="ltr">
<div class="x_gmail_extra">
<div class="x_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="x_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="x_gmail_extra"><br>
</div>
<div class="x_gmail_extra">Hi,</div>
<div class="x_gmail_extra"><br>
</div>
<div class="x_gmail_extra">At a high level, one can view the output of backends as being "lower" than LLVM IR.</div>
<div class="x_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="x_gmail_extra">How about a new output method.</div>
<div class="x_gmail_extra">e.g.</div>
<div class="x_gmail_extra">Instead of:</div>
<div class="x_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="x_gmail_extra">Use:</div>
<div class="x_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="x_gmail_extra">With -emit-xxxx  being plugins that do not fit well with the existing backend api.</div>
<div class="x_gmail_extra">This could also be used for output representations that are higher than LLVM IR, e.g. C</div>
<div class="x_gmail_extra">We could treat them as a final LLVM IR Module pass, that results in some file output</div>
<div class="x_gmail_extra"><br>
</div>
<div class="x_gmail_extra">Kind Regards</div>
<div class="x_gmail_extra"><br>
</div>
<div class="x_gmail_extra">James</div>
<div class="x_gmail_extra"><br>
</div>
<div class="x_gmail_extra"><br>
</div>
<div class="x_gmail_extra"><br>
</div>
</div>
</div>
</div>
</div>
</body>
</html>