<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 14 (filtered medium)">
<!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p
        {mso-style-priority:99;
        margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
p.xmsonormal, li.xmsonormal, div.xmsonormal
        {mso-style-name:x_msonormal;
        margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
p.xxmsonormal, li.xxmsonormal, div.xxmsonormal
        {mso-style-name:x_xmsonormal;
        margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
span.EmailStyle20
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><a name="_MailEndCompose"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">I see that in your first command, you don't supply the triple:<o:p></o:p></span></a></p>
<p class="xmsonormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#C82613">1) First clang -emit-llvm test.c -o test.bc</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">but you do supply it in the second command:<o:p></o:p></span></p>
<p class="xmsonormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#C82613">2)Then llc -my_triple test.bc -filetype=obj</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Is this an oversight, or have you been omitting the triple when you run Clang?<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Do I understand correctly that when you do "clang –target my_triple –c test.c" then the wrong things happen?<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">If the wrong things happen when you give Clang your triple, that suggests that you have the LLVM part hooked up correctly for your target but not the Clang
 part. Clang, separately from LLVM, needs to know some things about your triple and pass information down to LLVM. This is partly in the Basic and partly in the Driver libraries within Clang.  I've never personally added a new target so I am fuzzy on the details,
 but if you start looking around in those areas you will probably get a better idea of what is needed.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">--paulr<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></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="MsoNormal"><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> Wednesday, March 27, 2019 11:56 AM<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<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div class="MsoNormal" align="center" style="text-align:center">
<hr size="3" width="98%" align="center">
</div>
<div>
<div>
<p class="xmsonormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"> </span><o:p></o:p></p>
<p class="xmsonormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Paul,</span><o:p></o:p></p>
<p class="xmsonormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">My answers are in red.</span><o:p></o:p></p>
<p class="xmsonormal"><o:p> </o:p></p>
<p class="xmsonormal"><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><o:p></o:p></p>
<p class="xmsonormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#C82613">This is what I meant</span><o:p></o:p></p>
<p class="xmsonormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"> </span><o:p></o:p></p>
<p class="xmsonormal"><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:11.0pt;font-family:"Calibri","sans-serif";color:#C82613">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><o:p></o:p></p>
<p class="xmsonormal"><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><o:p></o:p></p>
<p class="xmsonormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#C82613">For every instruction in my .s file, there is a message that says "Error: no such instruction: ...". These messages come from /usr/bin/x86_64-linux-gnu-as</span><o:p></o:p></p>
<p class="xmsonormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#C82613">Also note that if I do it this way in 3 steps then the machine code looks right</span><o:p></o:p></p>
<p class="xmsonormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#C82613">1) First clang -emit-llvm test.c -o test.bc</span><o:p></o:p></p>
<p class="xmsonormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#C82613">2)Then llc -my_triple test.bc -filetype=obj</span><o:p></o:p></p>
<p class="xmsonormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#C82613">3)Then llvm-objdump test.o</span><o:p></o:p></p>
<p class="xmsonormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#C82613">But I'm trying to do all this with just 1 command</span><o:p></o:p></p>
<p class="xmsonormal"><o:p> </o:p></p>
<p class="xmsonormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">--paulr</span><o:p></o:p></p>
<p class="xmsonormal"><a name="x__MailEndCompose"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"> </span></a><o:p></o:p></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="xmsonormal"><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><o:p></o:p></p>
</div>
</div>
<p class="xmsonormal"> <o:p></o:p></p>
<div>
<p class="xmsonormal"><span style="font-family:"Calibri","sans-serif";color:black">Thanks, Paul.</span><o:p></o:p></p>
</div>
<div>
<p class="xmsonormal"><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><o:p></o:p></p>
</div>
<div class="MsoNormal" align="center" style="text-align:center">
<hr size="3" width="98%" align="center">
</div>
<div id="x_divRplyFwdMsg">
<p class="xmsonormal"><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> <o:p>
</o:p></p>
<div>
<p class="xmsonormal"> <o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="xxmsonormal"><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><o:p></o:p></p>
<p class="xxmsonormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">--paulr</span><o:p></o:p></p>
<p class="xxmsonormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"> </span><o:p></o:p></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="xxmsonormal"><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><o:p></o:p></p>
</div>
</div>
<p class="xxmsonormal"> <o:p></o:p></p>
<div>
<p class="xxmsonormal"><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><o:p></o:p></p>
</div>
<div>
<p class="xxmsonormal"><span style="font-family:"Calibri","sans-serif";color:black">Thanks.</span><o:p></o:p></p>
</div>
<div class="MsoNormal" align="center" style="text-align:center">
<hr size="3" width="98%" align="center">
</div>
<div id="x_x_divRplyFwdMsg">
<p class="xxmsonormal"><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> <o:p>
</o:p></p>
<div>
<p class="xxmsonormal"> <o:p></o:p></p>
</div>
</div>
<div>
<div>
<div>
<p class="xxmsonormal">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<o:p></o:p></p>
</div>
<div>
<p class="xxmsonormal"> <o:p></o:p></p>
</div>
<div>
<p class="xxmsonormal">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">
<o:p></o:p></p>
<div>
<div>
<p class="xxmsonormal">~Craig<o:p></o:p></p>
</div>
</div>
<p class="xxmsonormal"> <o:p></o:p></p>
</div>
</div>
<p class="xxmsonormal"> <o:p></o:p></p>
<div>
<div>
<p class="xxmsonormal">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:<o:p></o:p></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="xxmsonormal">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><o:p></o:p></p>
</blockquote>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>