@@ -1862,17 +1862,11 @@ arc_setup_incoming_varargs (cumulative_args_t args_so_far,
18621862 int first_anon_arg ;
18631863 CUMULATIVE_ARGS next_cum ;
18641864
1865- if (TARGET_HS )
1866- {
1867- * pretend_size = 0 ;
1868- return ;
1869- }
1870-
18711865 /* We must treat `__builtin_va_alist' as an anonymous arg. */
18721866
18731867 next_cum = * get_cumulative_args (args_so_far );
18741868 arc_function_arg_advance (pack_cumulative_args (& next_cum ), mode , type , true);
1875- first_anon_arg = next_cum .arg_num ;
1869+ first_anon_arg = TARGET_HS ? next_cum . last_reg : next_cum .arg_num ;
18761870
18771871 if (FUNCTION_ARG_REGNO_P (first_anon_arg ))
18781872 {
@@ -5215,6 +5209,7 @@ void arc_init_cumulative_args (CUMULATIVE_ARGS *cum,
52155209 int i ;
52165210
52175211 cum -> arg_num = 0 ;
5212+ cum -> last_reg = 0 ;
52185213 for (i = 0 ; i < FIRST_PSEUDO_REGISTER ; i ++ )
52195214 {
52205215 cum -> avail [i ] = true;
@@ -5261,7 +5256,30 @@ arc_function_args_impl (CUMULATIVE_ARGS *cum,
52615256 return const0_rtx ;
52625257
52635258 if (!named && TARGET_HS )
5264- return NULL_RTX ; /* all unamed arguments are passed on stack. */
5259+ {
5260+ reg_idx = cum -> last_reg ; /* for unamed args don't try fill up the reg-holes. */
5261+ nregs = arc_hard_regno_nregs (0 , mode , type ); /* only interested in the number of regs. */
5262+ if ((nregs == 2 )
5263+ && (mode != BLKmode ) /* Only DI-like modes are interesting for us. */
5264+ && (reg_idx & 1 ) /* Only for "non-aligned" registers. */
5265+ && FUNCTION_ARG_REGNO_P (reg_idx + nregs - 1 ))
5266+ {
5267+ rtx reg1 = gen_rtx_REG (SImode , reg_idx );
5268+ rtx reg2 = gen_rtx_REG (SImode , reg_idx + 1 );
5269+ rtvec vec = gen_rtvec (2 , gen_rtx_EXPR_LIST (VOIDmode , reg1 , const0_rtx ),
5270+ gen_rtx_EXPR_LIST (VOIDmode , reg2 , GEN_INT (4 )));
5271+
5272+ if (advance )
5273+ {
5274+ cum -> arg_num += nregs ;
5275+ cum -> avail [reg_idx ] = false;
5276+ cum -> avail [reg_idx + 1 ] = false;
5277+ cum -> last_reg += nregs ;
5278+ }
5279+
5280+ return gen_rtx_PARALLEL (mode , vec );
5281+ }
5282+ }
52655283
52665284 while (FUNCTION_ARG_REGNO_P (reg_idx ))
52675285 {
@@ -5302,6 +5320,7 @@ arc_function_args_impl (CUMULATIVE_ARGS *cum,
53025320 {
53035321 cum -> avail [reg_idx ] = false;
53045322 }
5323+ cum -> last_reg = reg_idx ;
53055324 cum -> arg_num += nregs ;
53065325 }
53075326 return gen_rtx_REG (mode , reg_location );
0 commit comments