<div dir="ltr">Thanks, Matt.<div><br></div><div>I have another question related to the register classes and register allocation.</div><div><br></div><div>In the above example, RegA Ā has 8 registers and RegB has 16 registers. For register allocation, if RegA doesn't have enough available registers to use, a 'spill' and 'refill' will be inserted by InlineSpiller by callingĀ storeRegToStackSlot(). Assume in this case, RegB still has enough registers and there is a 'MOVE' instruction to move to value between RegA and RegB. I prefer to insert a 'MOVE' instruction to mimic the 'spill' and 'refill'. For example, 'MOVE' the value from RegA to RegB to mimic the 'spill' and 'MOVE' the value from RegB to RegA to mimic 'refill'. Does this sound reasonable? And can you suggest some proper ways to achieve this?</div><div><br></div><div>Thanks,</div><div><br></div><div>Xiangyang</div></div><div class="gmail_extra"><br><div class="gmail_quote">2016-02-02 23:36 GMT-05:00 Matt Arsenault <span dir="ltr"><<a href="mailto:arsenm2@gmail.com" target="_blank">arsenm2@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5"><br>
> On Feb 2, 2016, at 20:17, Xiangyang Guo via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>> wrote:<br>
><br>
> Hi,<br>
><br>
> Assume I define registers R0...R15 and two register classes RegA and RegB. RegA contains R0 to R7 while RegB contains R0 to R15.<br>
><br>
> Then I check the machine instruction, it seems that in some cases, the %vreg0 belongs to RegB; in other cases %vreg1 belongs to RegA_RegB. Can you tell me how TableGen decides which is which? At first, I guess &verg0 will be assigned by R8 to R15 only so that %vreg0 belongs to RegB. But it seems my guess is wrong because %verg0 can also be assigned by R0.<br>
><br>
> Any input is appreciable.<br>
><br>
> Regards,<br>
><br>
> Xiangyang<br>
</div></div>> _______________________________________________<br>
> LLVM Developers mailing list<br>
> <a href="mailto:llvm-dev@lists.llvm.org">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>
<br>
TableGen does not directly make the decision on what class to use for virtual registers, only the constraints on the operand. InstrEmitter ultimately makes this decision, using a combination of factors including the register class you specified for a specific type, whether the class is allocatable, and satisfying the operand register classes defined as a property of the instruction. The register classes defined for the instruction's operands in TableGen influences the selected class. See InstrEmitter::CreateVirtualRegisters and other related functions.<br>
<span class="HOEnZb"><font color="#888888"><br>
-Matt</font></span></blockquote></div><br></div>