<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;"><br><div><div>On Jun 26, 2013, at 6:39 AM, Sid Manning <<a href="mailto:sidneym@codeaurora.org">sidneym@codeaurora.org</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 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;">On 06/25/2013 04:46 PM, Jim Grosbach wrote:<br><blockquote type="cite">Hi Sid,<br><br>This feels like it’s exposing too much of the disassembler internals<br>into the MCOperand representation. I’m not sure I follow why that’s<br>necessary. Can you elaborate a bit?<br><br></blockquote>A packet contains 1-4 insns and until the contents of the entire packet are known the meaning of any individual insn is not known with 100% certainty. Adding the auxiliary operand was a way for the printer to accumulate this information as the packet is being read.<br><br>An alternative is to pass the raw insn to the target printer. This would have the same effect, giving the printer the chance to accumulate and interpret the insns when printing the contents of the packet.<br><br>Here are some examples:<br>- Some insns contain a 3-bit new value, the new value bits, Nv[2:1] are set to 1, 2, or 3 if the producer is 1, 2, or 3 insns ahead of the consumer. Nv[0] is 1 if the producer is an odd register, 0 for even.<br> {<br> r17 = add(r2, r17)<br> r23 = add(r23, #-1)<br> if (!cmp.eq(r23.new, #0)) jump:t foobar<br> }<br>The above packet has 2 producers, r17 and r23. If the compare and jump is encoded as: 0x2443e000 where new value bits are stored in [18:16] and equal 0x3 then register 23 would be used - Nv[2:1] == 0x1. The producer was 1 insn back and the register is odd. If bits [18:16] had been 0x5 then register 17 would have been used.<br><br>- Parse bits can be used to designate the end of a hardware loop. If the parsebits are set to 10b in the first insn of the packet then this packet is the end of hardware loop 0, if the parse bits in insn 1 are set to 01b and the parse bits in insn 2 are set to 10b then this is the last packet in hardware loop 1. If the parse bits in insn 1 and insn 2 are both set to 10b then this is then end in both hardware loops 0 and 1. At the tail of the packet the disassembler would add the following:<br> }:endloop0<br> }:endloop1<br> }:endloop0:endloop1<br>to represent the end of the various loops.<br><br>The disassembler has to accumulate the MCInsts for the whole packet and either the raw hex encodings or append the needed info as an operand stored in the MCInst. The reason I tried using MCOperand is that it kept me from having to change objdump itself.<br><br></div></blockquote><div><br></div><div>The representation of a generic MCInst should not need to change. While not exactly what you’re dealing with, the ARM disassembler does have some multi-instruction context it has to maintain to get predicated instructions for Thumb2 correct. In your case, the disassembler will likely need to consume a packet at a time so it has the whole context.</div><div><br></div><div>That is, the printer and encoder shouldn’t have to know any of the context. The disassembler/codegen does all of it.</div><div><br></div><div>-Jim</div><br><blockquote type="cite"><div style="font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 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;">Thanks,<br><br><blockquote type="cite">-Jim<br><br>On Jun 25, 2013, at 8:24 AM, Sid Manning <<a href="mailto:sidneym@codeaurora.org">sidneym@codeaurora.org</a><br><<a href="mailto:sidneym@codeaurora.org">mailto:sidneym@codeaurora.org</a>>> wrote:<br><br><blockquote type="cite"><br>I'm working on a disassembler for hexagon (vliw) architecture and I<br>would like to add an additional operand type, "kAux" to the MCOperand<br>class.<br><br>The reason for this is that each insn has parse bits which are not<br>explicit operands and have differing meanings based on the insn's<br>location within the packet and the number of insns inside the packet.<br>In order for the disassembler to correctly represent the insn it needs<br>to accumulate the series of insns that form the packet. Only when the<br>entire packet is known can the meaning of the parse bits be properly<br>interpreted.<br><br>Changing objdump's interface to printInst so it passes the raw insn<br>bits down would allow the printer to accumulate the same information<br>and would work just as well I think.<br><br>--<br>Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,<br>hosted by The Linux Foundation<br><MCInst.h.diff>_______________________________________________<br>LLVM Developers mailing list<br><a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a><br><<a href="mailto:LLVMdev@cs.uiuc.edu">mailto:LLVMdev@cs.uiuc.edu</a>><a href="http://llvm.cs.uiuc.edu/">http://llvm.cs.uiuc.edu</a><br><<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><br></blockquote><br></blockquote><br><br>--<span class="Apple-converted-space"> </span><br>Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation</div></blockquote></div><br></body></html>