<div dir="ltr">Thanks for the explanation and the suggestion, Craig. I will try it out.<div><br></div><div>Bharadwaj</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Feb 9, 2018 at 1:29 PM, Craig Topper <span dir="ltr"><<a href="mailto:craig.topper@gmail.com" target="_blank">craig.topper@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">I think even if we did use it, MoveImmediate is intended for instructions that move an immediate into a register rather than into memory. It's supposed to indicate instructions that can be folded with the user of the register by changing the user to an immediate instruction. And it wouldn't be set on an instruction like "addl $0, %eax" or "addl $0, (%ecx)" either since those aren't moves.<div><br></div><div>For X86 you can try using "X86II::hasImm(MI.getDesc().<wbr>TSFlags)" that's what the encoder uses to determine if there's an immediate to encode at the end of the instruction encoding.<span class="HOEnZb"><font color="#888888"><br><div><br></div><div><br></div></font></span></div></div><div class="gmail_extra"><span class="HOEnZb"><font color="#888888"><br clear="all"><div><div class="m_3754952604057637988gmail_signature" data-smartmail="gmail_signature">~Craig</div></div></font></span><div><div class="h5">
<br><div class="gmail_quote">On Fri, Feb 9, 2018 at 1:13 PM, S. Bharadwaj Yadavalli <span dir="ltr"><<a href="mailto:bharadwajy@gmail.com" target="_blank">bharadwajy@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">I am trying to categorize the machine instructions based on associated static (i.e., as encoded in .td file) machine description and the corresponding APIs.<div>I would like to perform appropriate actions based on the kind of instruction in a tool that I am working on. </div><div><br></div><div>For example, I'd like to distinguish between memop instructions involving immediate vs register. While it appears that I would be able to accomplish this by rummaging through the instruction operands, a combination of the flag(s) MayLoad/MayStore and MoveImm seemed attractive/clean/efficient(?), if the instruction description did indeed use the flags.</div><div><br></div><div>Hence the question.</div><div><br></div><div>Thanks,</div><div><br></div><div>Bharadwaj</div></div><div class="m_3754952604057637988HOEnZb"><div class="m_3754952604057637988h5"><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Feb 9, 2018 at 12:17 PM, Craig Topper <span dir="ltr"><<a href="mailto:craig.topper@gmail.com" target="_blank">craig.topper@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">That flag is specifically used by the foldImmediate optimization in the Peephole pass. We don't implement the TLI foldImmediate hook the peephole pass uses on x86 so we have no reason to set the flag on any instructions<div><br></div><div>What are you trying to do?</div></div><div class="gmail_extra"><br clear="all"><div><div class="m_3754952604057637988m_841928396393502724m_-1940651217807950812gmail_signature" data-smartmail="gmail_signature">~Craig</div></div>
<br><div class="gmail_quote"><div><div class="m_3754952604057637988m_841928396393502724h5">On Fri, Feb 9, 2018 at 11:45 AM, S. Bharadwaj Yadavalli via llvm-dev <span dir="ltr"><<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="m_3754952604057637988m_841928396393502724h5"><div dir="ltr">Hi,<div><br></div><div>I had (naively?) expected that the instruction to move immediate to register or memory (such as MOV32mi, MOV32ri, MOV64mi32, MOV64ri, MOV64ri32) would be marked with the flag MCID::MovImm via the X86InstrInfo.td (and hence in the generated X86GenInstrInfo.inc).</div><div><br></div><div>I do not see that to be the case.</div><div><br></div><div>Can someone please tell me if my expectation is flawed? Is there a better/different way to determine to test for move immediate to register/memory instruction on X86 other that the existing interface MCID::isMoveImmediate()?</div><div><br></div><div>Thanks,</div><div><br></div><div>Bharadwaj</div><div><br></div></div>
<br></div></div>______________________________<wbr>_________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/llvm-dev</a><br>
<br></blockquote></div><br></div>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div></div></div>
</blockquote></div><br></div>