<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.6000.17098" name=GENERATOR></HEAD>
<BODY 
style="WORD-WRAP: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space">
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff 
size=2></FONT><BR> </DIV>
<DIV>
<DIV><SPAN class=257413013-20012012><FONT face=Arial color=#0000ff 
size=2> > </FONT></SPAN>On Jan 19, 2012, at 5:31 AM, Jonas Paulsson 
wrote:</DIV><SPAN class=257413013-20012012><FONT face=Arial color=#0000ff 
size=2> <FONT face="Times New Roman" color=#000000 
size=3>></FONT> </FONT></SPAN><SPAN class=Apple-style-span 
style="WORD-SPACING: 0px; FONT: medium Menlo; TEXT-TRANSFORM: none; TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate; orphans: 2; widows: 2; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"><SPAN 
class=Apple-style-span style="FONT-SIZE: 13px; FONT-FAMILY: Tahoma"><SPAN 
class=257413013-20012012><FONT face=Arial color=#0000ff 
size=2> </FONT></SPAN>LLVM would have to be extended with an 
RegClass/register-attribute 'spillable'</SPAN></SPAN>
<DIV><SPAN class=257413013-20012012></SPAN><FONT face=Arial color=#0000ff 
size=2>></FONT><BR><SPAN class=257413013-20012012><FONT face=Arial 
color=#0000ff size=2> > </FONT></SPAN></DIV>
<DIV><SPAN class=257413013-20012012><FONT face=Arial color=#0000ff 
size=2> > </FONT></SPAN>What exactly are you proposing? Why can't 
you do what the PowerPC and Hexagon targets do?</DIV><FONT face=Arial 
color=#0000ff size=2></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2></FONT> </DIV>
<DIV><SPAN class=257413013-20012012><FONT face=Arial color=#0000ff size=2>Yes, I 
can move a CR to a GPR and save it to the stack, but due to a very irregular 
register file this is about 10 times more expensive than saving/restoring an 
ordinary register. These registers should basically never</FONT></SPAN></DIV>
<DIV><SPAN class=257413013-20012012><FONT face=Arial color=#0000ff size=2>have 
to be spilled, at least not on -O3.</FONT></SPAN></DIV>
<DIV>
<DIV><FONT face=Arial color=#0000ff size=2></FONT><FONT face=Arial color=#0000ff 
size=2></FONT><FONT face=Arial color=#0000ff size=2></FONT><BR></DIV>
<DIV><SPAN class=257413013-20012012><FONT face=Arial color=#0000ff 
size=2> > </FONT></SPAN>Spill-free register allocation sounds 
great, why not do it for all register classes?<SPAN 
class=257413013-20012012><FONT face=Arial color=#0000ff 
size=2> </FONT></SPAN></DIV>
<DIV><SPAN class=257413013-20012012><FONT face=Arial color=#0000ff 
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=257413013-20012012><FONT face=Arial color=#0000ff size=2>Well, 
in this architecture, each GPR has its own CR, and I have made a 
super-register that includes the GPR and CR when the flag is needed. I need to 
write code like:</FONT></SPAN></DIV>
<DIV><SPAN class=257413013-20012012><FONT face=Arial color=#0000ff 
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=257413013-20012012><FONT face=Arial color=#0000ff size=2>GPR_CR 
= cmp GPR, 
0                                                            // 
GPR_CR def</FONT></SPAN></DIV>
<DIV><SPAN class=257413013-20012012><FONT face=Arial color=#0000ff 
size=2><other code, possibly using just GPR's without setting the 
CR></FONT></SPAN></DIV>
<DIV><SPAN class=257413013-20012012><FONT face=Arial color=#0000ff size=2>br #, 
GPR_CR                                                                         
// GPR_CR use</FONT></SPAN></DIV>
<DIV><SPAN class=257413013-20012012><FONT face=Arial color=#0000ff 
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=257413013-20012012><FONT face=Arial color=#0000ff 
size=2>Basically, I would like to make sure that the GPR_CR reg is not spilled 
before another GPR-only reg is spilled, as it would be idiotic. As the 
super-register is wider than the GPR I do not see why this happened, but at 
-O0</FONT></SPAN></DIV>
<DIV><FONT face=Arial><FONT size=2><FONT color=#0000ff><SPAN 
class=257413013-20012012>this happened for some reason or other. 
</SPAN></FONT></FONT></FONT></DIV>
<DIV><FONT face=Arial><FONT size=2><FONT color=#0000ff><SPAN 
class=257413013-20012012></SPAN></FONT></FONT></FONT> </DIV>
<DIV><FONT face=Arial><FONT size=2><FONT color=#0000ff><SPAN 
class=257413013-20012012></SPAN></FONT></FONT></FONT><SPAN 
class=257413013-20012012></SPAN><SPAN class=257413013-20012012><FONT face=Arial 
color=#0000ff size=2>I tried a method with simply handing out pregs as suitable 
in preRA. I would like to confirm with you if possible that this should work 
with PBQP and greedy/basic, </FONT></SPAN><SPAN class=257413013-20012012><FONT 
face=Arial color=#0000ff size=2>which scans the LiveIntervals for pregs and 
remembers it. </FONT></SPAN></DIV>
<DIV><SPAN class=257413013-20012012><FONT face=Arial color=#0000ff size=2>What's 
more, setting the GPR_CR class to 'not-spillable' would probably do the trick 
here as we basically do not want to do this, and I would not have to 
pre-allocate. But there is probably a better way, or?</FONT></SPAN></DIV>
<DIV><SPAN class=Apple-style-span 
style="WORD-SPACING: 0px; FONT: medium Menlo; TEXT-TRANSFORM: none; TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate; orphans: 2; widows: 2; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"><SPAN 
class=Apple-style-span style="FONT-SIZE: 13px; FONT-FAMILY: Tahoma"><SPAN 
class=257413013-20012012></SPAN></SPAN></SPAN> </DIV>
<DIV><SPAN class=Apple-style-span 
style="WORD-SPACING: 0px; FONT: medium Menlo; TEXT-TRANSFORM: none; TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate; orphans: 2; widows: 2; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"><SPAN 
class=Apple-style-span style="FONT-SIZE: 13px; FONT-FAMILY: Tahoma"><SPAN 
class=257413013-20012012>> </SPAN>, and a register allocator would have 
to implement register pairing. That would be PBQP, 
right?</SPAN></SPAN></DIV></DIV><SPAN class=257413013-20012012><FONT face=Arial 
color=#0000ff size=2> <FONT face=Tahoma 
color=#000000>></FONT> </FONT></SPAN><BR>
<DIV><SPAN class=257413013-20012012><FONT face=Arial color=#0000ff 
size=2> > </FONT></SPAN>If by pairing you mean GCC's 
multiple-alternatives, then PBQP should be able to support that.</DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN 
class=257413013-20012012>></SPAN></FONT></DIV>
<DIV><SPAN class=257413013-20012012><FONT face=Arial color=#0000ff 
size=2> > </FONT></SPAN>/jakob</DIV><FONT face=Arial color=#0000ff 
size=2></FONT><FONT face=Arial color=#0000ff size=2></FONT><FONT face=Arial 
color=#0000ff size=2></FONT><FONT face=Arial color=#0000ff size=2></FONT><FONT 
face=Arial color=#0000ff size=2></FONT>
<DIV><SPAN class=257413013-20012012><FONT face=Arial color=#0000ff 
size=2> </FONT></SPAN></DIV>
<DIV><SPAN class=257413013-20012012><FONT face=Arial color=#0000ff size=2>I take 
it then that it is not possible to write operand-combinations as in GCC in LLVM 
so as to handle register pairing on a high level?</FONT></SPAN></DIV>
<DIV><SPAN class=257413013-20012012> </SPAN><BR><SPAN 
class=257413013-20012012><FONT face=Arial color=#0000ff size=2>The PBQP 
algorithm as such supports register pairing per the article, but it 
was not implemented in RegAllocPBQP.cpp as far as I can see.</FONT></SPAN></DIV>
<DIV><SPAN class=257413013-20012012><FONT face=Arial color=#0000ff 
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=257413013-20012012><FONT face=Arial color=#0000ff size=2>For my 
needs, I would like to say that </FONT></SPAN><SPAN 
class=257413013-20012012><FONT face=Arial color=#0000ff size=2>whenever two 
registers are used in the same instruction, they must follow any 
register-pairing rule defined for any such occurence. Possibly, one 
could add a Constraint per instruction def </FONT></SPAN></DIV>
<DIV><SPAN class=257413013-20012012><FONT face=Arial color=#0000ff size=2>as 
well to </FONT></SPAN><SPAN class=257413013-20012012><FONT face=Arial 
color=#0000ff size=2>indicate the use of the register pairing rule, and to allow 
instances where it does not apply.</FONT></SPAN></DIV>
<DIV><SPAN class=257413013-20012012><FONT face=Arial color=#0000ff 
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=257413013-20012012><FONT face=Arial color=#0000ff size=2>PBQP 
extension (suggestion)</FONT></SPAN></DIV>
<DIV><SPAN class=257413013-20012012><FONT face=Arial color=#0000ff 
size=2>======================</FONT></SPAN></DIV>
<DIV><SPAN class=257413013-20012012><FONT face=Arial color=#0000ff 
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=257413013-20012012><FONT face=Arial color=#0000ff 
size=2>Tablegen:</FONT></SPAN></DIV>
<DIV><SPAN class=257413013-20012012><FONT face=Arial color=#0000ff 
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=257413013-20012012><FONT face=Arial color=#0000ff size=2>def 
regPair : registerPair<AddrReg0, OffsReg0>,</FONT></SPAN></DIV>
<DIV><SPAN class=257413013-20012012><FONT face=Arial color=#0000ff 
size=2>~or~</FONT></SPAN></DIV>
<DIV><SPAN class=257413013-20012012><FONT face=Arial color=#0000ff size=2>def 
regPair:  registerPairing<AddrReg0, [OffsReg0, OffsReg1, 
OffsReg2]>;</FONT></SPAN></DIV>
<DIV><SPAN class=257413013-20012012><FONT face=Arial color=#0000ff 
size=2>~or~</FONT></SPAN></DIV>
<DIV><SPAN class=257413013-20012012><FONT face=Arial color=#0000ff 
size=2>??</FONT></SPAN></DIV>
<DIV><SPAN class=257413013-20012012><FONT face=Arial color=#0000ff 
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=257413013-20012012><FONT face=Arial color=#0000ff size=2>in the 
instruction such as a load:</FONT></SPAN></DIV>
<DIV><SPAN class=257413013-20012012><FONT face=Arial color=#0000ff 
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=257413013-20012012><FONT face=Arial color=#0000ff size=2>ld 
dst, addrReg, offsReg</FONT></SPAN></DIV>
<DIV><SPAN class=257413013-20012012><FONT face=Arial color=#0000ff 
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=257413013-20012012><FONT face=Arial color=#0000ff size=2>then 
PBQP must follow the rule and only allocate legal combinations of addrReg and 
offsReg.</FONT></SPAN></DIV>
<DIV><SPAN class=257413013-20012012><FONT face=Arial color=#0000ff 
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=257413013-20012012><FONT face=Arial color=#0000ff size=2>I 
beleive this should work by setting the cost to infinity for illegal 
combinations. </FONT></SPAN><SPAN class=257413013-20012012><FONT face=Arial 
color=#0000ff size=2>I supervised a bacheolor student here last year 
</FONT></SPAN><SPAN class=257413013-20012012><FONT face=Arial color=#0000ff 
size=2>(Jakob Stengård), and as far as I recall, Lang was interested in 
helping him getting this implemented </FONT></SPAN></DIV>
<DIV><SPAN class=257413013-20012012><FONT face=Arial color=#0000ff size=2>then, 
although Jakob ran out of time. Has anything changed since then? 
</FONT></SPAN><SPAN class=257413013-20012012><FONT face=Arial color=#0000ff 
size=2>What is your estimation on the amount of  </FONT></SPAN><SPAN 
class=257413013-20012012><FONT face=Arial color=#0000ff size=2>work for this? 
Would anyone (Lang?) be willing to supervise it?</FONT></SPAN></DIV>
<DIV><SPAN class=257413013-20012012><FONT face=Arial color=#0000ff 
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=257413013-20012012><FONT face=Arial color=#0000ff 
size=2>Jonas</FONT></SPAN></DIV>
<DIV><SPAN class=257413013-20012012><FONT face=Arial color=#0000ff 
size=2></FONT></SPAN> </DIV></BODY></HTML>