callee_saves used for non-leaf function

  • Patryk

    Patryk - 2009-01-20


    When using callee_saves for a function that calls other functions, is it needed to use callee_saves for every function down the calling tree (to be safe)?

    If not, then let's suppose f1() calling f2(), f2() calling f3(), f2() tagged with callee_saves. f1() won't push any registers when calling f2(). f2() pushes (at it's begin) all registers used by itself. f2() don't know which registers f1() and f3() are using, so before calling f3() it should backup all registers not backup yet when it started - right?

    Quick experiment with my quite large project didn't confirm such behaviour (f2() didn't push all registers) - bug or need to extend callee_saves description in manual?


    • Maarten Brock

      Maarten Brock - 2009-01-21


      "f2() didn't push all registers"

      Could you be more specific? Do you mean it does push enough registers at entry of f2, and also some when calling f3, but not enough of them?

      AFAIK callee_saves is not regression tested so I would not be surprised if it still has bugs. If you think it is a bug, file it in the bug tracker as it will surely get lost here in the forum.


      • Patryk

        Patryk - 2009-01-22

        Let's assume callee_saves is idiot-proof. Correct me if I'm wrong: f2() needs to assure that ALL registers (R0..R7) gets pushed before calling f3(), because f2() don't know which registers f1() and f3() are using.

        If that's true, then I try to provide an example.


Log in to post a comment.