This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

c6748中,编译器对函数返回地址的保存问题

ccs版本为8.20,在《TMS320C6000 Optimizing Compiler v8.2.x - User's Guide》的8.4.2中有这样一段描述:

2. If the called function calls any other functions, the return address must be saved on the stack.
Otherwise, it is left in the return register (B3) and is overwritten by the next function call.

我理解为,当发生函数调用时,要先把B3寄存器入栈,保存当前函数的返回地址,B3用来继续保存被调用函数的返回地址。

但是我在实际观察时发现,有的时候,在发生函数调用之前,编译器不会将B3入栈,而是将B3保存到除child寄存器(A10~A15,B10~B15)的其他寄存器中,如A0,A9,A31等。


我的问题是,编译器的这种行为,是否有文档支持,我没有找到相关文档支持的佐证。如果有的话,使用寄存器保存B3的使用规则是什么,是否会在文档中一并给出。或者是需要配置编译器的选项,才能保证所有的函数调用都将B3入栈。

谢谢。