Sorry, I forgot to attach the patch ... :(<div><br></div><div>Zonr</div><div><br><br><div class="gmail_quote">2010/5/21 Zonr Chang <span dir="ltr"><<a href="mailto:zonr.xchg@gmail.com">zonr.xchg@gmail.com</a>></span><br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div class="im"><span style="font-family:arial, sans-serif;font-size:13px;border-collapse:collapse">Thanks for your patch review (and also to Anton.) <div>

<br></div><div>How to reuse the movw/movt logic is indeed a problem. PR7048 is an example. To fix this bug, we need to insert more codes into function emitDataProcessingInstruction(...) (see attachment.)</div>
<div><br></div><div>It is because, precisely, the previous patch (arm-jit-movt-and-movw.patch) implemented the pseudo instruction ARM::MOVi32imm (which according to ARMInstrInfo.td should be materialized to movw/movt pair.) However, there's a case to use movw or movt as a single instruction to move value and their materialization will route to emitDataProcessingInstruction() since both movw (opcode ARM::MOVTi16) and movt (opcode ARM::MOVi16) are data processing instructions (i.e. ARMII::DPFrm.) </div>


<div><br></div><div>In PR7048, the "1001" to printf(...) will be moved to the register using single instruction movw. As you can see in this patch, the logic to encode the immediate is reused the third time (one in emitDataProcessingInstruction(...) and one in relocation codes.)</div>


<div><br></div><div>Is there a way to reuse the encoding codes?</div><div><br></div><div><br></div><div>Zonr</div></span></div>
</blockquote></div><br></div>