#32 Unecessary code generated in function calls.

closed-fixed
nobody
None
5
2003-09-06
2003-07-20
No

The code for getting the function parameters

push ix
ld ix, #0
add ix, sp
[function boy]
pop ix

is generated even for functions without parameters, for
example

int test(void)
{
return(2);
}

compiles into

push ix
ld ix, #0
add ix, sp
ld hl, #0x0002
pop ix
ret

where 4 out of 6 instructions do nothing.

Discussion

  • Erik Petrich
    Erik Petrich
    2003-09-06

    • status: open --> closed
     
  • Erik Petrich
    Erik Petrich
    2003-09-06

    Logged In: YES
    user_id=635249

    This is improved in src/z80/gen.c 1.117. The ix register
    setup is skipped if there are no parameters passed on the
    stack and no local variables allocated on the stack.

     
  • Erik Petrich
    Erik Petrich
    2003-09-06

    • labels: 100692 -->
    • status: closed --> closed-fixed