diff options
| author | Linus Torvalds <torvalds@ppc970.osdl.org> | 2004-08-01 22:10:24 -0700 |
|---|---|---|
| committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-07 21:02:31 -0700 |
| commit | a9a6e25425101d430256f0cd333bef1e24794fca (patch) | |
| tree | 2d811bd78cabc6e7c60889cf9e2345ac07ac8c8f | |
| parent | 6c1e80b75871f7fd2bc6143d535766317444b160 (diff) | |
| download | sparse-dev-a9a6e25425101d430256f0cd333bef1e24794fca.tar.gz | |
EXPR_SAFELOGICAL is unnecessary. It ends up being the same as EXPR_BINOP.
Make linearize.h show the right ops for the logical (as opposed to
binary) and/or EXPR_BINOP.
| -rw-r--r-- | compile-i386.c | 1 | ||||
| -rw-r--r-- | evaluate.c | 1 | ||||
| -rw-r--r-- | expand.c | 3 | ||||
| -rw-r--r-- | expression.h | 1 | ||||
| -rw-r--r-- | linearize.c | 8 | ||||
| -rw-r--r-- | linearize.h | 8 | ||||
| -rw-r--r-- | show-parse.c | 1 |
7 files changed, 10 insertions, 13 deletions
diff --git a/compile-i386.c b/compile-i386.c index 2b379f09..dace9717 100644 --- a/compile-i386.c +++ b/compile-i386.c @@ -2121,7 +2121,6 @@ static struct storage *x86_expression(struct expression *expr) case EXPR_BINOP: case EXPR_COMMA: case EXPR_LOGICAL: - case EXPR_SAFELOGICAL: return emit_binop(expr); case EXPR_PREOP: return x86_preop(expr); @@ -1823,7 +1823,6 @@ struct symbol *evaluate_expression(struct expression *expr) return NULL; return evaluate_binop(expr); case EXPR_LOGICAL: - case EXPR_SAFELOGICAL: return evaluate_logical(expr); case EXPR_COMMA: if (!evaluate_expression(expr->left)) @@ -393,7 +393,7 @@ static int expand_logical(struct expression *expr) * style SAFELOGICAL. */ if (rcost < BRANCH_COST) { - expr->type = EXPR_SAFELOGICAL; + expr->type = EXPR_BINOP; rcost -= BRANCH_COST - 1; } @@ -702,7 +702,6 @@ static int expand_expression(struct expression *expr) return expand_binop(expr); case EXPR_LOGICAL: - case EXPR_SAFELOGICAL: return expand_logical(expr); case EXPR_COMMA: diff --git a/expression.h b/expression.h index dde102b5..d03cdc35 100644 --- a/expression.h +++ b/expression.h @@ -21,7 +21,6 @@ enum expression_type { EXPR_BINOP, EXPR_ASSIGNMENT, EXPR_LOGICAL, - EXPR_SAFELOGICAL, EXPR_DEREF, EXPR_PREOP, EXPR_POSTOP, diff --git a/linearize.c b/linearize.c index 7a2f80a6..0ecdc774 100644 --- a/linearize.c +++ b/linearize.c @@ -172,14 +172,15 @@ static void show_instruction(struct instruction *insn) insn->orig_type->bit_size, insn->type->bit_size, insn->src->nr); break; - case OP_BINARY ... OP_BINARY_END: - case OP_LOGICAL ... OP_LOGICAL_END: { + case OP_BINARY ... OP_BINARY_END: { static const char *opname[] = { [OP_ADD - OP_BINARY] = "add", [OP_SUB - OP_BINARY] = "sub", [OP_MUL - OP_BINARY] = "mul", [OP_DIV - OP_BINARY] = "div", [OP_MOD - OP_BINARY] = "mod", [OP_AND - OP_BINARY] = "and", [OP_OR - OP_BINARY] = "or", [OP_XOR - OP_BINARY] = "xor", [OP_SHL - OP_BINARY] = "shl", [OP_SHR - OP_BINARY] = "shr", + [OP_AND_BOOL - OP_BINARY] = "and-bool", + [OP_OR_BOOL - OP_BINARY] = "or-bool", }; printf("\t%%r%d <- %s %%r%d, %%r%d\n", insn->target->nr, @@ -565,6 +566,8 @@ static pseudo_t linearize_binop(struct entrypoint *ep, struct expression *expr) ['|'] = OP_OR, ['^'] = OP_XOR, [SPECIAL_LEFTSHIFT] = OP_SHL, [SPECIAL_RIGHTSHIFT] = OP_SHR, + [SPECIAL_LOGICAL_AND] = OP_AND_BOOL, + [SPECIAL_LOGICAL_OR] = OP_OR_BOOL, }; src1 = linearize_expression(ep, expr->left); @@ -749,7 +752,6 @@ pseudo_t linearize_expression(struct entrypoint *ep, struct expression *expr) return linearize_call_expression(ep, expr); case EXPR_BINOP: - case EXPR_SAFELOGICAL: return linearize_binop(ep, expr); case EXPR_LOGICAL: diff --git a/linearize.h b/linearize.h index 54453394..f2356b04 100644 --- a/linearize.h +++ b/linearize.h @@ -86,14 +86,14 @@ enum opcode { OP_SHL, OP_SHR, OP_SEL, - OP_BINARY_END = OP_SHR, /* Logical */ - OP_LOGICAL, - OP_AND = OP_LOGICAL, + OP_AND, OP_OR, OP_XOR, - OP_LOGICAL_END = OP_XOR, + OP_AND_BOOL, + OP_OR_BOOL, + OP_BINARY_END = OP_OR_BOOL, /* Binary comparison */ OP_BINCMP, diff --git a/show-parse.c b/show-parse.c index d2708eec..ab49d517 100644 --- a/show-parse.c +++ b/show-parse.c @@ -962,7 +962,6 @@ int show_expression(struct expression *expr) case EXPR_COMMA: case EXPR_COMPARE: case EXPR_LOGICAL: - case EXPR_SAFELOGICAL: return show_binop(expr); case EXPR_PREOP: return show_preop(expr); |
