#1367 peephole optimizer optimizes out the code banking parameters

closed-fixed
Maarten Brock
5
2013-05-25
2007-09-01
Anonymous
No

I have a banked function
void led_set( unsigned char state ) banked;
void led_set( unsigned char state ) banked
{
....
}

The generated code look like this:

; main.c:10: led_set( cnt );
; genCall
mov dpl,r2
push ar2
; Peephole 301 mov r0,#_led_set removed
; Peephole 301 mov r1,#(_led_set >> 8) removed
; Peephole 301 mov r2,#(_led_set >> 16) removed
lcall __sdcc_banked_call

the MOVs are for passing the function address to code banking function

it works ok with --no-peep option

Discussion

  • pkuhar
    pkuhar
    2007-09-01

    Logged In: YES
    user_id=1690353
    Originator: NO

    Sorry I didn't login when submiting.

    The asm code in the bug report was generated by calling the banked function.

    unsigned char cnt = 1;
    led_set( cnt );

     
  • Maarten Brock
    Maarten Brock
    2007-09-03

    • assigned_to: nobody --> maartenbrock
     
  • Maarten Brock
    Maarten Brock
    2007-09-04

    Logged In: YES
    user_id=888171
    Originator: NO

    Fixed in SDCC 2.7.3 #4908.

     
  • Maarten Brock
    Maarten Brock
    2007-09-04

    • milestone: --> fixed
    • status: open --> closed-fixed