This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch] calls.c, optabs.c: Remove multiple references to thelibcall return reg.
Hi Richard,
> This should be
>
> result = emit_library_call_value (memcmp_libfunc, NULL_RTX, ...);
>
> I.e. the return value of emit_library_call_value should always
> be honored. And if we don't have a specific place it should go
> already, you just use NULL_RTX and let the call generate the
> target register.
>
> The patch is ok with that change.
Previously, I committed a patch that did not honor the return value of
emit_library_call, so I fixed that, too. I attached the final patch
that I comitted.
Kazu Hirata
2002-09-17 Kazu Hirata <kazu@cs.umass.edu>
* optabs.c (prepare_cmp_insn): Let emit_library_call_value
generate a pseudo reg that receives the result of a libcall.
(prepare_float_lib_cmp): Likewise.
Index: optabs.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/optabs.c,v
retrieving revision 1.147
diff -c -p -r1.147 optabs.c
*** optabs.c 16 Sep 2002 18:47:59 -0000 1.147
--- optabs.c 17 Sep 2002 18:53:41 -0000
*************** prepare_cmp_insn (px, py, pcomparison, s
*** 3436,3464 ****
#endif
{
#ifdef TARGET_MEM_FUNCTIONS
! emit_library_call (memcmp_libfunc, LCT_PURE_MAKE_BLOCK,
! TYPE_MODE (integer_type_node), 3,
! XEXP (x, 0), Pmode, XEXP (y, 0), Pmode,
! convert_to_mode (TYPE_MODE (sizetype), size,
! TREE_UNSIGNED (sizetype)),
! TYPE_MODE (sizetype));
#else
! emit_library_call (bcmp_libfunc, LCT_PURE_MAKE_BLOCK,
! TYPE_MODE (integer_type_node), 3,
! XEXP (x, 0), Pmode, XEXP (y, 0), Pmode,
! convert_to_mode (TYPE_MODE (integer_type_node),
! size,
! TREE_UNSIGNED (integer_type_node)),
! TYPE_MODE (integer_type_node));
#endif
- /* Immediately move the result of the libcall into a pseudo
- register so reload doesn't clobber the value if it needs
- the return register for a spill reg. */
- result = gen_reg_rtx (TYPE_MODE (integer_type_node));
result_mode = TYPE_MODE (integer_type_node);
- emit_move_insn (result,
- hard_libcall_value (result_mode));
}
*px = result;
*py = const0_rtx;
--- 3436,3458 ----
#endif
{
#ifdef TARGET_MEM_FUNCTIONS
! result = emit_library_call_value (memcmp_libfunc, NULL_RTX, LCT_PURE_MAKE_BLOCK,
! TYPE_MODE (integer_type_node), 3,
! XEXP (x, 0), Pmode, XEXP (y, 0), Pmode,
! convert_to_mode (TYPE_MODE (sizetype), size,
! TREE_UNSIGNED (sizetype)),
! TYPE_MODE (sizetype));
#else
! result = emit_library_call_value (bcmp_libfunc, NULL_RTX, LCT_PURE_MAKE_BLOCK,
! TYPE_MODE (integer_type_node), 3,
! XEXP (x, 0), Pmode, XEXP (y, 0), Pmode,
! convert_to_mode (TYPE_MODE (integer_type_node),
! size,
! TREE_UNSIGNED (integer_type_node)),
! TYPE_MODE (integer_type_node));
#endif
result_mode = TYPE_MODE (integer_type_node);
}
*px = result;
*py = const0_rtx;
*************** prepare_cmp_insn (px, py, pcomparison, s
*** 3483,3496 ****
if (unsignedp && ucmp_optab->handlers[(int) mode].libfunc)
libfunc = ucmp_optab->handlers[(int) mode].libfunc;
! emit_library_call (libfunc, LCT_CONST_MAKE_BLOCK, word_mode, 2, x, mode,
! y, mode);
!
! /* Immediately move the result of the libcall into a pseudo
! register so reload doesn't clobber the value if it needs
! the return register for a spill reg. */
! result = gen_reg_rtx (word_mode);
! emit_move_insn (result, hard_libcall_value (word_mode));
/* Integer comparison returns a result that must be compared against 1,
so that even if we do an unsigned compare afterward,
--- 3477,3484 ----
if (unsignedp && ucmp_optab->handlers[(int) mode].libfunc)
libfunc = ucmp_optab->handlers[(int) mode].libfunc;
! result = emit_library_call_value (libfunc, NULL_RTX, LCT_CONST_MAKE_BLOCK,
! word_mode, 2, x, mode, y, mode);
/* Integer comparison returns a result that must be compared against 1,
so that even if we do an unsigned compare afterward,
*************** prepare_float_lib_cmp (px, py, pcomparis
*** 4006,4014 ****
if (libfunc == 0)
abort ();
! result = gen_reg_rtx (word_mode);
! emit_library_call_value (libfunc, result, LCT_CONST_MAKE_BLOCK,
! word_mode, 2, x, mode, y, mode);
*px = result;
*py = const0_rtx;
*pmode = word_mode;
--- 3994,4001 ----
if (libfunc == 0)
abort ();
! result = emit_library_call_value (libfunc, NULL_RTX, LCT_CONST_MAKE_BLOCK,
! word_mode, 2, x, mode, y, mode);
*px = result;
*py = const0_rtx;
*pmode = word_mode;