Menu

#279 Accessing the stack

None
open
nobody
None
7
2023-02-20
2009-09-30
No

Accessing the stack is extremly inefficient in sdcc. This currently is sdcc's worst code quality problem for many ports. The problem can be seen in the attahced files:

stackhell.c, a minimal example.
stackhell2.c, which illustrates how bad the problem can become when using local aggregates.
device/lib/sdcc-mullong.c illustrates a real-world case, where sdcc generates approx. 700 bytes for Z80 vs. spprox 250 bytes for non-free HITECH-C and approx. 450 bytes for free z88dk. The situation is similar with other ports (unless compiling the function as not reentrant).

Related

Wiki: SDCC 4.3.0 Release
Wiki: SDCC 4.4.0 Release
Wiki: SDCC 4.5.0 Release

Discussion

  • Philipp Klaus Krause

    Minimal example

     
  • Philipp Klaus Krause

    Aggregate example

     
  • Philipp Klaus Krause

    • priority: 9 --> 8
     
  • Philipp Klaus Krause

    Reducing priority by one, since this performance problem is not as important as the standard-compliance problem addressed by the other priority 9 items.

    Philipp

     
  • Philipp Klaus Krause

    One way to fix this would be to make the addresses of local aggregates rematerializeable.

    Philipp

     
  • Philipp Klaus Krause

    • Group: -->
    • Priority: 8 --> 7
     
  • Philipp Klaus Krause

    In [r10602], basic support for rematerialization of on-stack addresses has been implemented for stm8.

    Philipp

     
  • Philipp Klaus Krause

    Support for rematerialization of stack addresses has improved in stm8, and has been ported to pdk13, pdk14, pdk15.
    It is still missing for z80, z180, gbz80, tlcs90, r2k, r3ka, mcs51, ds390, hc08, s08.

     
    • Philipp Klaus Krause

      As of [r12795], all stable ports except for mcs51 and ds390 have support for rematerialization of stack addresses.

       

Log in to post a comment.