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 check_cast.
- From: Kazu Hirata <kazu at codesourcery dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Fri, 14 Jul 2006 12:56:48 -0700
- Subject: [lto] Use num_parm_types and nth_parm_type in check_cast.
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>
* ipa-type-escape.c (check_cast): Use num_parm_types and
nth_parm_type.
Index: ipa-type-escape.c
===================================================================
--- ipa-type-escape.c (revision 115362)
+++ ipa-type-escape.c (working copy)
@@ -704,15 +704,21 @@ check_cast (tree to_type, tree from)
static void
check_function_parameter_and_return_types (tree fn, bool escapes)
{
+ tree parm_types = TYPE_ARG_TYPES (TREE_TYPE (fn));
tree arg;
- if (TYPE_ARG_TYPES (TREE_TYPE (fn)))
+ if (parm_types)
{
- for (arg = TYPE_ARG_TYPES (TREE_TYPE (fn));
- arg && TREE_VALUE (arg) != void_type_node;
- arg = TREE_CHAIN (arg))
+ int len = num_parm_types (parm_types);
+ int i;
+
+ if (nth_parm_type (parm_types, len - 1) == void_type_node)
+ len--;
+
+ for (i = 0; i < len; i++)
{
- tree type = get_canon_type (TREE_VALUE (arg), false, false);
+ tree parm_type = nth_parm_type (parm_types, i);
+ tree type = get_canon_type (parm_type, false, false);
if (escapes)
mark_interesting_type (type, EXPOSED_PARAMETER);
}