Skip to content

Commit 05233ed

Browse files
author
Claudiu Zissulescu
committed
Allow/correct passing partial DI anonymous args
1 parent 8fc1762 commit 05233ed

File tree

2 files changed

+44
-17
lines changed

2 files changed

+44
-17
lines changed

gcc/ChangeLog.ARC

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
2014-08-11 Claudiu Zissulescu <[email protected]>
2+
3+
* config/arc/arc.c (TARGET_PRETEND_OUTGOING_VARARGS_NAMED): Remove.
4+
(arc_function_args_impl): allow passing partial anonymous DIargs.
5+
(arc_partial_bytes): Likewise.
6+
17
2013-08-09 Claudiu Zissulescu <[email protected]>
28

39
* common/config/arc/arc-common.c: mdiv-rem default on

gcc/config/arc/arc.c

Lines changed: 38 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -496,9 +496,6 @@ static void arc_finalize_pic (void);
496496
#undef TARGET_STRICT_ARGUMENT_NAMING
497497
#define TARGET_STRICT_ARGUMENT_NAMING arc_strict_argument_naming
498498

499-
#undef TARGET_PRETEND_OUTGOING_VARARGS_NAMED
500-
#define TARGET_PRETEND_OUTGOING_VARARGS_NAMED arc_pretend_outgoing_varargs_named
501-
502499
#undef TARGET_PASS_BY_REFERENCE
503500
#define TARGET_PASS_BY_REFERENCE arc_pass_by_reference
504501

@@ -1895,12 +1892,6 @@ static bool arc_strict_argument_naming(cumulative_args_t cum ATTRIBUTE_UNUSED)
18951892
return TARGET_HS;
18961893
}
18971894

1898-
static bool
1899-
arc_pretend_outgoing_varargs_named (cumulative_args_t ca_v ATTRIBUTE_UNUSED)
1900-
{
1901-
return !TARGET_HS;
1902-
}
1903-
19041895
/* Cost functions. */
19051896

19061897
/* Provide the costs of an addressing mode that contains ADDR.
@@ -5260,9 +5251,9 @@ arc_function_args_impl (CUMULATIVE_ARGS *cum,
52605251
reg_idx = cum->last_reg; /* for unamed args don't try fill up the reg-holes. */
52615252
nregs = arc_hard_regno_nregs (0, mode, type); /* only interested in the number of regs. */
52625253
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))
5254+
&& (mode != BLKmode) /* Only DI-like modes are interesting for us. */
5255+
&& (reg_idx & 1) /* Only for "non-aligned" registers. */
5256+
&& FUNCTION_ARG_REGNO_P (reg_idx)) /* Allow passing partial arguments. */
52665257
{
52675258
rtx reg1 = gen_rtx_REG (SImode, reg_idx);
52685259
rtx reg2 = gen_rtx_REG (SImode, reg_idx + 1);
@@ -5326,6 +5317,12 @@ arc_function_args_impl (CUMULATIVE_ARGS *cum,
53265317
return gen_rtx_REG (mode, reg_location);
53275318
}
53285319

5320+
if (advance && named)
5321+
cum->last_reg = MAX_ARC_PARM_REGS; /* MAX out any other free register
5322+
if a named arguments goes on stack.
5323+
This avoids any usage of the remaining
5324+
regs for further argument pasing. */
5325+
53295326
return NULL_RTX;
53305327
}
53315328

@@ -5354,11 +5351,19 @@ arc_arg_partial_bytes (cumulative_args_t cum_v, enum machine_mode mode,
53545351
int nregs = 0;
53555352

53565353
retx = arc_function_args_impl (cum, mode, type, named, false);
5357-
if (REG_P (retx))
5354+
if (REG_P (retx)
5355+
|| (GET_CODE (retx) == PARALLEL))
53585356
{
5359-
nregs = arc_hard_regno_nregs (REGNO (retx), mode, type);
5360-
ret = (((REGNO (retx) + nregs) <= MAX_ARC_PARM_REGS) ? 0 :
5361-
(MAX_ARC_PARM_REGS - REGNO (retx)) * UNITS_PER_WORD);
5357+
int regno;
5358+
5359+
if (REG_P (retx))
5360+
regno = REGNO (retx);
5361+
else
5362+
regno = REGNO (XEXP (XVECEXP (retx, 0, 0), 0));
5363+
5364+
nregs = arc_hard_regno_nregs (0, mode, type);
5365+
ret = (((regno + nregs) <= MAX_ARC_PARM_REGS) ? 0 :
5366+
(MAX_ARC_PARM_REGS - regno) * UNITS_PER_WORD);
53625367
}
53635368
#endif
53645369

@@ -5409,9 +5414,9 @@ arc_function_arg (cumulative_args_t cum_v, enum machine_mode mode,
54095414
rtx ret;
54105415
const char *debstr ATTRIBUTE_UNUSED;
54115416

5412-
#if 0
54135417
int arg_num = cum->arg_num;
54145418
arg_num = ROUND_ADVANCE_CUM (arg_num, mode, type);
5419+
#if 0
54155420
/* Return a marker for use in the call instruction. */
54165421
if (mode == VOIDmode)
54175422
{
@@ -5430,6 +5435,22 @@ arc_function_arg (cumulative_args_t cum_v, enum machine_mode mode,
54305435
}
54315436
#else
54325437
ret = arc_function_args_impl (cum, mode, type, named, false);
5438+
5439+
#if 0
5440+
if (ret == NULL_RTX)
5441+
debstr = "memory";
5442+
else if (mode == VOIDmode)
5443+
debstr = "<0>";
5444+
else if (REG_P (ret))
5445+
debstr = reg_names [REGNO (ret)];
5446+
else if (GET_CODE (ret) == PARALLEL)
5447+
debstr = "double in reg";
5448+
else
5449+
debstr = "unk";
5450+
fprintf (stderr,
5451+
"function_arg: words = %2d, mode = %4s, named = %d, size = %3d, arg = %s\n",
5452+
arg_num, GET_MODE_NAME (mode), named, GET_MODE_SIZE (mode), debstr);
5453+
#endif
54335454
#endif
54345455
return ret;
54355456
}

0 commit comments

Comments
 (0)