Andrew Waterman <
wate...@eecs.berkeley.edu> writes:
> GCC has the concept of a "simple" return, used by functions that don't need
> an epilogue. In RISC-V, the idiomatic way of expressing that concept is
> "ret".
>
> But, in the general case, GCC can use any register as the target for a
> procedure exit, hence the "jr xx". Obviously, "xx" will almost always be
> "ra", except for indirect sibcalls. So usually these things end up
> assembling to the same thing, even though they're expressed differently.
Thanks for clarifying. When I began reading GCC RISC-V code I was
surprised by that and I thought, my suggested change would be easier
for novices (which I'm also still are concerning some RISC-V stuff,
especially linker relaxations is a topic I still want to understand in
more detail).
> Clearly, we could add extra code to one path or the other to make them look
> the same, but IMO that's just extra baggage that serves no functional
> purpose. I'm all for aesthetic improvements when they're Pareto-superior,
> but this isn't such a case.
OK, I understand and that also makes sense.
urs