<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">In MyTargetRegisterInfo.td file, I defined separated register classes for general purpose registers and for the SP register:</div><div class=""><br class=""></div><div class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Monaco; background-color: rgb(255, 255, 255);" class="">def GR16 : RegisterClass<<span style="color: #d12f1b" class="">"CPU74"</span>, [i16], <span style="color: #272ad8" class="">16</span>, (add R0, R1, R2, R3, R4, R5, R6, R7)>;</div></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Monaco; background-color: rgb(255, 255, 255);" class=""><div style="margin: 0px; line-height: normal;" class="">def SSP : RegisterClass<<span style="color: #d12f1b" class="">"CPU74"</span>, [i16], <span style="color: #272ad8" class="">16</span>, (add SP)>;</div></div><div class=""><br class=""></div><div class="">The SP can not be used in general purpose arithmetic instructions, therefore I defined the following classes in MyTargetInstrInfo.td:</div><div class=""><br class=""></div><div class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Monaco; background-color: rgb(255, 255, 255);" class="">class T5rr16alu<string opcStr, string altOpcStr, SDNode opNode, bits<<span style="color: #272ad8" class="">4</span>> opcode>: Type5</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Monaco; background-color: rgb(255, 255, 255);" class=""> <opcode,</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Monaco; background-color: rgb(255, 255, 255);" class=""> (outs GR16:$rd), (ins GR16:$rn, GR16:$rs),</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Monaco; background-color: rgb(255, 255, 255);" class=""> AsmStr< opcStr, altOpcStr, <span style="color: #d12f1b" class="">"\t$rn, $rs, $rd"</span>>.n,</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Monaco; background-color: rgb(255, 255, 255);" class=""> [(set GR16:$rd, (opNode GR16:$rn, GR16:$rs)), (implicit SR)]>;</div></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Monaco; background-color: rgb(255, 255, 255);" class=""><br class=""></div><div class="">I also have specific instructions that can only use the SP, so I defined this as well</div><div class=""><br class=""></div><div class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Monaco; background-color: rgb(255, 255, 255);" class="">class T11sr16alu<string opcStr, string altOpcStr, SDNode opNode, bits<<span style="color: #272ad8" class="">3</span>> opcode, bits<<span style="color: #272ad8" class="">2</span>> mode>: Type11</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Monaco; background-color: rgb(255, 255, 255);" class=""> <opcode, mode,</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Monaco; background-color: rgb(255, 255, 255);" class=""> (outs GR16:$rd), (ins SSP:$sp, GR16:$rd0),</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Monaco; background-color: rgb(255, 255, 255);" class=""> AsmStr< opcStr, altOpcStr, <span style="color: #d12f1b" class="">"\t$sp, $rd0, $rd"</span>>.n,</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Monaco; background-color: rgb(255, 255, 255);" class=""> [(set GR16:$rd, (opNode SSP:$sp, GR16:$rd0)), (implicit SR)]></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Monaco; background-color: rgb(255, 255, 255);" class=""> {let Constraints = <span style="color: #d12f1b" class="">"$rd = $rd0"</span>;}</div></div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">According to my understanding, instructions belonging to the T5rr16alu class above, should never be selected with the SP as register. However, instructions of that class get selected anyway with the SP, instead of the class T11sr16alu.</div><div class=""><br class=""></div><div class="">However, if I place class T11sr16alu, before class T5rr16alu, then the right instruction is selected</div><div class=""><br class=""></div><div class="">Why is that?. </div><div class="">What I am missing?</div><div class=""><br class=""></div><div class="">
<div style="color: rgb(0, 0, 0); letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;">Joan</div></div></div>
</div>
<br class=""></body></html>