3
I am developing a code in mips in order to perform a binary search recursively, well along the development have arisen some doubts, being them:
Right after my function call, I pop my arguments, but should I also pop my $ra? Performing as below:
lw $s0, 0($sp) # desempilha o valor a ser buscado lw $s1, 0($sp) # desempilha valor Ult lw $s2, 0($sp) # desempilha valor Pri lw $s3, 0($sp) # desempilha ref vetor A lw $ra, 0($sp) # desempilha o $ra
And at the end when I’m going to make the recursive call I need to stack all my arguments first too right? Besides my $ra? By the way, it is he who will control so that I do not get lost in the recursion calls?
If anyone can, I’d like a simple example.
Note: I know that the passage of arguments should not be done using mips convention stacks, but this work requires this procedure.