This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[lto] Use num_parm_types and nth_parm_type in block_move_libcall_safe_for_call_parm.
- From: Kazu Hirata <kazu at codesourcery dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Fri, 14 Jul 2006 09:37:03 -0700
- Subject: [lto] Use num_parm_types and nth_parm_type in block_move_libcall_safe_for_call_parm.
Hi,
Tested on x86_64-pc-linux-gnu. Committed to the LTO branch as
obvious.
Kazu Hirata
2006-07-14 Kazu Hirata <kazu@codesourcery.com>
* expr.c (block_move_libcall_safe_for_call_parm): Use
num_parm_types and nth_parm_type.
Index: expr.c
===================================================================
--- expr.c (revision 115362)
+++ expr.c (working copy)
@@ -1244,15 +1244,21 @@ block_move_libcall_safe_for_call_parm (v
argument. */
{
CUMULATIVE_ARGS args_so_far;
- tree fn, arg;
+ tree fn, parm_types;
+ int arity;
+ int i;
fn = emit_block_move_libcall_fn (false);
INIT_CUMULATIVE_ARGS (args_so_far, TREE_TYPE (fn), NULL_RTX, 0, 3);
- arg = TYPE_ARG_TYPES (TREE_TYPE (fn));
- for ( ; arg != void_list_node ; arg = TREE_CHAIN (arg))
+ parm_types = TYPE_ARG_TYPES (TREE_TYPE (fn));
+ /* We subtract 1 from the result of num_parm_types to skip the
+ void_type_node at the end of parm_types. */
+ arity = num_parm_types (parm_types) - 1;
+ for (i = 0; i < arity; i++)
{
- enum machine_mode mode = TYPE_MODE (TREE_VALUE (arg));
+ tree type = nth_parm_type (parm_types, i);
+ enum machine_mode mode = TYPE_MODE (type);
rtx tmp = FUNCTION_ARG (args_so_far, mode, NULL_TREE, 1);
if (!tmp || !REG_P (tmp))
return false;