<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Jun 17, 2011, at 7:31 AM, Sanjoy Das wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; font-family: Optima; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -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; font-size: medium; "><span class="Apple-style-span" style="font-family: monospace; ">c. Having EmitLoweredSegAlloca do the checks, (calling the external<br>function if needed) and, in both the cases, write the pointer to the<br>allocated memory to RAX. If the function is called nothing extra needs<br>to be done, since the return value stays at RAX. If the stack pointer<br>was changed, I do a (X86::MOV64rr, X86::RAX).addReg(X86::RSP).<br></span></span></blockquote></div><br><div>Try not to use physical registers before register allocation unless you absolutely have to.</div><div><br></div><div>If you call a function, immediately copy the return value to a virtual register. Same thing for the stack pointer; copy it to a virtual register (using COPY, not MOV64rr).</div><div><br></div><div>You'll probably need a PHI as well.</div><div><br></div><div>/jakob</div><div><br></div></body></html>