Commit 2d8d0db8 by Richard Kenner

(expand_inline_function): Allow extra arguments and force their

evaluation for side-effects.

From-SVN: r6661
parent d391688a
/* Procedure integration for GNU CC. /* Procedure integration for GNU CC.
Copyright (C) 1988, 1991, 1993 Free Software Foundation, Inc. Copyright (C) 1988, 1991, 1993, 1994 Free Software Foundation, Inc.
Contributed by Michael Tiemann (tiemann@cygnus.com) Contributed by Michael Tiemann (tiemann@cygnus.com)
This file is part of GNU CC. This file is part of GNU CC.
...@@ -1172,29 +1172,39 @@ expand_inline_function (fndecl, parms, target, ignore, type, structure_value_add ...@@ -1172,29 +1172,39 @@ expand_inline_function (fndecl, parms, target, ignore, type, structure_value_add
nargs = list_length (DECL_ARGUMENTS (fndecl)); nargs = list_length (DECL_ARGUMENTS (fndecl));
/* We expect PARMS to have the right length; don't crash if not. */ /* Check that the parms type match and that sufficient arguments were
if (list_length (parms) != nargs) passed. Since the appropriate conversions or default promotions have
return (rtx) (HOST_WIDE_INT) -1; already been applied, the machine modes should match exactly. */
/* Also check that the parms type match. Since the appropriate
conversions or default promotions have already been applied,
the machine modes should match exactly. */
for (formal = DECL_ARGUMENTS (fndecl), for (formal = DECL_ARGUMENTS (fndecl),
actual = parms; actual = parms;
formal; formal;
formal = TREE_CHAIN (formal), formal = TREE_CHAIN (formal),
actual = TREE_CHAIN (actual)) actual = TREE_CHAIN (actual))
{ {
tree arg = TREE_VALUE (actual); tree arg;
enum machine_mode mode = TYPE_MODE (DECL_ARG_TYPE (formal)); enum machine_mode mode;
if (mode != TYPE_MODE (TREE_TYPE (arg)))
if (actual == 0)
return (rtx) (HOST_WIDE_INT) -1; return (rtx) (HOST_WIDE_INT) -1;
/* If they are block mode, the types should match exactly.
They don't match exactly if TREE_TYPE (FORMAL) == ERROR_MARK_NODE, arg = TREE_VALUE (actual);
which could happen if the parameter has incomplete type. */ mode= TYPE_MODE (DECL_ARG_TYPE (formal));
if (mode == BLKmode && TREE_TYPE (arg) != TREE_TYPE (formal))
if (mode != TYPE_MODE (TREE_TYPE (arg))
/* If they are block mode, the types should match exactly.
They don't match exactly if TREE_TYPE (FORMAL) == ERROR_MARK_NODE,
which could happen if the parameter has incomplete type. */
|| (mode == BLKmode && TREE_TYPE (arg) != TREE_TYPE (formal)))
return (rtx) (HOST_WIDE_INT) -1; return (rtx) (HOST_WIDE_INT) -1;
} }
/* Extra arguments are valid, but will be ignored below, so we must
evaluate them here for side-effects. */
for (; actual; actual = TREE_CHAIN (actual))
expand_expr (TREE_VALUE (actual), const0_rtx,
TYPE_MODE (TREE_TYPE (TREE_VALUE (actual))), 0);
/* Make a binding contour to keep inline cleanups called at /* Make a binding contour to keep inline cleanups called at
outer function-scope level from looking like they are shadowing outer function-scope level from looking like they are shadowing
parameter declarations. */ parameter declarations. */
......
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