<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Jan 27, 2013, at 6:50 AM, <a href="mailto:matic@nimp.co.uk">matic@nimp.co.uk</a> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">
<div style="font-family: Verdana,Geneva,sans-serif"><p>I am confused about the call to isPhyRegUsed in calculateCalleeSavedRegisters:</p><p>if (Fn.getRegInfo().isPhysRegUsed(Reg)) {<br> // If the reg is modified, save it!<br> CSI.push_back(CalleeSavedInfo(Reg));<br> }</p><p>It seems that isPhyRegUsed returns true if the register is read or written in the function. </p><p>If this is right, why do we save a register if it is only read in the function ?? I would have expected that calculateCalleeSavedRegisters use another function which would return true only when the register is written, something like "isPhyRegWritten".</p></div></blockquote><div><br></div><div>Hi Sebastien,</div><div><br></div><div>I don't think there is a good reason it works that way. The distinction hasn't been important yet, I'd guess.</div><div><br></div><blockquote type="cite"><div style="font-family: Verdana,Geneva,sans-serif"><p>The ARM backend don't have this problem because it use a BX_RET instruction, which is just a BX which implicitly use LR as operand. Seems like a workaround solution...</p></div></blockquote><div>Some CodeGen passes treat return instructions specially. That is why there is a BX_RET instruction. Look for isReturn().</div><div><br></div><div>/jakob</div><div><br></div></div></body></html>