Commit 7ab6a03b by Richard Sandiford Committed by Richard Sandiford

mips.c (build_mips16_call_stub): Emit all direct float calls here, rather than…

mips.c (build_mips16_call_stub): Emit all direct float calls here, rather than leaving some to the caller.

gcc/
	* config/mips/mips.c (build_mips16_call_stub): Emit all direct
	float calls here, rather than leaving some to the caller.
	Use call_internal_direct and call_value_internal_direct.
	* config/mips/mips.md (call_internal_direct): New pattern.
	(call_value_internal_direct): Likewise.

From-SVN: r128233
parent 8d1d0dee
2007-09-07 Richard Sandiford <richard@codesourcery.com> 2007-09-07 Richard Sandiford <richard@codesourcery.com>
* config/mips/mips.c (build_mips16_call_stub): Emit all direct
float calls here, rather than leaving some to the caller.
Use call_internal_direct and call_value_internal_direct.
* config/mips/mips.md (call_internal_direct): New pattern.
(call_value_internal_direct): Likewise.
2007-09-07 Richard Sandiford <richard@codesourcery.com>
* config/mips/mips.c (mips_base_move_loop_invariants): New variable. * config/mips/mips.c (mips_base_move_loop_invariants): New variable.
(mips_set_mips16_mode): Restore flag_move_loop_invariants, then set (mips_set_mips16_mode): Restore flag_move_loop_invariants, then set
to 0 for MIPS16. to 0 for MIPS16.
...@@ -9339,6 +9339,7 @@ build_mips16_call_stub (rtx retval, rtx fn, rtx arg_size, int fp_code) ...@@ -9339,6 +9339,7 @@ build_mips16_call_stub (rtx retval, rtx fn, rtx arg_size, int fp_code)
tree stubid, stubdecl; tree stubid, stubdecl;
int need_comma; int need_comma;
unsigned int f; unsigned int f;
rtx insn;
/* We don't need to do anything if we aren't in mips16 mode, or if /* We don't need to do anything if we aren't in mips16 mode, or if
we were invoked with the -msoft-float option. */ we were invoked with the -msoft-float option. */
...@@ -9604,34 +9605,26 @@ build_mips16_call_stub (rtx retval, rtx fn, rtx arg_size, int fp_code) ...@@ -9604,34 +9605,26 @@ build_mips16_call_stub (rtx retval, rtx fn, rtx arg_size, int fp_code)
if (fpret && ! l->fpret) if (fpret && ! l->fpret)
error ("cannot handle inconsistent calls to %qs", fnname); error ("cannot handle inconsistent calls to %qs", fnname);
if (retval == NULL_RTX)
insn = gen_call_internal_direct (fn, arg_size);
else
insn = gen_call_value_internal_direct (retval, fn, arg_size);
insn = emit_call_insn (insn);
/* If we are calling a stub which handles a floating point return /* If we are calling a stub which handles a floating point return
value, we need to arrange to save $18 in the prologue. We do value, we need to arrange to save $18 in the prologue. We do
this by marking the function call as using the register. The this by marking the function call as using the register. The
prologue will later see that it is used, and emit code to save prologue will later see that it is used, and emit code to save
it. */ it. */
if (l->fpret) if (l->fpret)
{ CALL_INSN_FUNCTION_USAGE (insn) =
rtx insn; gen_rtx_EXPR_LIST (VOIDmode,
gen_rtx_USE (VOIDmode, gen_rtx_REG (word_mode, 18)),
CALL_INSN_FUNCTION_USAGE (insn));
if (retval == NULL_RTX) /* Return 1 to tell the caller that we've generated the call
insn = gen_call_internal (fn, arg_size); insn. */
else return 1;
insn = gen_call_value_internal (retval, fn, arg_size);
insn = emit_call_insn (insn);
CALL_INSN_FUNCTION_USAGE (insn) =
gen_rtx_EXPR_LIST (VOIDmode,
gen_rtx_USE (VOIDmode, gen_rtx_REG (word_mode, 18)),
CALL_INSN_FUNCTION_USAGE (insn));
/* Return 1 to tell the caller that we've generated the call
insn. */
return 1;
}
/* Return 0 to let the caller generate the call insn. */
return 0;
} }
/* An entry in the mips16 constant pool. VALUE is the pool constant, /* An entry in the mips16 constant pool. VALUE is the pool constant,
......
...@@ -5666,6 +5666,18 @@ ...@@ -5666,6 +5666,18 @@
[(set_attr "jal" "indirect,direct") [(set_attr "jal" "indirect,direct")
(set_attr "extended_mips16" "no,yes")]) (set_attr "extended_mips16" "no,yes")])
;; A pattern for calls that must be made directly. It is used for
;; MIPS16 calls that the linker may need to redirect to a hard-float
;; stub; the linker relies on the call relocation type to detect when
;; such redirection is needed.
(define_insn "call_internal_direct"
[(call (mem:SI (match_operand 0 "const_call_insn_operand"))
(match_operand 1))
(const_int 1)
(clobber (reg:SI 31))]
""
{ return MIPS_CALL ("jal", operands, 0); })
(define_insn "call_split" (define_insn "call_split"
[(call (mem:SI (match_operand 0 "call_insn_operand" "cS")) [(call (mem:SI (match_operand 0 "call_insn_operand" "cS"))
(match_operand 1 "" "")) (match_operand 1 "" ""))
...@@ -5717,6 +5729,16 @@ ...@@ -5717,6 +5729,16 @@
{ return MIPS_CALL ("jal", operands, 1); } { return MIPS_CALL ("jal", operands, 1); }
[(set_attr "type" "call")]) [(set_attr "type" "call")])
;; See call_internal_direct.
(define_insn "call_value_internal_direct"
[(set (match_operand 0 "register_operand")
(call (mem:SI (match_operand 1 "const_call_insn_operand"))
(match_operand 2)))
(const_int 1)
(clobber (reg:SI 31))]
""
{ return MIPS_CALL ("jal", operands, 1); })
;; See comment for call_internal. ;; See comment for call_internal.
(define_insn_and_split "call_value_multiple_internal" (define_insn_and_split "call_value_multiple_internal"
[(set (match_operand 0 "register_operand" "") [(set (match_operand 0 "register_operand" "")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment