This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: How do you emit RTL for a jump to a mem/symbol instead of an asm label?
On Sun, Aug 21, 2016 at 02:04:49PM -0500, Daniel Santos wrote:
> Thanks for the response! Perhaps an UNSPEC insn is needed here because I
> have work to do on other passes too. For example, when the debug info is
> created, it's giving the wrong location (on the stack) for where some
> registers were saved.
Don't worry about this until you have the basics working. It is fiddly
work but not really hard.
> But my primary question is about how to generate a jump at the end of
You could have a look at the rs6000 patterns (in rs6000.md)
"*return_and_restore_gpregs_<mode>_r11" and the function that creates
such patterns, "rs6000_emit_savres_rtx" in (rs6000.c). This does a whole
bunch more than you need, but maybe you'll get the idea. Some points:
- The pattern should describe all it does (restore what regs, etc.), not
just the jump;
- You should set a JUMP_LABEL (to ret_rtx) on the jump, and it should _be_
a jump_insn;
- You want a separate pattern in the machine description for this.
HTH,
Segher