1
0
mirror of https://github.com/cc65/cc65.git synced 2024-11-16 18:08:04 +00:00

Mark commutative operators as such (no change in code until now).

git-svn-id: svn://svn.cc65.org/cc65/trunk@5720 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
uz 2012-06-16 15:49:53 +00:00
parent c1d7ed26e8
commit b5d88fdedd

View File

@ -48,6 +48,7 @@
/* Generator attributes */ /* Generator attributes */
#define GEN_NOPUSH 0x01 /* Don't push lhs */ #define GEN_NOPUSH 0x01 /* Don't push lhs */
#define GEN_COMM 0x02 /* Operator is commutative */
/* Map a generator function and its attributes to a token */ /* Map a generator function and its attributes to a token */
typedef struct { typedef struct {
@ -1756,7 +1757,7 @@ void hie10 (ExprDesc* Expr)
/* A typecast */ /* A typecast */
TypeCast (Expr); TypeCast (Expr);
} else { } else {
/* An expression */ /* An expression */
@ -2287,10 +2288,10 @@ static void hie9 (ExprDesc *Expr)
/* Process * and / operators. */ /* Process * and / operators. */
{ {
static const GenDesc hie9_ops[] = { static const GenDesc hie9_ops[] = {
{ TOK_STAR, GEN_NOPUSH, g_mul }, { TOK_STAR, GEN_NOPUSH | GEN_COMM, g_mul },
{ TOK_DIV, GEN_NOPUSH, g_div }, { TOK_DIV, GEN_NOPUSH, g_div },
{ TOK_MOD, GEN_NOPUSH, g_mod }, { TOK_MOD, GEN_NOPUSH, g_mod },
{ TOK_INVALID, 0, 0 } { TOK_INVALID, 0, 0 }
}; };
int UsedGen; int UsedGen;
@ -2751,8 +2752,8 @@ static void hie4 (ExprDesc* Expr)
/* Handle & (bitwise and) */ /* Handle & (bitwise and) */
{ {
static const GenDesc hie4_ops[] = { static const GenDesc hie4_ops[] = {
{ TOK_AND, GEN_NOPUSH, g_and }, { TOK_AND, GEN_NOPUSH | GEN_COMM, g_and },
{ TOK_INVALID, 0, 0 } { TOK_INVALID, 0, 0 }
}; };
int UsedGen; int UsedGen;
@ -2765,8 +2766,8 @@ static void hie3 (ExprDesc* Expr)
/* Handle ^ (bitwise exclusive or) */ /* Handle ^ (bitwise exclusive or) */
{ {
static const GenDesc hie3_ops[] = { static const GenDesc hie3_ops[] = {
{ TOK_XOR, GEN_NOPUSH, g_xor }, { TOK_XOR, GEN_NOPUSH | GEN_COMM, g_xor },
{ TOK_INVALID, 0, 0 } { TOK_INVALID, 0, 0 }
}; };
int UsedGen; int UsedGen;
@ -2779,8 +2780,8 @@ static void hie2 (ExprDesc* Expr)
/* Handle | (bitwise or) */ /* Handle | (bitwise or) */
{ {
static const GenDesc hie2_ops[] = { static const GenDesc hie2_ops[] = {
{ TOK_OR, GEN_NOPUSH, g_or }, { TOK_OR, GEN_NOPUSH | GEN_COMM, g_or },
{ TOK_INVALID, 0, 0 } { TOK_INVALID, 0, 0 }
}; };
int UsedGen; int UsedGen;