[tuples] Convert type checking code to use tuples

Diego Novillo dnovillo@google.com
Thu Aug 30 11:55:00 GMT 2007


On 8/30/07, Richard Guenther <richard.guenther@gmail.com> wrote:

> but that is certainly not ok.  For example FIX_TRUNC_EXPR with an
> integral argument or the other restrictions that were imposed before.

Ah, yes.  I missed these cases, thanks.  I'll move all the existing
code from verify_gimple_expr.

There are checks that are now unnecessary, however.  For instance,

unsigned long a;
int b;

a = (unsigned long) b;

which in mainline is

MODIFY_EXPR <a, NOP_EXPR <b>>

the first check we do is to determine whether TREE_TYPE (a) and
TREE_TYPE (NOP_EXPR <b>) are both integral types.  But in tuples, this
is represented as:

GIMPLE_ASSIGN <NOP_EXPR, a, b>

In here, NOP_EXPR is merely the code of the operation.  The type of
the original expression is not saved (we could save it, but we don't).
 So, after gimplification all we can check is TREE_TYPE (a) and
TREE_TYPE (b).

The semantics of the operation is that the type of 'b' is being
converted to the type of 'a'.  So, in essence we can assume that
TREE_TYPE (NOP_EXPR) == TREE_TYPE (a).

We can do all the other checks, for instance, if 'b' was integral and
'a' was a real, the conversion code should be FLOAT_EXPR.



More information about the Gcc-patches mailing list