Commit 48144cd4 by Richard Henderson Committed by Richard Henderson

function.c (assign_parms): Don't recombine complex args if fnargs is unchanged from orig_fnargs.

        * function.c (assign_parms): Don't recombine complex args if
        fnargs is unchanged from orig_fnargs.
        (split_complex_args): Return args without complex before copying.
        Re-layout the modified parameters.

From-SVN: r69236
parent e2fcbaa3
2003-07-11 Richard Henderson <rth@redhat.com>
* function.c (assign_parms): Don't recombine complex args if
fnargs is unchanged from orig_fnargs.
(split_complex_args): Return args without complex before copying.
Re-layout the modified parameters.
2003-07-11 J"orn Rennecke <joern.rennecke@superh.com> 2003-07-11 J"orn Rennecke <joern.rennecke@superh.com>
* regclass.c (choose_hard_reg_mode): Add third argument. * regclass.c (choose_hard_reg_mode): Add third argument.
......
...@@ -5072,15 +5072,11 @@ assign_parms (tree fndecl) ...@@ -5072,15 +5072,11 @@ assign_parms (tree fndecl)
} }
} }
if (SPLIT_COMPLEX_ARGS) if (SPLIT_COMPLEX_ARGS && fnargs != orig_fnargs)
{ {
parm = orig_fnargs; for (parm = orig_fnargs; parm; parm = TREE_CHAIN (parm))
for (; parm; parm = TREE_CHAIN (parm))
{ {
tree type = TREE_TYPE (parm); if (TREE_CODE (TREE_TYPE (parm)) == COMPLEX_TYPE)
if (TREE_CODE (type) == COMPLEX_TYPE)
{ {
SET_DECL_RTL (parm, SET_DECL_RTL (parm,
gen_rtx_CONCAT (DECL_MODE (parm), gen_rtx_CONCAT (DECL_MODE (parm),
...@@ -5205,30 +5201,49 @@ assign_parms (tree fndecl) ...@@ -5205,30 +5201,49 @@ assign_parms (tree fndecl)
} }
} }
/* If ARGS contains entries with complex types, split the entry into two
entries of the component type. Return a new list of substitutions are
needed, else the old list. */
static tree static tree
split_complex_args (tree args) split_complex_args (tree args)
{ {
tree p; tree p;
/* Before allocating memory, check for the common case of no complex. */
for (p = args; p; p = TREE_CHAIN (p))
if (TREE_CODE (TREE_TYPE (p)) == COMPLEX_TYPE)
goto found;
return args;
found:
args = copy_list (args); args = copy_list (args);
for (p = args; p; p = TREE_CHAIN (p)) for (p = args; p; p = TREE_CHAIN (p))
{ {
tree complex_type = TREE_TYPE (p); tree type = TREE_TYPE (p);
if (TREE_CODE (type) == COMPLEX_TYPE)
if (TREE_CODE (complex_type) == COMPLEX_TYPE)
{ {
tree decl; tree decl;
tree subtype = TREE_TYPE (complex_type); tree subtype = TREE_TYPE (type);
/* Rewrite the PARM_DECL's type with its component. */ /* Rewrite the PARM_DECL's type with its component. */
TREE_TYPE (p) = subtype; TREE_TYPE (p) = subtype;
DECL_ARG_TYPE (p) = TREE_TYPE (DECL_ARG_TYPE (p)); DECL_ARG_TYPE (p) = TREE_TYPE (DECL_ARG_TYPE (p));
DECL_MODE (p) = VOIDmode;
DECL_SIZE (p) = NULL;
DECL_SIZE_UNIT (p) = NULL;
layout_decl (p, 0);
/* Build a second synthetic decl. */
decl = build_decl (PARM_DECL, NULL_TREE, subtype); decl = build_decl (PARM_DECL, NULL_TREE, subtype);
DECL_ARG_TYPE (decl) = DECL_ARG_TYPE (p); DECL_ARG_TYPE (decl) = DECL_ARG_TYPE (p);
layout_decl (decl, 0);
/* Splice it in; skip the new decl. */
TREE_CHAIN (decl) = TREE_CHAIN (p); TREE_CHAIN (decl) = TREE_CHAIN (p);
TREE_CHAIN (p) = decl; TREE_CHAIN (p) = decl;
p = decl;
} }
} }
......
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