|
From: Philipp K. K. <pk...@sp...> - 2017-05-10 21:18:55
|
Am 10.05.2017 um 23:00 schrieb Åke Rehnman: > > On 2017-05-10 22:55, Philipp Klaus Krause wrote: >> >> But stm8 codegen basically does all stack-pointer-changing stuff in the >> three functions push(), pop() and adjustStack(). Does that help in any way? >> >> The stm8 codegen also supports the use of a frame-pointer, which >> currently is rarely used. If it is useful for debugging, I could however >> easily implement --fno-omit-frame-pointer for stm8. >> >> Philipp >> > > Honestly, this is news for me.... I've been working on the 3.6.0 release > so I have not looked at whats been going on since. Perhaps I should pull > the latest sources first... Line 356 in src/stm8/gen.c handles the variable access using the frame pointer. Line 3050 does the frame pointer setup. However, the caller is responsible for saving and restoring the frame pointer, so it might be unavailable for a short while after a function call. Support for the frame pointer has been in there for a long time: The offsets for sp-relative addressing on the STM8 are 8-bit only, while we can use 16-bit offsets on the register y, which is used as a frame pointer. We thus use the frame pointer when there is so much stack space used by local variables that we can't use sp-relative addressing for all them. Philipp |