Hi Jim,<div><br></div><div>  I have figured out the problem.  It seems that we have different code base.  There's a not-ready-to-submit commit</div><div>in our repository which will call emitLoadStoreMultipleInstruction and emitMiscBranchInstruction from emitPseudoInstruction.</div>
<div>So I think this patch is no longer needed.  Sorry for the disturbance.  Thanks for your reply.</div><div><br></div><div>Sincerely,</div><div>- Logan</div><div><br><div class="gmail_quote">On Sat, Jul 23, 2011 at 8:33 AM, Jim Grosbach <span dir="ltr"><<a href="mailto:grosbach@apple.com">grosbach@apple.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div style="word-wrap:break-word"><div>Hi Logan,</div><div><br></div>Where do you see the call to getBinaryCodeForInstr() coming from? The pass begins in runOnMachineFunction(), which calls emitInstruction() for each instruction in each basic block. emitInstruction() proceeds like:<div>
<div><div><br></div><div>void ARMCodeEmitter::emitInstruction(const MachineInstr &MI) {</div><div>  DEBUG(errs() << "JIT: " << (void*)MCE.getCurrentPCValue() << ":\t" << MI);</div>
<div><br></div><div>  MCE.processDebugLoc(MI.getDebugLoc(), true);</div><div><br></div><div>  ++NumEmitted;  // Keep track of the # of mi's emitted</div><div>  switch (MI.getDesc().TSFlags & ARMII::FormMask) {</div>
<div>...</div><div>  case ARMII::Pseudo:</div><div>    emitPseudoInstruction(MI);</div><div>    break;</div><div>…</div><div><br></div><div>Note that there is at no point a call to getBinaryCodeForInstr() before the call to emitPseudoInstruction(). You're probably seeing calls to getBinaryCodeForInstr() due to pseudo-instructions that are being handled incorrectly in the CodeEmitter during emitPseudoInstruction(). Those are bugs in the CodeEmitter, not a failure of how pseudos are defined. Patches to fix those bugs would be very welcome.</div>
<div><br></div><font color="#888888"><div>-Jim</div></font><div><div></div><div class="h5"><div><br></div><div><div>On Jul 22, 2011, at 5:12 PM, Logan Chien wrote:</div><br><blockquote type="cite"><div>Hi,</div><div><br></div>
  I agree with you that pseudos are handled (and encoded) in ARMCodeEmitter::emitPseudoInstruction.<div>But unfortunately, emitPseudoInstruction will try to call CodeEmitter::getBinaryCodeForInstr first, then</div>
<div>getBinaryCodeForInstr will report a fatal error.  That's why I tried to add new 'case' (though we are doing</div><div>nothing in getBinaryCodeForInstr.)  You may trace the control flow while emitting LDMIA_RET or B,</div>

<div>and you will see why this patch is essential.  Thanks.</div><div><br></div><div>Sincerely,</div><div>Logan</div><div><br><div class="gmail_quote">On Fri, Jul 22, 2011 at 11:40 PM, Jim Grosbach <span dir="ltr"><<a href="mailto:grosbach@apple.com" target="_blank">grosbach@apple.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">This isn't what you want to do. The reason pseudos are excluded is that they don't have any binary information to emit. Adding them to the getBinaryCodeForInstr() won't help, as it won't return any bits of the instruction anyway.<div>

<br></div><div>Pseudos are handled in ARMCodeEmitter::emitPseudoInstruction(), and that function is required to fill in all required bits for the instruction(s) the pseudo expands to.</div><div><br></div><div>-Jim<br><div>

<br><div><div><div></div><div><div>On Jul 21, 2011, at 7:27 PM, Logan Chien wrote:</div><br></div></div><blockquote type="cite"><div><div></div><div>Dear all,<div><br></div><div>  With commit r134539, the CodeEmitter backend of TableGen will not generate case for</div>

<div>pseudo instruction.  It seems that r134539 assumed that the pseudo instruction will</div><div>
be lowered before calling CodeEmitter::getBinaryCodeForInstr.  Thus, getBinaryCodeForInstr</div><div>will report a fatal error if it gets a pseudo instruction.</div><div><br></div><div>  However, ARMCodeEmitter does not lower the pseudo instruction before calling</div>



<div>getBinaryCodeForInstr, and ARMCodeEmitter will no longer work after r134539.</div><div>With this patch, we will generate case for pseudo instruction for CodeEmitter (but not</div><div>MCCodeEmitter) just like what was done before.</div>


<div><br></div><div>  Please review.  Thanks!</div><div><br></div><div>Sincerely,</div><div style="text-align:right">Logan</div>
</div></div><span><0001-Fix-ARMCodeEmitter-pseudo-instruction-encoder.patch></span>_______________________________________________<br>llvm-commits mailing list<div><br><a href="mailto:llvm-commits@cs.uiuc.edu" target="_blank">llvm-commits@cs.uiuc.edu</a><br>

</div><a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br></blockquote></div><br></div></div></div>
</blockquote></div><br></div>
</blockquote></div><br></div></div></div></div></div></blockquote></div><br></div>