Skip to content
This repository has been archived by the owner on Sep 2, 2023. It is now read-only.

Prologue/Epilogue: No need to modify SP in leaf functions #26

Open
mbitsnbites opened this issue Sep 27, 2021 · 0 comments
Open

Prologue/Epilogue: No need to modify SP in leaf functions #26

mbitsnbites opened this issue Sep 27, 2021 · 0 comments

Comments

@mbitsnbites
Copy link
Member

In leaf functions there is no need to update the SP register (i.e. subtract in the prologue and add in the epilogue).

So this:

    add     sp, sp, #-8
    stw     r17, [sp, #4]
    stw     r16, [sp, #0]
    ...
    ldw     r16, [sp, #0]
    ldw     r17, [sp, #4]
    add     sp, sp, #8
    ret

...could be turned into this:

    stw     r17, [sp, #-4]
    stw     r16, [sp, #-8]
    ...
    ldw     r16, [sp, #-8]
    ldw     r17, [sp, #-4]
    ret
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant