Hello,
> So, I think I am still not convinced which way we want to access the RHS
> of a GS_ASSIGN.
>
> Since GS_ASSIGN can have various types of RHS, we originally had:
>
> gs_assign_unary_rhs (gs) <- Access the only operand on RHS
> gs_assign_binary_rhs1 (gs) <- Access the 1st RHS operand
> gs_assign_binary_rhs2 (gs) <- Access the 2nd RHS operand
>
> And the corresponding _set functions.
>
> I then managed to half convince myself that it'd be better to have a
> single gs_assign_rhs() accessor with a 'which' parameter. After
> implementing that, I think I hate it. Particularly since this 'which'
> parameter is just a number (0 or 1). It could be a mnemonic, but it
> would still be annoying.
>
> So, I'm thinking of going back to the way it was before, but it is not
> optimal. Do people feel strongly over one or the other?
I may be missing something, but surely having the accessors uniform
would be better? So that I can write things like
/* Process all operands. */
for (i = 0; i < n_operands (gs); i++)
process (gs_assign_rhs (gs, i));
rather than
if (is_unary (gs))
process (gs_assign_unary_rhs (gs));
else if (is_binary (gs))
{
process (gs_assign_binary_rhs1 (gs));
process (gs_assign_binary_rhs2 (gs));
}
else if (is_ternary (gs))
...
Anyway, you can always
#define gs_assign_unary_rhs(X) gs_assign_rhs(X, 0)
#define gs_assign_binary_rhs1(X) gs_assign_rhs(X, 0)
#define gs_assign_binary_rhs2(X) gs_assign_rhs(X, 1)
as well, and use these in cases where you know with which arity you are
working.
Zdenek