Hi, Philipp! When in the future the new calling convention is made the default in > trunk, a way to indicate the use of the old calling convention (maybe > __sdccoldcall or so) will be introduced to use the old calling > convention for individual functions. Maybe __sdccoldcall, __stackcall or > something like that. >
It would be great if there was some macro definition indicating calling convention at compile time. In such case we could do something like that: > void some_func() > { > __asm > #ifdef __SDCC_STM8_CALL_LEGACY > /*Legacy code*/ > #else /* __SDCC_STM8_CALL_LEGACY */ > /*Code for current calling convention*/ > #endif /* __SDCC_STM8_CALL_LEGACY */ > __endasm; > } Best regards, Paul Beltyukov вт, 29 июн. 2021 г. в 10:29, Philipp Klaus Krause <p...@spth.de>: > Am 29.06.21 um 00:38 schrieb Basil Hussain: > > > > If you are adding these attribute keywords, would it then be possible to > > have one to dictate, per function, the use of the old purely-stack-based > > calling convention? I think this would be a good idea for the sake of > > backwards compatibility, so that existing inline assembly code does not > > have to be rewritten just to compile under the new version. > > When in the future the new calling convention is made the default in > trunk, a way to indicate the use of the old calling convention (maybe > __sdccoldcall or so) will be introduced to use the old calling > convention for individual functions. Maybe __sdccoldcall, __stackcall or > something like that. > > >> callee. In the current convention, the cleanup is always done by the > >> caller. The caller vs callee-cleanup is the aspect that I am still a bit > >> unsure of. While this makes a differnce, the pciture was not that clear > >> initally. > > > > Can I clarify my understanding here? Callee-cleanup will have the called > > function rewind the stack pointer for any arguments that were passed on > > the stack. So, the caller will still push args onto the stack as before, > > but the callee will be responsible for clearing them off the stack? And > > the caller will not need to do anything after the called function > > returns. Am I correct? > > > Yes. > > > > > I have a tangential question: does any of this work make it easier to > > implement the callee-saves option/pragma for STM8? > > These are unrelated. > > Philipp > > > _______________________________________________ > Sdcc-user mailing list > Sdcc-user@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/sdcc-user >
_______________________________________________ Sdcc-user mailing list Sdcc-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sdcc-user