I read here that a jmpl instruction must be followed by nop.
The SPARC V8 manual tells me that an rett instruction must always be preceded by a jmpl instruction.
But, I haven't been able to find a relation between jmpl and restore instructions. I am currently working on SPARC V8 architecture and one of the ELF files I encountered has a restore right after jmpl, while I expected an nop. I don't know if this is correct or the ELF (and by extension the SPARC code) is wrong.
Is having restore right after jmpl correct?
... and the page you linked tells you why:
This means: The
nopis not a requirement of the CPU, but it is an advise of the author of the web page for programmers to avoid errors.On another page of the same course the author explains that a professional programmer (or a C compiler) would use the following sequence to return from a function:
This means that it is not only allowed to use
restorein the delay slot of thejmplinstruction, but it is even the normal sequence for returning from a function.