emit_label (end_0_label);
}
+
+void
+ix86_expand_call (retval, fnaddr, callarg1, callarg2, pop)
+ rtx retval, fnaddr, callarg1, callarg2, pop;
+{
+ rtx use = NULL, call;
+
+ if (pop == const0_rtx)
+ pop = NULL;
+ if (TARGET_64BIT && pop)
+ abort ();
+
+ /* Static functions and indirect calls don't need the pic register. */
+ if (! TARGET_64BIT && flag_pic
+ && GET_CODE (XEXP (fnaddr, 0)) == SYMBOL_REF
+ && ! SYMBOL_REF_FLAG (XEXP (fnaddr, 0)))
+ {
+ current_function_uses_pic_offset_table = 1;
+ use_reg (&use, pic_offset_table_rtx);
+ }
+
+ if (TARGET_64BIT && INTVAL (callarg2) >= 0)
+ {
+ rtx al = gen_rtx_REG (QImode, 0);
+ emit_move_insn (al, callarg2);
+ use_reg (&use, al);
+ }
+
+ if (! call_insn_operand (XEXP (fnaddr, 0), Pmode))
+ {
+ fnaddr = copy_to_mode_reg (Pmode, XEXP (fnaddr, 0));
+ fnaddr = gen_rtx_MEM (QImode, fnaddr);
+ }
+
+ call = gen_rtx_CALL (VOIDmode, fnaddr, callarg1);
+ if (retval)
+ call = gen_rtx_SET (VOIDmode, retval, call);
+ if (pop)
+ {
+ pop = gen_rtx_PLUS (Pmode, stack_pointer_rtx, pop);
+ pop = gen_rtx_SET (VOIDmode, stack_pointer_rtx, pop);
+ call = gen_rtx_PARALLEL (VOIDmode, gen_rtvec (2, call, pop));
+ }
+
+ call = emit_call_insn (call);
+ if (use)
+ CALL_INSN_FUNCTION_USAGE (call) = use;
+}
+
\f
/* Clear stack slot assignments remembered from previous functions.
This is called from INIT_EXPANDERS once before RTL is emitted for each
(match_operand:SI 3 "" "")))])]
"!TARGET_64BIT"
{
- if (operands[3] == const0_rtx)
- {
- emit_insn (gen_call (operands[0], operands[1], constm1_rtx));
- DONE;
- }
- /* Static functions and indirect calls don't need
- current_function_uses_pic_offset_table. */
- if (flag_pic
- && GET_CODE (XEXP (operands[0], 0)) == SYMBOL_REF
- && ! SYMBOL_REF_FLAG (XEXP (operands[0], 0)))
- current_function_uses_pic_offset_table = 1;
- if (! call_insn_operand (XEXP (operands[0], 0), Pmode))
- XEXP (operands[0], 0) = copy_to_mode_reg (Pmode, XEXP (operands[0], 0));
- if (TARGET_64BIT)
- abort();
+ ix86_expand_call (NULL, operands[0], operands[1], operands[2], operands[3]);
+ DONE;
})
(define_insn "*call_pop_0"
[(call (match_operand:QI 0 "" "")
(match_operand 1 "" ""))
(use (match_operand 2 "" ""))]
- ;; Operand 1 not used on the i386.
""
{
- rtx insn;
- /* Static functions and indirect calls don't need
- current_function_uses_pic_offset_table. */
- if (flag_pic
- && GET_CODE (XEXP (operands[0], 0)) == SYMBOL_REF
- && ! SYMBOL_REF_FLAG (XEXP (operands[0], 0)))
- current_function_uses_pic_offset_table = 1;
-
- if (! call_insn_operand (XEXP (operands[0], 0), Pmode))
- XEXP (operands[0], 0) = copy_to_mode_reg (Pmode, XEXP (operands[0], 0));
- if (TARGET_64BIT && INTVAL (operands[2]) >= 0)
- {
- rtx reg = gen_rtx_REG (QImode, 0);
- emit_move_insn (reg, operands[2]);
- insn = emit_call_insn (gen_call_exp (operands[0], operands[1]));
- use_reg (&CALL_INSN_FUNCTION_USAGE (insn), reg);
- DONE;
- }
- insn = emit_call_insn (gen_call_exp (operands[0], operands[1]));
- DONE;
+ ix86_expand_call (NULL, operands[0], operands[1], operands[2], NULL);
+ DONE;
})
-(define_expand "call_exp"
- [(call (match_operand:QI 0 "" "")
- (match_operand 1 "" ""))]
- ""
- "")
-
(define_insn "*call_0"
[(call (mem:QI (match_operand 0 "constant_call_address_operand" ""))
(match_operand 1 "" ""))]
[(set_attr "type" "call")])
;; Call subroutine, returning value in operand 0
-;; (which must be a hard register).
(define_expand "call_value_pop"
[(parallel [(set (match_operand 0 "" "")
(match_operand:SI 4 "" "")))])]
"!TARGET_64BIT"
{
- if (operands[4] == const0_rtx)
- {
- emit_insn (gen_call_value (operands[0], operands[1], operands[2],
- constm1_rtx));
- DONE;
- }
- /* Static functions and indirect calls don't need
- current_function_uses_pic_offset_table. */
- if (flag_pic
- && GET_CODE (XEXP (operands[1], 0)) == SYMBOL_REF
- && ! SYMBOL_REF_FLAG (XEXP (operands[1], 0)))
- current_function_uses_pic_offset_table = 1;
- if (! call_insn_operand (XEXP (operands[1], 0), Pmode))
- XEXP (operands[1], 0) = copy_to_mode_reg (Pmode, XEXP (operands[1], 0));
+ ix86_expand_call (operands[0], operands[1], operands[2],
+ operands[3], operands[4]);
+ DONE;
})
(define_expand "call_value"
;; Operand 2 not used on the i386.
""
{
- rtx insn;
- /* Static functions and indirect calls don't need
- current_function_uses_pic_offset_table. */
- if (flag_pic
- && GET_CODE (XEXP (operands[1], 0)) == SYMBOL_REF
- && ! SYMBOL_REF_FLAG (XEXP (operands[1], 0)))
- current_function_uses_pic_offset_table = 1;
- if (! call_insn_operand (XEXP (operands[1], 0), Pmode))
- XEXP (operands[1], 0) = copy_to_mode_reg (Pmode, XEXP (operands[1], 0));
- if (TARGET_64BIT && INTVAL (operands[3]) >= 0)
- {
- rtx reg = gen_rtx_REG (QImode, 0);
- emit_move_insn (reg, operands[3]);
- insn = emit_call_insn (gen_call_value_exp (operands[0], operands[1],
- operands[2]));
- use_reg (&CALL_INSN_FUNCTION_USAGE (insn), reg);
- DONE;
- }
- insn = emit_call_insn (gen_call_value_exp (operands[0], operands[1],
- operands[2]));
+ ix86_expand_call (operands[0], operands[1], operands[2], operands[3], NULL);
DONE;
})
-(define_expand "call_value_exp"
- [(set (match_operand 0 "" "")
- (call (match_operand:QI 1 "" "")
- (match_operand:SI 2 "" "")))]
- ""
- "")
-
;; Call subroutine returning any type.
(define_expand "untyped_call"
simply pretend the untyped call returns a complex long double
value. */
- emit_call_insn (TARGET_FLOAT_RETURNS_IN_80387
- ? gen_call_value (gen_rtx_REG (XCmode, FIRST_FLOAT_REG),
- operands[0], const0_rtx,
- GEN_INT (SSE_REGPARM_MAX - 1))
- : gen_call (operands[0], const0_rtx,
- GEN_INT (SSE_REGPARM_MAX - 1)));
+ ix86_expand_call ((TARGET_FLOAT_RETURNS_IN_80387
+ ? gen_rtx_REG (XCmode, FIRST_FLOAT_REG) : NULL),
+ operands[0], const0_rtx, GEN_INT (SSE_REGPARM_MAX - 1),
+ NULL);
for (i = 0; i < XVECLEN (operands[2], 0); i++)
{