<div dir="ltr">It appears that the intended mechanism for extending the AsmStreamer is through the MCTargetStreamer interface:<div><a href="http://llvm.org/docs/doxygen/html/classllvm_1_1MCTargetStreamer.html">http://llvm.org/docs/doxygen/html/classllvm_1_1MCTargetStreamer.html</a><br></div><div><br></div><div>Obviously, that may not be enough flexibility for certain out of tree targets. EmitBytes is pretty similar for all in-tree targets currently. If you can make your target's assembly work through that interface, it'll probably be more stable going forwards.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Jan 22, 2016 at 5:04 AM, Martin J. O'Riordan via llvm-dev <span dir="ltr"><<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-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"><div lang="EN-IE" link="blue" vlink="purple"><div><p class="MsoNormal"><span style="font-family:"Book Antiqua","serif";color:#1f497d">Hi Craig and Rail,<u></u><u></u></span></p><p class="MsoNormal"><span style="font-family:"Book Antiqua","serif";color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-family:"Book Antiqua","serif";color:#1f497d">At Movidius, we have had to make a few changes to ‘</span><span style="font-family:"Courier New","serif";color:black">MCAsmStreamer</span><span style="font-family:"Book Antiqua","serif";color:#1f497d">’ to support our assembler which is not ‘</span><span style="font-family:"Courier New","serif";color:black">gas</span><span style="font-family:"Book Antiqua","serif";color:#1f497d">’ compliant.<u></u><u></u></span></p><p class="MsoNormal"><span style="font-family:"Book Antiqua","serif";color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-family:"Book Antiqua","serif";color:#1f497d">Earlier versions of LLVM (3.1 and 3.2) did have a separate header for ‘</span><span style="font-family:"Courier New","serif";color:black">MCAsmStreamer</span><span style="font-family:"Book Antiqua","serif";color:#1f497d">’, and we had previously sub-classed this.<u></u><u></u></span></p><p class="MsoNormal"><span style="font-family:"Book Antiqua","serif";color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-family:"Book Antiqua","serif";color:#1f497d">The following are modifications that we have had to make because although ‘</span><span style="font-family:"Courier New","serif";color:black">MCAsmStreamer</span><span style="font-family:"Book Antiqua","serif";color:#1f497d">’ does most of what we need, there are some things that we need to do differently, and if this was available to be sub-classed, then these modifications would be more logical and not require altering the target independent code.<u></u><u></u></span></p><p class="MsoNormal"><span style="font-family:"Book Antiqua","serif";color:#1f497d"><u></u> <u></u></span></p><p><u></u><span style="font-family:Symbol;color:#1f497d"><span>·<span style="font:7.0pt "Times New Roman"">         </span></span></span><u></u><span style="font-family:"Book Antiqua","serif";color:#1f497d">‘</span><span style="font-family:"Courier New","serif";color:black">MCAsmStream::EmitAssignment</span><span style="font-family:"Book Antiqua","serif";color:#1f497d">’ has been changed to accommodate our different syntax for ‘</span><span style="font-family:"Courier New","serif";color:black">.alias</span><span style="font-family:"Book Antiqua","serif";color:#1f497d">’ directives.<u></u><u></u></span></p><p><u></u><span style="font-family:Symbol;color:#1f497d"><span>·<span style="font:7.0pt "Times New Roman"">         </span></span></span><u></u><span style="font-family:"Book Antiqua","serif";color:#1f497d">‘</span><span style="font-family:"Courier New","serif";color:black">MCAsmStream::EmitBytes</span><span style="font-family:"Book Antiqua","serif";color:#1f497d">’ has been changed so that multiple lines of ‘</span><span style="font-family:"Courier New","serif";color:black">.byte</span><span style="font-family:"Book Antiqua","serif";color:#1f497d">’ directives are emitted to avoid a line-length buffer limitation in our assembler when very large numbers of bytes are to be emitted.<u></u><u></u></span></p><p><u></u><span style="font-family:Symbol;color:#1f497d"><span>·<span style="font:7.0pt "Times New Roman"">         </span></span></span><u></u><span style="font-family:"Book Antiqua","serif";color:#1f497d">‘</span><span style="font-family:"Courier New","serif";color:black">MCAsmStream::EmitFill</span><span style="font-family:"Book Antiqua","serif";color:#1f497d">’ has been changed to accommodate our different syntax for ‘</span><span style="font-family:"Courier New","serif";color:black">.fill</span><span style="font-family:"Book Antiqua","serif";color:#1f497d">’ directives.<u></u><u></u></span></p><p class="MsoNormal"><span style="font-family:"Book Antiqua","serif";color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-family:"Book Antiqua","serif";color:#1f497d">These are quite simple changes, and since ‘</span><span style="font-family:"Courier New","serif";color:black">MCAsmStreamer</span><span style="font-family:"Book Antiqua","serif";color:#1f497d">’ already does everything else the way we need it, it does not make sense for us to have a completely new alternative implementation of ‘</span><span style="font-family:"Courier New","serif";color:black">MCStreamer</span><span style="font-family:"Book Antiqua","serif";color:#1f497d">’ which effectively clones what this class already does (and it would make it harder for us to mirror changes between releases).  All of these methods are already polymorphic, so overriding the implementation in ‘</span><span style="font-family:"Courier New","serif";color:black">MCAsmStreamer</span><span style="font-family:"Book Antiqua","serif";color:#1f497d">’ would be the best solution for our compiler.<u></u><u></u></span></p><p class="MsoNormal"><span style="font-family:"Book Antiqua","serif";color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-family:"Book Antiqua","serif";color:#1f497d">Thanks,<u></u><u></u></span></p><p class="MsoNormal"><span style="font-family:"Book Antiqua","serif";color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-family:"Book Antiqua","serif";color:#1f497d">            MartinO<u></u><u></u></span></p><p class="MsoNormal"><span style="font-family:"Book Antiqua","serif";color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><b><span lang="EN-US" style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span lang="EN-US" style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> llvm-dev [mailto:<a href="mailto:llvm-dev-bounces@lists.llvm.org" target="_blank">llvm-dev-bounces@lists.llvm.org</a>] <b>On Behalf Of </b>Craig Topper via llvm-dev<br><b>Sent:</b> 22 January 2016 6:08<br><b>To:</b> Rail Shafigulin<br><b>Cc:</b> llvm-dev<br><b>Subject:</b> Re: [llvm-dev] Is there a reason why MCAsmStreamer class doesn't have its own .h file?<u></u><u></u></span></p><div><div class="h5"><p class="MsoNormal"><u></u> <u></u></p><div><p class="MsoNormal">At least one of the callers would be from the .align directive which I assume you wouldn't want to overload. Where does it come from DataLayout? AsmStreamer is used for assembling from text and I wouldn't expect that to use DataLayout. Or is it used for inline assembly?<u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p><div><p class="MsoNormal">On Thu, Jan 21, 2016 at 5:25 PM, Rail Shafigulin <<a href="mailto:rail@esenciatech.com" target="_blank">rail@esenciatech.com</a>> wrote:<u></u><u></u></p><div><p class="MsoNormal"><u></u> <u></u></p><div><p class="MsoNormal"><u></u> <u></u></p><div><p class="MsoNormal">On Thu, Jan 21, 2016 at 5:03 PM, Craig Topper <<a href="mailto:craig.topper@gmail.com" target="_blank">craig.topper@gmail.com</a>> wrote:<u></u><u></u></p><div><p class="MsoNormal">I dont' know why its final. That routine is just a method to force the current write pointer to a specific alignment. Shouldn't you be changing the callers to give you the alignment you want or don't want.<u></u><u></u></p></div><div><div><div><p class="MsoNormal"><br><br clear="all"><u></u><u></u></p><div><p class="MsoNormal"><u></u> <u></u></p></div></div></div><p class="MsoNormal"><span style="color:#888888">-- <u></u><u></u></span></p><div><p class="MsoNormal"><span style="color:#888888">~Craig<u></u><u></u></span></p></div></div></div><p class="MsoNormal"><br>It looks like the callers get their information from the data layout object, which in my case is not what I need. Any suggestions?<br clear="all"><u></u><u></u></p><div><p class="MsoNormal"><u></u> <u></u></p></div><p class="MsoNormal">-- <u></u><u></u></p><div><div><div><div><div><p class="MsoNormal">Rail Shafigulin<u></u><u></u></p></div><p class="MsoNormal">Software Engineer <br>Esencia Technologies<u></u><u></u></p></div></div></div></div></div></div></div><p class="MsoNormal"><br><br clear="all"><u></u><u></u></p><div><p class="MsoNormal"><u></u> <u></u></p></div><p class="MsoNormal">-- <u></u><u></u></p><div><p class="MsoNormal">~Craig<u></u><u></u></p></div></div></div></div></div></div><br>_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
<br></blockquote></div><br></div>