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.

meaning of --disable_push_pop option for 66x DSP compiler

We have linker warnings as below :

----------------------

warning: Possible codesize or performance degradation. Section

   ".text:tietb.c66ak2hxx_c66x_elf.lib<TIETB.obj>" has calls to rts routines,

   but rts is placed out of range from call site at 0xa1117ef8, or in a

   different section. To optimize codesize, either 1) place rts closer to call

   site, or 2) place rts in same section, or 3) compile with

   --disable_push_pop.

-----------------------

Examining the library source does not reveal any rts dependency. From the 3rd workaround that is suggested above, looking up the compiler UG to understand what it means, all it has in the documentation is below in a table of debug options:

--disable_push_pop Disables push-pop optimization

The library in question is not sensitive to performance so we could use the 3) option but we would like to better understand what it means to prevent suppressing it for genuine cases where performance is important before we use it. Can you provide a more detailed explanation (and possibly update the compiler UG also)

  • The C6000 has quite a few callee-saved registers, and the code size of the instructions to save and restore those registers is non-trivial. This extra code size is suffered by every non-trivial function, which can add up to a lot of code. To help reduce the code size, the compiler uses a pair of helper functions named __c6xabi_push_rts and __c6xabi_pop_rts to save and restore the registers. A call to one of these functions is much smaller than having many save and restore instructions in every function. However, one drawback is that the call to the push-pop function has limited range for a short branch. If the function, which is in the RTS, is too far away, the linker will be forced to generate a trampoline. The size of the trampoline can wipe out the code size gains from the push-pop optimization, and it also adds a non-trivial number of cycles to the call, on top of the extra cycles already needed to call __c6xabi_push_rts. In such cases (usually very large programs), using the push-pop optimization can be counter-productive. However, the program will still work. If your program can handle the potential performance hit, you need not do anything but ignore the warnings. If you choose to use --disable_push_pop to silence the warnings, you probably won't notice much of a performance change unless your program makes frequent function calls. [I'm a little fuzzy on why the warning message detects any RTS call, and why it matters, I'll have to ask around about that.]