aboutsummaryrefslogtreecommitdiff
path: root/cse.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2004-12-01 12:06:16 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-07 21:05:22 -0700
commitf4838f47038173fa0e0cefa919338916075bf6d2 (patch)
tree0c5e6346f6d94572303c5fbdcec153c08c4ba45a /cse.c
parentFix embarrassing linearized bug with empty iterator post-conditions. (diff)
downloadsparse-f4838f47038173fa0e0cefa919338916075bf6d2.tar.gz
sparse-f4838f47038173fa0e0cefa919338916075bf6d2.tar.bz2
sparse-f4838f47038173fa0e0cefa919338916075bf6d2.zip
Remove OP_SETCC, make OP_SEL bigger instead.
This was originally done so that "struct instruction" would be smaller, but it has since grown anyway (for the memops), so splitting OP_SEL into two instructions no longer makes sense, and makes it harder on CSE.
Diffstat (limited to 'cse.c')
-rw-r--r--cse.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/cse.c b/cse.c
index 21ae285..b75a412 100644
--- a/cse.c
+++ b/cse.c
@@ -46,7 +46,10 @@ static void clean_up_one_instruction(struct basic_block *bb, struct instruction
assert(insn->bb == bb);
repeat_phase |= simplify_instruction(insn);
hash = (insn->opcode << 3) + (insn->size >> 3);
- switch (insn->opcode) {
+ switch (insn->opcode) {
+ case OP_SEL:
+ hash += hashval(insn->src3);
+ /* Fallthrough */
/* Binary arithmetic */
case OP_ADD: case OP_SUB:
@@ -65,9 +68,8 @@ static void clean_up_one_instruction(struct basic_block *bb, struct instruction
case OP_SET_LT: case OP_SET_GT:
case OP_SET_B: case OP_SET_A:
case OP_SET_BE: case OP_SET_AE:
- hash += hashval(insn->src1);
hash += hashval(insn->src2);
- break;
+ /* Fallthrough */
/* Unary */
case OP_NOT: case OP_NEG:
@@ -163,6 +165,10 @@ static int insn_compare(const void *_i1, const void *_i2)
return i1->opcode < i2->opcode ? -1 : 1;
switch (i1->opcode) {
+ case OP_SEL:
+ if (i1->src3 != i2->src3)
+ return i1->src3 < i2->src3 ? -1 : 1;
+ /* Fall-through to binops */
/* Binary arithmetic */
case OP_ADD: case OP_SUB:
@@ -181,11 +187,9 @@ static int insn_compare(const void *_i1, const void *_i2)
case OP_SET_LT: case OP_SET_GT:
case OP_SET_B: case OP_SET_A:
case OP_SET_BE: case OP_SET_AE:
- if (i1->src1 != i2->src1)
- return i1->src1 < i2->src1 ? -1 : 1;
if (i1->src2 != i2->src2)
return i1->src2 < i2->src2 ? -1 : 1;
- break;
+ /* Fall-through to unops */
/* Unary */
case OP_NOT: case OP_NEG: