Commit 4730fa4f by Gavin Romig-Koch Committed by Gavin Romig-Koch

mips.c (mips_expand_prologue): If the last named argument is the vararg marker "va_list"...

	* config/mips/mips.c (mips_expand_prologue): If the last
	named argument is the vararg marker "va_list", treat it as
	an unnamed argument.

From-SVN: r32421
parent 917d7595
2000-03-08 Gavin Romig-Koch <gavin@cetus.cygnus.com>
* config/mips/mips.c (mips_expand_prologue): If the last
named argument is the vararg marker "va_list", treat it as
an unnamed argument.
2000-03-08 Clinton Popetz <cpopetz@cygnus.com> 2000-03-08 Clinton Popetz <cpopetz@cygnus.com>
* dbxout.c (dbxout_parms): When correcting for promoted * dbxout.c (dbxout_parms): When correcting for promoted
......
...@@ -6613,7 +6613,7 @@ mips_expand_prologue () ...@@ -6613,7 +6613,7 @@ mips_expand_prologue ()
int regno; int regno;
HOST_WIDE_INT tsize; HOST_WIDE_INT tsize;
rtx tmp_rtx = 0; rtx tmp_rtx = 0;
const char *arg_name = 0; int last_arg_is_vararg_marker = 0;
tree fndecl = current_function_decl; tree fndecl = current_function_decl;
tree fntype = TREE_TYPE (fndecl); tree fntype = TREE_TYPE (fndecl);
tree fnargs = DECL_ARGUMENTS (fndecl); tree fnargs = DECL_ARGUMENTS (fndecl);
...@@ -6637,7 +6637,11 @@ mips_expand_prologue () ...@@ -6637,7 +6637,11 @@ mips_expand_prologue ()
fnargs = function_result_decl; fnargs = function_result_decl;
} }
/* Determine the last argument, and get its name. */ /* For arguments passed in registers, find the register number
of the first argument in the variable part of the argument list,
otherwise GP_ARG_LAST+1. Note also if the last argument is
the varargs special argument, and treat it as part of the
variable arguments. */
INIT_CUMULATIVE_ARGS (args_so_far, fntype, NULL_RTX, 0); INIT_CUMULATIVE_ARGS (args_so_far, fntype, NULL_RTX, 0);
regno = GP_ARG_FIRST; regno = GP_ARG_FIRST;
...@@ -6656,34 +6660,39 @@ mips_expand_prologue () ...@@ -6656,34 +6660,39 @@ mips_expand_prologue ()
entry_parm = FUNCTION_ARG (args_so_far, passed_mode, passed_type, 1); entry_parm = FUNCTION_ARG (args_so_far, passed_mode, passed_type, 1);
FUNCTION_ARG_ADVANCE (args_so_far, passed_mode, passed_type, 1);
next_arg = TREE_CHAIN (cur_arg);
if (entry_parm) if (entry_parm)
{ {
int words; if (next_arg == 0
&& DECL_NAME (cur_arg)
/* passed in a register, so will get homed automatically */ && ((0 == strcmp (IDENTIFIER_POINTER (DECL_NAME (cur_arg)),
if (GET_MODE (entry_parm) == BLKmode) "__builtin_va_alist"))
words = (int_size_in_bytes (passed_type) + 3) / 4; || (0 == strcmp (IDENTIFIER_POINTER (DECL_NAME (cur_arg)),
"va_alist"))))
{
last_arg_is_vararg_marker = 1;
break;
}
else else
words = (GET_MODE_SIZE (GET_MODE (entry_parm)) + 3) / 4; {
int words;
/* passed in a register, so will get homed automatically */
if (GET_MODE (entry_parm) == BLKmode)
words = (int_size_in_bytes (passed_type) + 3) / 4;
else
words = (GET_MODE_SIZE (GET_MODE (entry_parm)) + 3) / 4;
regno = REGNO (entry_parm) + words - 1; regno = REGNO (entry_parm) + words - 1;
}
} }
else else
{ {
regno = GP_ARG_LAST+1; regno = GP_ARG_LAST+1;
break; break;
} }
FUNCTION_ARG_ADVANCE (args_so_far, passed_mode, passed_type, 1);
next_arg = TREE_CHAIN (cur_arg);
if (next_arg == 0)
{
if (DECL_NAME (cur_arg))
arg_name = IDENTIFIER_POINTER (DECL_NAME (cur_arg));
break;
}
} }
/* In order to pass small structures by value in registers compatibly with /* In order to pass small structures by value in registers compatibly with
...@@ -6719,11 +6728,7 @@ mips_expand_prologue () ...@@ -6719,11 +6728,7 @@ mips_expand_prologue ()
&& ((TYPE_ARG_TYPES (fntype) != 0 && ((TYPE_ARG_TYPES (fntype) != 0
&& (TREE_VALUE (tree_last (TYPE_ARG_TYPES (fntype))) && (TREE_VALUE (tree_last (TYPE_ARG_TYPES (fntype)))
!= void_type_node)) != void_type_node))
|| (arg_name != 0 || last_arg_is_vararg_marker))
&& ((arg_name[0] == '_'
&& strcmp (arg_name, "__builtin_va_alist") == 0)
|| (arg_name[0] == 'v'
&& strcmp (arg_name, "va_alist") == 0)))))
{ {
int offset = (regno - GP_ARG_FIRST) * UNITS_PER_WORD; int offset = (regno - GP_ARG_FIRST) * UNITS_PER_WORD;
rtx ptr = stack_pointer_rtx; rtx ptr = stack_pointer_rtx;
......
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