This is the mail archive of the
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 08/21/2016 05:59 PM, Segher Boessenkool wrote:
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_
- You want a separate pattern in the machine description for this.
Oh perfect! Almost every thing I need can be expressed in the .md! :) I
was manually adding notes for these things. I had already started
hacking together something in i386.md, so I'm glad I was headed in the
right direction. I guess it's time to read the Machine Descriptions
section of the gccint manual. Thanks so much Segher!