Stelian Pop wrote: > However, I didn't find a way to say to gcc that it cannot use the "direct" > jump in some cases, and force it to use the "indirect_jump" instead. > >> I don't think it'll work to have a jump insn that is sometimes direct, >> sometimes indirect. > >> Looking at how the rs6000 backend handles direct and indirect calls and >> jumps might give you some inspiration too. > > Well, I already did look at all the backends, but didn't find the answer > (although the answer probably is hidden somewhere inside those files...). > > As for the rs6000 backend I see a simple direct call pattern, not sure what > you want me to look at:
It's been a few years since I used to work with that backend so it might have changed beyond all recognition, but IIRC the longcall mechanism manages to choose between short immediate-offset PC-relative branches and long indirect-through-register jumps at compile-time, and it might be possible to draw some inspiration from how it does that. cheers, DaveK