<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/104050>104050</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Why are general-purpose registers and floating-point registers stored on both sides of fp in the Aarch64 architecture
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
Wang-Zhongqi
</td>
</tr>
</table>
<pre>
Hello everyone, I have a question. Why are the callee saved general-purpose registers and callee saved floating-point registers stored on both sides of fp and lr respectively in the aarch64 architecture c callconv? This may be the case in the stack:
-- stack --
| saved x28 |
| saved x27 |
| saved lr |
| saved fp | <- new fp
| saved d9 |
| saved d8 |
When I did not use the called saved floating-point register, I used LLVMBuildAlloc to generate a structure and obtained the space below fp. During the backtrace process, I used * (fp-8) to obtain the value I needed. The stack frame structure is as follows:
| saved x28 |
| saved x27 |
| saved lr |
| saved fp | <- new fp
| frame_type | <- value
| context ptr |
However, when using the callee saved floating-point register, the stack frame structure changed, making it impossible for me to obtain values through the original method. The specific stack frame structure may be as follows:
| saved x28 |
| saved x27 |
| saved lr |
| saved fp | <- new fp
| saved d9 | <- inserted in the middle
| saved d8 |
| frame_type | <- value
| context ptr |
If I want to save some values adjacent to fp for retrieval during backtrace, how can I implement it through llvm17 c-API?
I have considered preserving registers to avoid using d8-d31, but I only found+reserve-x0 in -- attr, which only provides the option to preserve general-purpose registers.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzMVUuL6zYU_jXK5uDg2Hk4Cy8yM4QbuIUuLh3opsjSsa07sqQrHTuTf19kO_Nq5tIWCs0ihvPW950HD0E1BrFkmzu2eVjwnlrry0dumuT31prmh1pUVl7KL6i1BRzQX6xBlt3DCVo-IHD40WMgZc0SHtsLcI9ALYLgWiNC4ANKaNCg5zpxvXc2IHhsVCD0AbiR701rbTkp0yTOKkNvLANZjxKsgcpSC0FJDGBr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