<html><body><div style="color:#000; background-color:#fff; font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:10pt"><div>Thanks for the valuable suggestion. I have a query further.</div><div><br></div>As per the inputs, I tried creating a scoreboard hazard recognizer which works on MCInst.  <br>The hazard recognizer functions such as EmitInstruction & getHazardType now work on MCInstDesc instead of SUnit. <br><div style="color: rgb(0, 0, 0); font-size: 13.3333px; font-family: HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; background-color: transparent; font-style: normal;">This hazard recognizer has additional scoreboards (apart from using reserved & required scoreboards), to track ' register file's read and write ports availability' for FU to execute an operation which has register operands. <br></div><div style="color: rgb(0, 0, 0); font-size: 13.3333px; font-family:
 HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; background-color: transparent; font-style: normal;">These additional scoreboards are updated, when ports are, 'available and should be reserved' for FU, to execute operation.</div><div style="color: rgb(0, 0, 0); font-size: 13.3333px; font-family: HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; background-color: transparent; font-style: normal;">Thus, I use the scoreboards as tables, which are updated for each MCInst (or MCInstrDesc).
</div><div style="color: rgb(0, 0, 0); font-size: 13.3333px; font-family: HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; background-color: transparent; font-style: normal;"><br></div>
<div>Here I am pre-assume '.s input' is scheduled by programmer and I need not worry about the correctness of schedule. <br></div><div style="color: rgb(0, 0, 0); font-size: 13.3333px; font-family: HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; background-color: transparent; font-style: normal;">I worry about the register port availability only. <br> </div>

<div><br></div><div style="color: rgb(0, 0, 0); font-size: 13.3333px; font-family: HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; background-color: transparent; font-style: normal;">I am considering to use this hazard recognizer to check for whether ports are available for given MCInst execution on a FU.<br><br></div><div style="color: rgb(0, 0, 0); font-size: 13.3333px; font-family: HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; background-color: transparent; font-style: normal;">I am not clear what pitfalls I may land in using this approach ? Or should this approach work good ?<br></div>
<div>Do I need to worry about 'forward execution latency' of next instruction, if it is greater than 1 ? But I am not dealing with scheduling. <br></div>

<div><br></div>
<div>Regards,</div>
<div>Pankaj</div><div><span></span></div><div style="display: block;" class="yahoo_quoted"> <br> <br> <div style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 10pt;"> <div style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 12pt;"> <div dir="ltr"> <font face="Arial" size="2"> On Thursday, March 13, 2014 11:36 AM, Andrew Trick <atrick@apple.com> wrote:<br> </font> </div>  <div class="y_msg_container"><div id="yiv6766262596"><div><br clear="none"><div><div class="yiv6766262596yqt6466248082" id="yiv6766262596yqtfd40067"><div>On Mar 12, 2014, at 4:55 AM, Pankaj Gode <<a rel="nofollow" shape="rect" ymailto="mailto:godepankaj@yahoo.com" target="_blank" href="mailto:godepankaj@yahoo.com">godepankaj@yahoo.com</a>> wrote:</div><br class="yiv6766262596Apple-interchange-newline" clear="none"><blockquote type="cite"><div><div
 style="background-color:rgb(255, 255, 255);font-family:HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;font-size:10pt;"><div>Dear All,</div><div><br clear="none"></div><div style="font-size:13.3333px;font-family:HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;background-color:transparent;font-style:normal;">I am following a flow to generate object files(.o) from input (.s assembly) files. <br clear="none">The input .s is given to AsmParser, which creates MCInst after matching instruction opcode. <br clear="none">These MCInst are converted to MCStream and then finally emitting to an object file using Target Code Emitter.</div><div style="font-size:13.3333px;font-family:HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;background-color:transparent;font-style:normal;"><br clear="none"></div>
<div>I am considering whether hazard recognition can be done on the list of MCInst, which I get after parsing .s file ??</div><div><br clear="none"></div>
<div>The hazard recognition available with LLVM, uses 'scheduling DAG of 
Machine Instructions' and Alias Analysis data for checking dependencies.<br clear="none">In my case, do I need to create a Schedule DAG from MCInst ? And moreover, is is possible to create a schedule DAG this way ?</div><div style="font-size:13.3333px;font-family:HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;background-color:transparent;font-style:normal;"><br clear="none"></div>
<div>I have read about RevGen and other discussions, on creating LLVM IR from object code. <br clear="none">I
 understood that they suggest using a 'code dictionary' to convert to 
LLVM Machine Instruction & then create a CFG from the information 
avaiable.<br clear="none">There are limitation to this as the IR is incomplete, as 
pointed by in paper "A compiler level intermediate representation based 
binary analysis and rewriting system", </div>
<div>mentioned in a discussion here (<a rel="nofollow" shape="rect" target="_blank" href="http://stackoverflow.com/questions/6981810/translation-of-machinecode-into-llvm-ir-disassembly-reassembly-of-x86-64-x86">http://stackoverflow.com/ questions/6981810/translation- of-machinecode-into-llvm-ir- disassembly-reassembly-of-x86- 64-x86</a>).</div><div style="color:rgb(0, 0, 255);font-size:13.3333px;font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;background-color:transparent;font-style:normal;"><br clear="none"></div>
<div>I am not sure whether creating scheduling DAG or some intermediate representation on top of MCInst for Hazard recognition makes sense.<br clear="none">Is suggestion on the right approach ?</div></div></div></blockquote></div></div><br clear="none"><div>I personally think the MachineInstruction IR is right representation the moment you want to work with data dependencies and control flow. i.e. it doesn’t make any sense to add these features on top of MCInst. It’s just unfortunate and accidental that you need to link in all of CodeGen to use MachineInstrs.</div><div><br clear="none"></div><div>That said, the hazard checker doesn’t need this. It just looks up MC-level information and populates a table. The current interface works on SUnits and MachineInstrs because that’s what the scheduler uses. But you could easily roll you own version that works directly from MCInst.</div><div><br clear="none"></div><div>-Andy</div></div></div><br><br></div>
  </div> </div>  </div> </div></body></html>