<div dir="ltr"><div class="markdown-here-wrapper" style><p style="margin:1.2em 0px!important">As you suggested, it is based on the order of the declarations of the variables in the class, and the order they are listed in the TableGen file.</p>
<p style="margin:1.2em 0px!important">See <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_docs_WritingAnLLVMBackend.html-23instruction-2Doperand-2Dmapping&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=Mfk2qtn1LTDThVkh6-oGglNfMADXfJdty4_bhmuhMHA&m=aKIa5aCh0c6T9XmFw-F3zmeUoUUGGFkNMyn8FzYikNg&s=kvTJfR5WD9-ubtJlcLCjnmlNrfCbkrxjJjzPnAmFE5c&e=">Writing an LLVM Backend/Instruction operand mapping</a>.</p>
<blockquote style="margin:1.2em 0px;border-left-width:4px;border-left-style:solid;border-left-color:rgb(221,221,221);padding:0px 1em;color:rgb(119,119,119);quotes:none">
<p style="margin:1.2em 0px!important">Operands are assigned to unbound fields in the instruction in the order they are defined. Fields are bound when they are assigned a value.</p>
</blockquote>
<div title="MDH:QXMgeW91IHN1Z2dlc3RlZCwgaXQgaXMgYmFzZWQgb24gdGhlIG9yZGVyIG9mIHRoZSBkZWNsYXJh
dGlvbnMgb2YgdGhlIHZhcmlhYmxlcyBpbiB0aGUgY2xhc3MsIGFuZCB0aGUgb3JkZXIgdGhleSBh
cmUgbGlzdGVkIGluIHRoZSBUYWJsZUdlbiBmaWxlLjxkaXY+PGJyPjwvZGl2PjxkaXY+U2VlIFtX
cml0aW5nIGFuIExMVk0gQmFja2VuZC9JbnN0cnVjdGlvbiBvcGVyYW5kIG1hcHBpbmddKGh0dHA6
Ly9sbHZtLm9yZy9kb2NzL1dyaXRpbmdBbkxMVk1CYWNrZW5kLmh0bWwjaW5zdHJ1Y3Rpb24tb3Bl
cmFuZC1tYXBwaW5nKS48L2Rpdj48ZGl2Pjxicj48L2Rpdj48ZGl2PiZndDsmbmJzcDs8c3BhbiBz
dHlsZT0iY29sb3I6IHJnYigwLCAwLCAwKTsgZm9udC1mYW1pbHk6ICdMdWNpZGEgR3JhbmRlJywg
J0x1Y2lkYSBTYW5zIFVuaWNvZGUnLCBHZW5ldmEsIFZlcmRhbmEsIHNhbnMtc2VyaWY7IGZvbnQt
c2l6ZTogMTRweDsgbGluZS1oZWlnaHQ6IDIxcHg7Ij5PcGVyYW5kcyBhcmUgYXNzaWduZWQgdG8g
dW5ib3VuZCBmaWVsZHMgaW4gdGhlIGluc3RydWN0aW9uIGluIHRoZSBvcmRlciB0aGV5IGFyZSBk
ZWZpbmVkLiBGaWVsZHMgYXJlIGJvdW5kIHdoZW4gdGhleSBhcmUgYXNzaWduZWQgYSB2YWx1ZS48
L3NwYW4+PC9kaXY+" style="height:0;width:0;max-height:0;max-width:0;overflow:hidden;font-size:0em;padding:0;margin:0"></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jun 25, 2015 at 5:28 PM, Mohamed Shafi <span dir="ltr"><<a href="mailto:shafitvm@gmail.com" target="_blank">shafitvm@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
In tablegen file inside class we have variables declared inside a<br>
class. Say in PPC there is this<br>
<br>
class BForm<bits<6> opcode, bit aa, bit lk, dag OOL, dag IOL, string asmstr><br>
: I<opcode, OOL, IOL, asmstr, IIC_BrB> {<br>
bits<7> BIBO; // 2 bits of BI and 5 bits of BO.<br>
bits<3> CR;<br>
bits<14> BD;<br>
<br>
<br>
How does the generator match each variable against an operand?<br>
<br>
For the corresponding PPCGenMCCodeEmitter.inc for this the entry is<br>
<br>
// op: BIBO<br>
op = getMachineOpValue(MI, MI.getOperand(0), Fixups, STI);<br>
// op: CR<br>
op = getMachineOpValue(MI, MI.getOperand(1), Fixups, STI);<br>
// op: BD<br>
op = getCondBrEncoding(MI, 2, Fixups, STI);<br>
<br>
<br>
How does the generator know that BIBO is op0 and CR is op1 and so on?<br>
Is it based on the order of the declarations of the variables in the class?<br>
<br>
Regards,<br>
Shafi<br>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a> <a href="http://llvm.cs.uiuc.edu" rel="noreferrer" target="_blank">http://llvm.cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" rel="noreferrer" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
</blockquote></div><br></div>