<div class="gmail_quote"><div>Hello Jakob,<br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Those are some severe constraints on register allocation, but it ought to be possible anyway.<br>
</blockquote><div><br>Indeed, these constraints aren't playing very well with the register allocator :\<br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
You may wan't to investigate how RAGreedy::canEvictInterference() is behaving.<span class="HOEnZb"><font color="#888888"><br></font></span></blockquote><div><br>Ok, this is what I've noticed, not sure if it makes sense at all but, regalloc fails with the following sequence:<br>
<br>1) directly assign the physreg in PTR RC to a virtX.<br>2) for a virtY which also belongs to the PTR RC, try to evict: call canEvictInterference() for virtY which interferes with virtX, returns true. evict and unassign virtX and assign physreg to virtY.<br>
3) for a virtZ which also belongs to the PTR RC, try to evict: call
canEvictInterference() for virtZ which interferes with virtY, both VirtReg.isSpillable() and Intf->isSpillable() return false, can't evict, wait for a second round and queue new interval.<br>4) do some work unrelated to these vregs.<br>
5) when selectOrSplit is called again for virtZ it falls through down to the return ~0u line and fails.<br><br><br>This issue can be very easily reproduced with the Thumb2 target by doing the following few changes:<br><br>
1) declare a PTRRC regclass in ARMRegisterInfo.td with only one physreg:<br>def PTRRC : RegisterClass<"ARM", [i32], 32, (add R6)>;<br><br>2) modify the RC used in the addr_offset_none addressing mode in ARMInstrInfo.td around line 947 to:<br>
let MIOperandInfo = (ops PTRRC:$base);<br>(this is used by the t2LDR_POST instruction)<br><br>3) and likewise modify the t2addrmode_imm12 addressing mode in ARMInstrThumb2.td around line 151 to:<br>let MIOperandInfo = (ops PTRRC:$base, i32imm:$offsimm);<br>
(used by the load/store instructions)<br> <br>then compile with -O3 and done :)<br><br>In addition, I've attached the debugging info generated by the regalloc for the Thumb2 target. The main difference of the debug output using my target is that I didn't get any spill code like Thumb2 has, probably because i have far more free regs available.<br>
<br>Thanks for your help.<br><br></div></div>