<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 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
span.EmailStyle19
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
.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="#0563C1" vlink="#954F72">
<div class="WordSection1">
<p class="MsoNormal">There isn’t any target-independent code to help form VLIW instruction words, so you’ll have to write code for your specific target to do that.  Since it’s target-specific code, you can do whatever transforms are appropriate, including rewriting
 instruction opcodes.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">LLVM supports the notion of a “bundle”, which might be helpful.  It’s a set of multiple instructions which is treated as one instruction by various backend passes.  This allows representing the different parts of a VLIW instruction word
 as separate instructions, but allows passes that don’t understand your target-specific bundles to treat it as one big instruction.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">In-tree, you can look at the Hexagon backend to see how this works in practice.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">-Eli<o:p></o:p></p>
<p class="MsoNormal"><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 #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b>From:</b> llvm-dev <llvm-dev-bounces@lists.llvm.org> <b>On Behalf Of
</b>Ronny BarTov via llvm-dev<br>
<b>Sent:</b> Sunday, January 19, 2020 1:38 AM<br>
<b>To:</b> llvm-dev@lists.llvm.org<br>
<b>Subject:</b> [EXT] [llvm-dev] extending LLVM<o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><span style="font-size:12.0pt">Hello,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt">in vliw architectures, the behavior of a machine command is fixed in whatever vliw it is included.
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt">In some cases, however, the appearance of some other specific commands within the same vliw, affects the behavior of the original command,
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt">or define a new way of operation such that the entire behavior of the vliw can no longer be considered as the cumulative effect of the individual, separate, commands.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt">examples for the above might be:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt">- allowing more than a single CC (condition code) changing command  to be present in the same vliw. a possible definition for such a case<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt">  might be to set the new CC to the logical OR of all the new values from the commands in the vliw that write to the CC.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt">- forcing specific execution units.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt">  suppose both I1 and I2 commands can be assigned to functional units<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt">  FU1 or FU2. we might insist that whenever I1 and I2 are in the same vliw,  then I1 must go to FU1 while I2 must go to FU2.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt">- two instructions can normally have a long encoding, but might use a combined,  shorter encoding that would make them fit together inside a single vliw.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt">Is there a systematic way to handle such cases in LLVM  ?<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt">Thx<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt">ronny<o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</div>
</body>
</html>