On some RISC architectures there's no notion of stack pointer register - there's some register, used to hold a stack pointer and address of the stack frame, but nowhere told explicitly what.

So, how do I found out what register being used for storing a stack pointer on RISC architectures?

1 Answer 1


In most cases, even if there's no register that has any hardware/instruction support for being a stack pointer, either the processor manufacturer or the operating system designer defines an ABI (application binary interface) which, among others, contains a convention for calling subroutines. Compiler vendors normally conform to this ABI to make their code interchangable with that of other vendors, or standard libraries.

The wikipedia page about calling conventions has information about the standard conventions of most of the common processors. as well as links to some of the manufacturer documents.

However, noone forces you to use that exact convention. You could, for example, write a JVM that has the Java stack in one register, and the C/native stack in a different one. Or, you could use one register for the call/return stack, a different one for function parameters, and a third one for local variables. The hardware doesn't care, so you can do this if you feel it's advantageous to your application; however, in most cases, not using the standard ABI causes you trouble (as you can't use standard libraries anymore) without gaining you anything.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.