Menu

How to make a function call without push/pop stack

Help
Hengyu
2016-03-19
2016-06-14
  • Hengyu

    Hengyu - 2016-03-19

    I am trying to share common block in my code to bring down the code size. It's just like the common block subrountine function in Keil.
    I am trying to do that in my C code to write c function for share block. But I found that even if I make all the local variables golbal and doesn't pass any parameter, the compile result with SDCC still tries to push and pop. My observation is that sometimes, it pushes and pops AR1-AR4, sometimes it doesn't. I wonder if anyone knows a way to config the compiler so that it doesn't push and pop anything while calling a function.

     
  • Maarten Brock

    Maarten Brock - 2016-03-20

    I'm not sure I understand, but I think you want --callee-saves.

     
  • liangxiaowz

    liangxiaowz - 2016-06-14

    define a function with __naked. It will eliminate 'ret' also, you need assemble code __asm ("ret") at the end of function

     

    Last edit: Maarten Brock 2016-07-23

Log in to post a comment.