This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

matching a call followed by a jump


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/



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]