<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">Hi Jafar,<div><br></div><div>That’s not quite what I meant. Why do you need to know the exact encoding at all? The instruction opcode+operands should have all the semantic information you need without ever looking at the actual encoding.</div><div><br></div><div>-Jim</div><div><br><div><div>On May 30, 2013, at 11:08 AM, Jafar J <<a href="mailto:pluck90@hotmail.com">pluck90@hotmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div dir="ltr" style="letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div dir="ltr"><div style="font-family: Calibri; font-size: 12pt;"><div>Yes your absolutely right, the Opcode and the Operands in each machine instruction are sufficient to generate the final binary representation of the MachineInstruction but not exactly. If you take a look at the format of each MIPS instruction, you’ll see that there are some fixed bits for each instruction which are not available inside the machine instruction object –From what I saw so far-. Furthermore, how will I know how to map each operand to its right place i.e. rt, rd, rs, immediate, offset, etc.., without knowing the semantic of the instruction and the physical numbering of each register, to finally generate the complete 32-bit encoding.</div><div> </div><div>MachineInstr::getOpcode() for a register operand returns an enum value that doesn’t represent the actual physical numbering of the register, to know what register this returned value represents I should refer to MipsGenRegisterInfo.td, that’s where I think the mapping happens.</div><div> </div><div>However, inside the MipsCodeEmitter class there is a method that returns the binary encoding of the machine instruction (uint64_t MipsCodeEmitter::getBinaryCodeForInstr(const MachineInstr &MI)). That’s why I thought about activating the code emitter during post-ra would solve my problem if that’s even possible.</div><div> </div><div>Thanks,</div><div>    - Jafar J.</div><div style="font-style: normal; display: inline; font-family: Calibri; font-size: small; font-weight: normal; text-decoration: none;"><div style="font-style: normal; font-variant: normal; font-weight: normal; font-size: 10pt; line-height: normal; font-family: tahoma;"><div><font size="3" face="Calibri"></font> </div><div style="background-color: rgb(245, 245, 245); background-position: initial initial; background-repeat: initial initial;"><div><b>From:</b><span class="Apple-converted-space"> </span><a title="grosbach@apple.com" href="mailto:grosbach@apple.com">Jim Grosbach</a></div><div><b>Sent:</b><span class="Apple-converted-space"> </span>Thursday, May 30, 2013 8:49 PM</div><div><b>To:</b><span class="Apple-converted-space"> </span><a title="pluck90@hotmail.com" href="mailto:pluck90@hotmail.com">Jafar J</a></div><div><b>Cc:</b><span class="Apple-converted-space"> </span><a title="llvmdev@cs.uiuc.edu" href="mailto:llvmdev@cs.uiuc.edu">llvmdev@cs.uiuc.edu</a><span class="Apple-converted-space"> </span>;<span class="Apple-converted-space"> </span><a title="llvmdev@cs.uiuc.edu" href="mailto:llvmdev@cs.uiuc.edu">Mailing List</a></div><div><b>Subject:</b><span class="Apple-converted-space"> </span>Re: [LLVMdev] Activating MIPS Code Emitter.</div></div></div><div> </div></div><div style="font-style: normal; display: inline; font-family: Calibri; font-size: small; font-weight: normal; text-decoration: none;"><div> </div><div> </div>Thanks, that helps. The code emitter is definitely not the way you want to go about solving this problem, though. Are the instruction opcode (MachineInstr::getOpcode()) and the operand values not sufficient? All the information present in the encoding should be inferable from those, as that’s where the encoding comes from.<div> </div><div>-Jim<br><div><div> </div><div> </div><div><div> </div><div><div>On May 30, 2013, at 10:12 AM, Jafar J <<a href="mailto:pluck90@hotmail.com">pluck90@hotmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div dir="ltr" style="text-transform: none; text-indent: 0px; word-wrap: break-word; white-space: normal; letter-spacing: normal; word-spacing: 0px; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; -webkit-text-stroke-width: 0px;"><div dir="ltr"><div style="font-family: calibri; font-size: 12pt;"><div><div style="font-style: normal; display: inline; font-family: calibri; font-size: small; font-weight: normal; text-decoration: none;"><font size="3" face="Calibri">I need to represent each instruction with its (32-bit) binary encoding, and I reached to a conclusion that I could get the encoding through the MipsCodeEmitter. What I’m trying to do exactly is write a scheduler which tries to minimize the switching activity between the scheduled instructions in each basic block. One way to do that is by representing each instruction with its complete binary encoding, which will be available after the register allocation.</font></div></div><div><div style="font-style: normal; display: inline; font-family: calibri; font-size: small; font-weight: normal; text-decoration: none;"> </div></div><div><div style="font-style: normal; display: inline; font-family: calibri; font-size: small; font-weight: normal; text-decoration: none;">Thanks for the reply!</div></div><div><div style="font-style: normal; display: inline; font-family: calibri; font-size: small; font-weight: normal; text-decoration: none;"> </div></div><div><div style="font-style: normal; display: inline; font-family: calibri; font-size: small; font-weight: normal; text-decoration: none;">-Jafar J</div><div style="font-style: normal; font-variant: normal; font-weight: normal; font-size: 10pt; line-height: normal; font-family: tahoma;"><div><font size="3" face="Calibri"></font> </div><div style="background-color: rgb(245, 245, 245);"><div><b>From:</b><span class="Apple-converted-space"> </span><a title="grosbach@apple.com" href="mailto:grosbach@apple.com">Jim Grosbach</a></div><div><b>Sent:</b><span class="Apple-converted-space"> </span>Thursday, May 30, 2013 7:55 PM</div><div><b>To:</b><span class="Apple-converted-space"> </span><a title="pluck90@hotmail.com" href="mailto:pluck90@hotmail.com">Jafar J</a></div><div><b>Cc:</b><span class="Apple-converted-space"> </span><a title="llvmdev@cs.uiuc.edu" href="mailto:llvmdev@cs.uiuc.edu">llvmdev@cs.uiuc.edu</a><span class="Apple-converted-space"> </span>;<span class="Apple-converted-space"> </span><a title="llvmdev@cs.uiuc.edu" href="mailto:llvmdev@cs.uiuc.edu">Mailing List</a></div><div><b>Subject:</b><span class="Apple-converted-space"> </span>Re: [LLVMdev] Activating MIPS Code Emitter.</div></div></div><div> </div></div><div style="font-style: normal; display: inline; font-family: calibri; font-size: small; font-weight: normal; text-decoration: none;">What are you actually trying to do? The code emitters have nothing to do with the post-RA scheduler.<div> </div><div>-Jim</div><div><div> </div><div><div>On May 30, 2013, at 6:23 AM, Jafar J <<a href="mailto:pluck90@hotmail.com">pluck90@hotmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div dir="ltr" style="text-transform: none; text-indent: 0px; white-space: normal; letter-spacing: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div dir="ltr"><div style="font-family: calibri; font-size: 12pt;"><div>Hello,</div><div></div><div>    Is it possible to activate the MIPS code emitter during Post-RA scheduler. I tried including both MipsCodeEmitter.cpp and JITCodeEmitter.h to PostRASchedulerList.cpp, but when I rebuild the compiler I get an error that says “/lib/Target/Mips/MCTargetDesc/MipsMCTargetDesc.h fatal error: MipsGenRegisterInfo.inc file not found”. I’m assuming that the MipsGenRegisterInfo.inc is not yet generated when I’m trying to include it in the PostRAScheduler. Is this the way to activate the mipsCodeEmitter during PostRA Scheduler or am I missing something here.</div><div> </div><div>Thanks,</div><div>    Jafar J.</div></div></div>_______________________________________________<br>LLVM Developers mailing list<br><a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a><span class="Apple-converted-space"> </span>      <span class="Apple-converted-space"> </span><span class="Apple-converted-space"> </span><a href="http://llvm.cs.uiuc.edu/">http://llvm.cs.uiuc.edu</a><br><a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a></div></blockquote></div><div> </div></div></div></div></div>_______________________________________________<br>LLVM Developers mailing list<br><a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a><span class="Apple-converted-space"> </span>       <span class="Apple-converted-space"> </span><a href="http://llvm.cs.uiuc.edu/">http://llvm.cs.uiuc.edu</a><br><a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a></div></blockquote></div></div></div></div></div></div></div></div></blockquote></div><br></div></body></html>