<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=us-ascii"><meta name=Generator content="Microsoft Word 14 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";
        mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri","sans-serif";
        mso-fareast-language:EN-US;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-GB link=blue vlink=purple><div class=WordSection1><p class=MsoNormal>Hi Lang,<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Could you please review the attached patch ? This is the first out of three.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>This patch improves how the different costs (register, interference, spill<o:p></o:p></p><p class=MsoNormal>and coalescing) relates together. The assumption is now that:<o:p></o:p></p><p class=MsoNormal> - coalescing (or any other "side effect" of reg alloc) is negative, and<o:p></o:p></p><p class=MsoNormal>   instead of being derived from a spill cost, they use the block<o:p></o:p></p><p class=MsoNormal>   frequency info.<o:p></o:p></p><p class=MsoNormal> - spill costs are in the [MinSpillCost:+inf( range<o:p></o:p></p><p class=MsoNormal> - register or interference costs are in [0.0:MinSpillCost( or +inf<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>The current MinSpillCost is set to 10.0, which is a random value high<o:p></o:p></p><p class=MsoNormal>enough that the current constraint builders do not need to worry about<o:p></o:p></p><p class=MsoNormal>when settings costs. It would however be worth adding a normalization<o:p></o:p></p><p class=MsoNormal>step for register and interference costs as the last step in the<o:p></o:p></p><p class=MsoNormal>constraint builder chain to ensure they are not greater than SpillMinCost<o:p></o:p></p><p class=MsoNormal>(unless this has some sense for some architectures). This would work well<o:p></o:p></p><p class=MsoNormal>with the current builder pipeline, where all costs are tweaked relatively<o:p></o:p></p><p class=MsoNormal>to each other’s, but could grow above MinSpillCost if the pipeline is<o:p></o:p></p><p class=MsoNormal>deep enough.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>The current heuristic is tuned to depend rather on the number of uses of<o:p></o:p></p><p class=MsoNormal>a live interval rather than a density of uses, as used by the greedy<o:p></o:p></p><p class=MsoNormal>allocator. This heuristic provides a few percent improvement on a number<o:p></o:p></p><p class=MsoNormal>of benchmarks (eembc, spec, ...) and will definitely need to change once<o:p></o:p></p><p class=MsoNormal>spill placement is implemented: the current spill placement is really<o:p></o:p></p><p class=MsoNormal>inefficient, so making the cost proportional to the number of use is a<o:p></o:p></p><p class=MsoNormal>clear win.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>This is the only patch in this PBQP improvement serie without a testcase<o:p></o:p></p><p class=MsoNormal>because this patch widely changes allocation, and it is hard to isolate simple and<o:p></o:p></p><p class=MsoNormal>meaningful testcases for it. The 2 following patches, which are addressing specific<o:p></o:p></p><p class=MsoNormal>areas of the allocator have a testcase.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Cheers,<o:p></o:p></p><p class=MsoNormal><span style='mso-fareast-language:EN-GB'>--<o:p></o:p></span></p><p class=MsoNormal><span style='mso-fareast-language:EN-GB'>Arnaud A. de Grandmaison<o:p></o:p></span></p><p class=MsoNormal><o:p> </o:p></p></div></body></html>