Hi,
Pointer to banked function must be special pointer. You cannot use generic
ones:
int (* pCallee)(int a, int b) __banked(5); //16-bit pointers
Int (* pCallee)(int a, int b) __banked; //24 or 32-bit pointers

In my example I just show generic function prologue with information where
four bytes are expected. Most of callers will have their own local
variables. These four bytes are required to make banked call cheaper: do
not use tranpoline in caller or move frame in banked_call implementation.

Best regards,
Sergey Belyashov


вс, 8 марта 2020 г., 6:26 Alan Cox <alan@llwyncelyn.cymru>:

> > 5. Add optimization to compiler to replace calls to ABS address (n*8, n=
> > 0...7) by corresponding RST instruction (someone may want put banked_call
> > on one of RSTs).
>
> This makes sense but the last one is very non-portable, and instead you
> can do it with a custom peephole file to suit your target.
>
> The other problem you have is you are changing how some functions are
> called but not all. That will break function pointers unless you also
> type them somehow.
>
> >
> > Example:
> > _caller::
> >   push ix
> >   ld ix,0
> >   add ix,sp
> >   ld hl,4
> >   add hl,sp
> >   ld sp,hl
>
> inc sp inc sp inc sp inc sp is simpler as is just pushing a random
> register twice.
>
> Alan
>
_______________________________________________
Sdcc-user mailing list
Sdcc-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sdcc-user

Reply via email to