<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>Thank you very much for your help!</div><div><br></div><div>It really works.</div><div><br></div><div>I used to think the two version of the function BuildMI is the same, so I made the mistake.</div><div>I think I understand now:</div><div>BuildMI with a register is to build an instruction with the register provided as a destination,</div><div>and another version without register is to build an instruction without destination.</div><div><br></div><div>Thanks,</div><div>Yang</div><br><div><div>On Jul 24, 2012, at 3:36 AM, Akira Hatanaka wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">It looks like you are not using the right overloaded version of function BuildMI defined in MachineInstrBuilder.h.<br><br>The register operand added to instruction sb should be a use, not a def operand. So this function should be called,<br>
<br>
BuildMI(BB, dl, TII->get(Mips::SB)).addReg(tmpReg1)<br>
<br>instead of<br><br>BuildMI(BB, dl, TII->get(Mips::SB), tmpReg1)<br><br><br><br>
<div class="gmail_quote">On Sat, Jul 21, 2012 at 11:41 AM, Yang Yang <span dir="ltr"><<a href="mailto:geraint0923@gmail.com" target="_blank">geraint0923@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Hi everyone,<br>
<br>
I am trying to expand one instruction into multiple instructions on MIPS.<br>
For example, I try to expand:<br>
sh src, imm(dst)<br>
into:<br>
(1) sb src, imm(dst)<br>
(2) srl reg0, src, 8<br>
(3) sb reg0, (imm+1)(dst)<br>
Here, reg0 are created with createVirtualRegister.<br>
<br>
However, instr(2) will not be emitted because reg0 is useless before reg0 is defined in instr(3), it is wrong!<br>
So how to prevent the expansion from being optimized?<br>
Is there any method to disable register allocate optimization?<br>
<br>
Thanks in advance.<br>
<br>
Yang<br>
<br>
<br>
<br>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:LLVMdev@cs.uiuc.edu" target="_blank">LLVMdev@cs.uiuc.edu</a> <a href="http://llvm.cs.uiuc.edu/" target="_blank">http://llvm.cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
</blockquote></div><br>
</blockquote></div><br></body></html>