<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div id="appendonsend" style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
</div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div lang="EN-US">
<div class="x_WordSection1">
<p class="x_MsoNormal" style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: "Times New Roman", "serif";margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: "Times New Roman", "serif";">
<span style="font-size:11.0pt; font-family:"Calibri","sans-serif"; color:#1F497D"> </span></p>
<p class="x_MsoNormal" style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: "Times New Roman", "serif";margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: "Times New Roman", "serif";">
<span style="font-size:11.0pt; font-family:"Calibri","sans-serif"; color:#1F497D">Paul,</span></p>
<p class="x_MsoNormal" style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: "Times New Roman", "serif";margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: "Times New Roman", "serif";">
<span style="font-size:11.0pt; font-family:"Calibri","sans-serif"; color:#1F497D">My answers are in red.</span></p>
<p class="x_MsoNormal" style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: "Times New Roman", "serif";margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: "Times New Roman", "serif";">
<span style="font-size:11.0pt; font-family:"Calibri","sans-serif"; color:#1F497D"><br>
</span></p>
<p class="x_MsoNormal" style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: "Times New Roman", "serif";margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: "Times New Roman", "serif";">
<span style="font-size:11.0pt; font-family:"Calibri","sans-serif"; color:#1F497D">But, perhaps you meant that you are seeing Clang taking the code you generate for your target, and then trying to assemble it as if it were code generated for your host.  That
 sounds like you have not implemented all the necessary pieces of Target and MC to turn the generated code into an object file for your target.</span></p>
<p class="x_MsoNormal" style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: "Times New Roman", "serif";margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: "Times New Roman", "serif";">
<span style="font-size: 11pt; font-family: "Calibri", "sans-serif"; color: rgb(200, 38, 19);">This is what I meant</span><span style="font-size:11.0pt; font-family:"Calibri","sans-serif"; color:#1F497D"><br>
</span></p>
<p class="x_MsoNormal" style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: "Times New Roman", "serif";margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: "Times New Roman", "serif";">
<span style="font-size:11.0pt; font-family:"Calibri","sans-serif"; color:#1F497D"> </span></p>
<p class="x_MsoNormal" style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: "Times New Roman", "serif";margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: "Times New Roman", "serif";">
<span style="font-size:11.0pt; font-family:"Calibri","sans-serif"; color:#1F497D">Let's try this:  If you run `clang –S –target your_triple test.c` (where your_triple is the triple for your target) does it produce an assembler file (test.s) that has the proper
 instructions for your target?  </span><span style="font-size: 11pt; font-family: "Calibri", "sans-serif"; color: rgb(200, 38, 19);">Yes</span><span style="font-size:11.0pt; font-family:"Calibri","sans-serif"; color:#1F497D"> If not, then you have some work
 to do to make that happen.</span></p>
<p class="x_MsoNormal" style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: "Times New Roman", "serif";margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: "Times New Roman", "serif";">
<span style="font-size:11.0pt; font-family:"Calibri","sans-serif"; color:#1F497D">Once your assembler file looks good, if you run `clang –c –target your_triple test.s` what happens?</span></p>
<p class="x_MsoNormal" style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: "Times New Roman", "serif";margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: "Times New Roman", "serif";">
<span style="font-size: 11pt; font-family: "Calibri", "sans-serif"; color: rgb(200, 38, 19);">For every instruction in my .s file, there is a message that says "</span><span style="font-size: 11pt; font-family: "Calibri", "sans-serif"; color: rgb(200, 38, 19);">Error:
 no such instruction: </span><span style="font-size: 11pt; font-family: "Calibri", "sans-serif"; color: rgb(200, 38, 19);">...</span><span style="font-size: 11pt; font-family: "Calibri", "sans-serif"; color: rgb(200, 38, 19);">"</span><span style="font-size: 11pt; font-family: "Calibri", "sans-serif"; color: rgb(200, 38, 19);">.
 These messages come from /usr/bin/</span><span style="font-size: 11pt; font-family: "Calibri", "sans-serif"; color: rgb(200, 38, 19);">x86_64-linux-gnu-as</span><span style="font-size:11.0pt; font-family:"Calibri","sans-serif"; color:#1F497D"><br>
</span></p>
<p class="x_MsoNormal" style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: "Times New Roman", "serif";margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: "Times New Roman", "serif";">
<span style="font-size: 11pt; font-family: "Calibri", "sans-serif"; color: rgb(200, 38, 19);">Also note that if I do it this way in 3 steps then the machine code looks right</span></p>
<p class="x_MsoNormal" style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: "Times New Roman", "serif";margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: "Times New Roman", "serif";">
<span style="font-size: 11pt; font-family: "Calibri", "sans-serif"; color: rgb(200, 38, 19);">1) First clang -emit-llvm test.c -o test.bc</span></p>
<p class="x_MsoNormal" style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: "Times New Roman", "serif";margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: "Times New Roman", "serif";">
<span style="font-size: 11pt; font-family: "Calibri", "sans-serif"; color: rgb(200, 38, 19);">2)Then llc -my_triple test.bc -filetype=obj</span></p>
<p class="x_MsoNormal" style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: "Times New Roman", "serif";margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: "Times New Roman", "serif";">
<span style="font-size: 11pt; font-family: "Calibri", "sans-serif"; color: rgb(200, 38, 19);">3)Then llvm-objdump test.o</span></p>
<p class="x_MsoNormal" style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: "Times New Roman", "serif";margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: "Times New Roman", "serif";">
<span style="font-size: 11pt; font-family: "Calibri", "sans-serif"; color: rgb(200, 38, 19);">But I'm trying to do all this with just 1 command</span><span style="font-size:11.0pt; font-family:"Calibri","sans-serif"; color:#1F497D"><br>
</span></p>
<p class="x_MsoNormal" style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: "Times New Roman", "serif";margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: "Times New Roman", "serif";">
<span style="font-size:11.0pt; font-family:"Calibri","sans-serif"; color:#1F497D"><br>
</span></p>
<p class="x_MsoNormal" style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: "Times New Roman", "serif";margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: "Times New Roman", "serif";">
<span style="font-size:11.0pt; font-family:"Calibri","sans-serif"; color:#1F497D">--paulr</span></p>
<p class="x_MsoNormal" style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: "Times New Roman", "serif";margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: "Times New Roman", "serif";">
<a name="x__MailEndCompose"><span style="font-size:11.0pt; font-family:"Calibri","sans-serif"; color:#1F497D"> </span></a></p>
<div style="border:none; border-left:solid blue 1.5pt; padding:0in 0in 0in 4.0pt">
<div>
<div style="border:none; border-top:solid #B5C4DF 1.0pt; padding:3.0pt 0in 0in 0in">
<p class="x_MsoNormal" style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: "Times New Roman", "serif";margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: "Times New Roman", "serif";">
<b><span style="font-size:10.0pt; font-family:"Tahoma","sans-serif"">From:</span></b><span style="font-size:10.0pt; font-family:"Tahoma","sans-serif""> J S [mailto:mm92126@hotmail.com]
<br>
<b>Sent:</b> Tuesday, March 26, 2019 7:42 PM<br>
<b>To:</b> Robinson, Paul<br>
<b>Cc:</b> llvm-dev@lists.llvm.org<br>
<b>Subject:</b> Re: [llvm-dev] Generating object files more efficiently</span></p>
</div>
</div>
<p class="x_MsoNormal" style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: "Times New Roman", "serif";margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: "Times New Roman", "serif";">
 </p>
<div>
<p class="x_MsoNormal" style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: "Times New Roman", "serif";margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: "Times New Roman", "serif";">
<span style="font-family:"Calibri","sans-serif"; color:black">Thanks, Paul.</span></p>
</div>
<div>
<p class="x_MsoNormal" style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: "Times New Roman", "serif";margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: "Times New Roman", "serif";">
<span style="font-family:"Calibri","sans-serif"; color:black">How do I generate the 'as'? When I look at the bin directory , there is an llvm-as that takes llvm assembly as input but no 'as'.</span></p>
</div>
<div class="x_MsoNormal" style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: "Times New Roman", "serif";text-align:center" align="center">
<hr width="98%" size="3" align="center">
</div>
<div id="x_divRplyFwdMsg">
<p class="x_MsoNormal" style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: "Times New Roman", "serif";margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: "Times New Roman", "serif";">
<b><span style="font-size:11.0pt; font-family:"Calibri","sans-serif"; color:black">From:</span></b><span style="font-size:11.0pt; font-family:"Calibri","sans-serif"; color:black"> paul.robinson@sony.com <paul.robinson@sony.com><br>
<b>Sent:</b> Tuesday, March 26, 2019 1:58 PM<br>
<b>To:</b> mm92126@hotmail.com; craig.topper@gmail.com<br>
<b>Cc:</b> llvm-dev@lists.llvm.org<br>
<b>Subject:</b> RE: [llvm-dev] Generating object files more efficiently</span> </p>
<div>
<p class="x_MsoNormal" style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: "Times New Roman", "serif";margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: "Times New Roman", "serif";">
 </p>
</div>
</div>
<div>
<div>
<p class="x_xmsonormal" style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: "Times New Roman", "serif";margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: "Times New Roman", "serif";">
<a name="x_x__MailEndCompose"><span style="font-size:11.0pt; font-family:"Calibri","sans-serif"; color:#1F497D">There isn't an option to specify a particular assembler. You can use `-fno-integrated-as` to tell Clang to run the `as` tool instead of trying to
 generate the object file itself.  If you can't arrange for your target's assembler to be in the right place and named `as` then you have two choices: (1) have Clang emit assembler source with the `-S` option and run the correct assembler directly; (2) support
 your target more thoroughly in Clang's 'Driver' component, so that Clang knows what to do when you specify `-fno-integrated-as`.</span></a></p>
<p class="x_xmsonormal" style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: "Times New Roman", "serif";margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: "Times New Roman", "serif";">
<span style="font-size:11.0pt; font-family:"Calibri","sans-serif"; color:#1F497D">--paulr</span></p>
<p class="x_xmsonormal" style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: "Times New Roman", "serif";margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: "Times New Roman", "serif";">
<span style="font-size:11.0pt; font-family:"Calibri","sans-serif"; color:#1F497D"> </span></p>
<div style="border:none; border-left:solid blue 1.5pt; padding:0in 0in 0in 4.0pt">
<div>
<div style="border:none; border-top:solid #B5C4DF 1.0pt; padding:3.0pt 0in 0in 0in">
<p class="x_xmsonormal" style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: "Times New Roman", "serif";margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: "Times New Roman", "serif";">
<b><span style="font-size:10.0pt; font-family:"Tahoma","sans-serif"">From:</span></b><span style="font-size:10.0pt; font-family:"Tahoma","sans-serif""> llvm-dev [mailto:llvm-dev-bounces@lists.llvm.org]
<b>On Behalf Of </b>J S via llvm-dev<br>
<b>Sent:</b> Tuesday, March 26, 2019 4:39 PM<br>
<b>To:</b> Craig Topper<br>
<b>Cc:</b> llvm-dev@lists.llvm.org<br>
<b>Subject:</b> Re: [llvm-dev] Generating object files more efficiently</span></p>
</div>
</div>
<p class="x_xmsonormal" style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: "Times New Roman", "serif";margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: "Times New Roman", "serif";">
 </p>
<div>
<p class="x_xmsonormal" style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: "Times New Roman", "serif";margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: "Times New Roman", "serif";">
<span style="font-family:"Calibri","sans-serif"; color:black">How do I tell clang to use my target CPU's assembler instead of my host's assembler? I found the -fuse-ld option to tell it to use my linker but didn't find an option for the assembler.</span></p>
</div>
<div>
<p class="x_xmsonormal" style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: "Times New Roman", "serif";margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: "Times New Roman", "serif";">
<span style="font-family:"Calibri","sans-serif"; color:black">Thanks.</span></p>
</div>
<div class="x_MsoNormal" style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: "Times New Roman", "serif";text-align:center" align="center">
<hr width="98%" size="3" align="center">
</div>
<div id="x_x_divRplyFwdMsg">
<p class="x_xmsonormal" style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: "Times New Roman", "serif";margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: "Times New Roman", "serif";">
<b><span style="font-size:11.0pt; font-family:"Calibri","sans-serif"; color:black">From:</span></b><span style="font-size:11.0pt; font-family:"Calibri","sans-serif"; color:black"> llvm-dev <llvm-dev-bounces@lists.llvm.org> on behalf of Craig Topper via llvm-dev
 <llvm-dev@lists.llvm.org><br>
<b>Sent:</b> Monday, March 25, 2019 11:37 AM<br>
<b>To:</b> Alec Ari<br>
<b>Cc:</b> llvm-dev@lists.llvm.org<br>
<b>Subject:</b> Re: [llvm-dev] Generating object files more efficiently</span> </p>
<div>
<p class="x_xmsonormal" style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: "Times New Roman", "serif";margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: "Times New Roman", "serif";">
 </p>
</div>
</div>
<div>
<div>
<div>
<p class="x_xmsonormal" style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: "Times New Roman", "serif";margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: "Times New Roman", "serif";">
There's a function in lib/Driver/ToolChains/CommonArgs.cpp called tools::getCPUName that needs to be implemented for each target to determine how to process -mcpu/-march</p>
</div>
<div>
<p class="x_xmsonormal" style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: "Times New Roman", "serif";margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: "Times New Roman", "serif";">
 </p>
</div>
<div>
<p class="x_xmsonormal" style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: "Times New Roman", "serif";margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: "Times New Roman", "serif";">
You might be able to bypass that for testing purposes by adding "-Xclang -target-cpu -Xclang mycpu" to your driver command line.<br>
<br clear="all">
</p>
<div>
<div>
<p class="x_xmsonormal" style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: "Times New Roman", "serif";margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: "Times New Roman", "serif";">
~Craig</p>
</div>
</div>
<p class="x_xmsonormal" style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: "Times New Roman", "serif";margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: "Times New Roman", "serif";">
 </p>
</div>
</div>
<p class="x_xmsonormal" style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: "Times New Roman", "serif";margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: "Times New Roman", "serif";">
 </p>
<div>
<div>
<p class="x_xmsonormal" style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: "Times New Roman", "serif";margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: "Times New Roman", "serif";">
On Mon, Mar 25, 2019 at 11:24 AM Alec Ari via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>> wrote:</p>
</div>
<blockquote style="border:none; border-left:solid #CCCCCC 1.0pt; padding:0in 0in 0in 6.0pt; margin-left:4.8pt; margin-top:5.0pt; margin-right:0in; margin-bottom:5.0pt">
<p class="x_xmsonormal" style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: "Times New Roman", "serif";margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: "Times New Roman", "serif";">
Hi,<br>
<br>
XYZ is your actual architecture? Are you trolling?<br>
<br>
Alec<br>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a></p>
</blockquote>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>