totalspectrum / spin2cpp

Tool to convert Parallax Propeller Spin code to PASM, C++ or C
Other
46 stars 17 forks source link

Jumping to function return on P1 always generates long jump #427

Open Wuerfel21 opened 9 months ago

Wuerfel21 commented 9 months ago

PRI {+noinline} test(a,b)
  if a > 0
    if b > 0
      return 1
    else
      return 2
  else
    if b > 0
      return 3
    else
      return 4
      'return test(b,a) + 1

PUB main
  outa := test(cnt,ina)

generates a lot of

 if_ae  rdlong  __pc,__pc
    long    @@@_test_ret

-style branches. If the function has an epilogue (see the commented out line), the problem disappears because everything jumps into the epilogue instead.