This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
How to force an indirect jump?
- From: Camo Johnson <da_cramp at yahoo dot de>
- To: gcc at gcc dot gnu dot org
- Date: Thu, 7 Jul 2011 14:48:32 +0100 (BST)
- Subject: How to force an indirect jump?
Hello gcc gurus,
I have a problem with jumps. Our architecture can only handle 13bit direct jumps and 18 bit indirect jumps. Sometimes those 13bit are not enough and I want to give the user the possibility to force jumps to be indirect jumps.
Somehow I was not able to find a way to do so. The main problem is that I can't find a way to tell the compiler that I need a register for the indirect jump.
I thought the most obvious way would be to "force_reg" the label operand in the expander definition. But this fails because the move patterns don't recognize a code_label as a legal operand (What operand type is a code_label, can it be placed in a register via a pattern?).
An other idea was to acquire a scratch register, but this results in an endless loop when I try to compile a simple c file.
Code was like this:
(define_insn "jump"
[(set (pc)
(label_ref (match_operand 0 "" "")))
(clobber (match_scratch:HI 1 "r"))]
...
Building a parallel pattern setting an register with the code label and setting the pc with this register fails, because gen_jump can't handle a pattern with an aditional register operand.
So, basically, I'm out of ideas. If anyone has an idea how i can acquire a register and force the label into it, I would be very grateful.
Thanks in advance,
Eric Neumann