<div dir="ltr">Hello Peter,<br><div class="gmail_extra"><div class="gmail_quote"><div><br></div><div>Thanks to pointing out this interesting case. </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
Vivek,<br>
          I have an application where many of the leaf functions are<br>
Hand-coded assembly language,  because they use special IO instructions<br>
That only the assembler knows about.  These functions typically don't<br>
Use any registers besides the incoming argument registers, IE they don't<br>
Need to use any additional callee-save nor caller-save registers.<br>
<br></blockquote><div>If inline asm template has specified clobbered list properly than IPRA is able to use that information and it propagates correct register mask (and that also means that skipping clobbers list while IPRA enabled may broke executable)</div><div>For example in following code:</div><div><div>int gcd( int a, int b ) {</div><div>    int result ;</div><div>    /* Compute Greatest Common Divisor using Euclid's Algorithm */</div><div>    __asm__ __volatile__ ( "movl %1, %%r15d;"</div><div>                          "movl %2, %%ecx;"</div><div>                          "CONTD: cmpl $0, %%ecx;"</div><div>                          "je DONE;"</div><div>                          "xorl %%r13d, %%r13d;"</div><div>                          "idivl %%ecx;"</div><div>                          "movl %%ecx, %%r15d;"</div><div>                          "movl %%r13d, %%ecx;"</div><div>                          "jmp CONTD;"</div><div>                          "DONE: movl %%r15d, %0;" : "=g" (result) : "g" (a), "g" (b) : "ecx" ,"r13", "r15"</div><div>    );</div><div><br></div><div>    return result ;</div><div>}</div></div><div>IPRA calculates and propagates correct regmask in which it marks CH, CL, ECX .. clobbered and R13, R15 is not marked clobbered as it is callee saved and LLVM code generators also insert spill/restores code for them.</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
Is there any way in your IPRA interprocedural register allocation project that<br>
The user can supply this information for external functions ?</blockquote><div>By external word do you here mean function defined in other module than being used?  In that case as IPRA can operate on only one module at time register usage propagation is not possible. But there is a work around for this problem. You can use IPRA with link time optimization enabled because the way LLVM LTO works it creates a big IR modules out of source files and them optimize and codegen it so in that case IPRA can have actual register usage info (if function will be compiled in current module). </div><div><br></div><div>In case you want to experiment with IPRA please apply <a href="http://reviews.llvm.org/D21395">http://reviews.llvm.org/D21395</a> this patch before you begin.</div><div><br></div><div>-Vivek</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"> </blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
Perhaps using some form of __attribute__ ?<br>
Maybe __attribute__ ((registermask = ....))  ?<br>
<br>
<br>
--Peter Lawrence.<br></blockquote></div></div></div>