This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
matching a call followed by a jump
- From: "Jan Hoogerbrugge" <hoogerbrugge at hotmail dot com>
- To: gcc at gcc dot gnu dot org
- Date: Tue, 20 Jan 2004 14:54:42 +0100
- Subject: matching a call followed by a jump
- Bcc:
Hi,
My target architecture implements calls as follows
move L123 -> ra // copy return address to return address
register
jump(foo)
L123:
If a call is followed by a jump, to let's say L456,
then the following code is generated:
move L123 -> ra
jump(foo)
L123:
jump(L456)
Obviously, one would like to generate the following
code:
move L456 -> ra
jump(foo)
How to do this? Currently I use the following code
to match function calls to functions that do not
return a result:
(define_insn "calli"
[(call (mem:SI (match_operand:SI 0 "calli_operand" ""))
(match_operand 1 "" ""))]
""
{
if(CONSTANT_P(XEXP(operands[0], 0)))
return "uimm(C%=) -> r2\;ijmpi(%0)\t\t[CALL]\nC%=:";
else
return "uimm(C%=) -> r2\;ijmpf r0
%0\t\t[CALL]\nC%=:";
}
)
(define_insn "call"
[(call (mem:SI (match_operand:SI 0 "memory_operand" "m"))
(match_operand 1 "" ""))]
""
{
if(CONSTANT_P(XEXP(operands[0], 0)))
return "uimm(C%=) -> r2\;ijmpi(%0)\t\t[CALL]\nC%=:";
else
return "uimm(C%=) -> r2\;ijmpf
r0%0\t\t[CALL]\nC%=:";
}
)
Any idea how to match a call followed by a jump? I tried several
things without success.
Jan
_________________________________________________________________
Hotmail en Messenger on the move
http://www.msn.nl/communicatie/smsdiensten/hotmailsmsv2/