\f
;; CALLI
;;
-;; Start with a subroutine to write out CLOBBERs starting at lr2 up to,
-;; but not including, the next parameter register. If operand[0] is null,
-;; it means that all the argument registers have been used.
-(define_expand "clobbers_to"
- [(clobber (match_operand:SI 0 "" ""))]
+;; Each call pattern is duplicated so that we can add CLOBBERs to the
+;; resulting insn.
+;;
+;; We indicate that LR0 is clobbered in the CALL_INSN itself. Otherwise,
+;; reorg will think it is just clobbered by the called function.
+
+(define_expand "call"
+ [(use (match_operand:SI 0 "" ""))
+ (use (match_operand 1 "" ""))
+ (use (match_operand 2 "" ""))]
""
"
-{
- int i;
- int high_regno;
-
- if (operands[0] == 0)
- high_regno = R_LR (18);
- else if (GET_CODE (operands[0]) != REG || REGNO (operands[0]) < R_LR (0)
- || REGNO (operands[0]) > R_LR (18))
- abort ();
- else
- high_regno = REGNO (operands[0]);
-
- for (i = R_LR (2); i < high_regno; i++)
- emit_insn (gen_rtx (CLOBBER, VOIDmode, gen_rtx (REG, SImode, i)));
+{ rtx insn = emit_call_insn (gen_call_internal (operands[0], operands[1]));
+ a29k_clobbers_to (insn, operands[2]);
DONE;
}")
-
-;; We indicate that LR0 is clobbered in the CALL_INSN itself. Otherwise,
-;; reorg will think it is just clobbered by the called function.
-
-(define_expand "call"
+
+(define_expand "call_internal"
[(parallel [(call (match_operand:SI 0 "" "")
(match_operand 1 "" ""))
- (clobber (scratch:SI))])
- (match_operand 2 "" "")]
+ (clobber (scratch:SI))])]
""
"
{
&& GET_CODE (XEXP (operands[0], 0)) == SYMBOL_REF)
operands[0] = gen_rtx (MEM, SImode,
force_reg (Pmode, XEXP (operands[0], 0)));
-
- operands[2] = gen_clobbers_to (operands[2]);
}")
(define_expand "call_value"
+ [(use (match_operand:SI 0 "gpc_reg_operand" ""))
+ (use (match_operand:SI 1 "" ""))
+ (use (match_operand 2 "" ""))
+ (use (match_operand 3 "" ""))]
+ ""
+ "
+{ rtx insn = emit_call_insn (gen_call_value_internal (operands[0], operands[1],
+ operands[2]));
+
+ a29k_clobbers_to (insn, operands[3]);
+ DONE;
+}")
+
+(define_expand "call_value_internal"
[(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
(call (match_operand:SI 1 "" "")
(match_operand 2 "" "")))
- (clobber (scratch:SI))])
- (match_operand 3 "" "")]
+ (clobber (scratch:SI))])]
""
"
{
operands[1] = gen_rtx (MEM, SImode,
force_reg (Pmode, XEXP (operands[1], 0)));
- operands[3] = gen_clobbers_to (operands[3]);
}")
(define_insn ""