<div dir="ltr">Hi,<div><br></div><div>That's what the DecoderMethod is for. Similarly ParserMatchClass for the asm parser and PrintMethod for the asm printer:</div><div><br></div><div><div>def CondCodeOperand : AsmOperandClass { let Name = "CondCode"; }</div><div>def pred : PredicateOperand<OtherVT, (ops i32imm, i32imm),</div><div>                                     (ops (i32 14), (i32 zero_reg))> {</div><div>  let PrintMethod = "printPredicateOperand";</div><div>  let ParserMatchClass = CondCodeOperand;</div><div>  let DecoderMethod = "DecodePredicateOperand";</div><div>}</div></div><div><br></div><div>James</div></div><br><div class="gmail_quote"><div dir="ltr">On Mon, 14 Dec 2015 at 13:44 Sky Flyer <<a href="mailto:skylake007@googlemail.com">skylake007@googlemail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div><div>But one question!<br><br></div>imagine I define <b>cond</b> as a type of Xpred (Xpred:$cond)<br></div>and in the instruction, for instance <b>bits<6> cond</b>.<br></div>How can I assign the first i32imm to the 4 MSB of cond and the second i32imm to the 2 LSB? :-/<br><br></div><div>Now:<br></div><div><br>Xpred:$cond<br>bits<6> cond;<br></div><div>Inst{5-0} = cond;<br><br></div><div>Desired:<br></div><div><br>Xpred:$cond;<br></div><div>bits<6> cond;<br></div><div>Inst{5-2} = cond.ops[0];<br></div><div>Inst{1-0} = cond.ops[1];<br></div><div><br><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Dec 14, 2015 at 12:24 PM, Sky Flyer <span dir="ltr"><<a href="mailto:skylake007@googlemail.com" target="_blank">skylake007@googlemail.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"><div>Hello James,<br><br></div>that was also what I've planned to do but just wasn't sure. Thanks for that. <br><br></div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Dec 14, 2015 at 11:52 AM, James Molloy <span dir="ltr"><<a href="mailto:james@jamesmolloy.co.uk" target="_blank">james@jamesmolloy.co.uk</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">Hi,<div><br></div><div>You can't nest operands like that - it must be a flattened list. So:</div><div><br></div><div>def <b>Xpred</b> : PredicateOperand<OtherVT, (ops <b>i32imm, i32imm</b>, i32imm),<span><br><div style="margin-left:280px">(ops (i32 14), (i32 zero_reg))> {...}</div></span></div></div><br><div class="gmail_quote"><div><div><div dir="ltr">On Mon, 14 Dec 2015 at 10:21 Sky Flyer via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>> wrote:<br></div></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div><div dir="ltr"><div><div><div><div><div><div><div><div><div>Hi All,<br><br></div>In ARMInstFormats.td predicate is defined this way:<br><br></div><br></div><i>def pred : PredicateOperand<OtherVT, (ops i32imm, i32imm),<br></i></div><div style="margin-left:280px"><i>(ops (i32 14), (i32 zero_reg))> {...}</i><br><br></div><br></div>I use the same definition in my code. But I have another version of predicate which is exactly the same but it is a condition code plus a quantifier! (e.g. Xpred = (pred + i32imm)).<br><br></div>I was wondering how we can define a sub sub operand, something like this:<br><br>def <b>Xpred</b> : PredicateOperand<OtherVT, (ops <b>pred</b>, i32imm),<br><div style="margin-left:280px">(ops (i32 14), (i32 zero_reg))> {...}<br></div><br></div>I don't know how clear I explained, but can someone recommend a solution?<br><br></div>Cheers,<br></div>ES<br><div><div><div><br><br></div></div></div></div></div></div>
_______________________________________________<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/mailman/listinfo/llvm-dev</a><br>
</blockquote></div>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div>
</blockquote></div>