aboutsummaryrefslogtreecommitdiff
path: root/cse.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2004-11-28 20:38:23 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-07 21:05:14 -0700
commit89e78a3b4700b9c1cc204266772d4fe0647b1656 (patch)
tree7a5ad5083ae2a836566550d465462fe8946c0b8f /cse.c
parentOops. Don't try to CSE OP_SEL, at least not until we learn to (diff)
downloadsparse-89e78a3b4700b9c1cc204266772d4fe0647b1656.tar.gz
sparse-89e78a3b4700b9c1cc204266772d4fe0647b1656.tar.bz2
sparse-89e78a3b4700b9c1cc204266772d4fe0647b1656.zip
Start using instruction sizes properly.
We should drop symbol types by now, and base things on just raw sizes. Anything else just doesn't work from a CSE standpoint. Some things may care about actual types later, notably the type- based alias analysis. Those types still exist in the cast nodes. Also, make the printout be more readable.
Diffstat (limited to 'cse.c')
-rw-r--r--cse.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/cse.c b/cse.c
index 91e4c7b..4de950d 100644
--- a/cse.c
+++ b/cse.c
@@ -45,7 +45,7 @@ static void clean_up_one_instruction(struct basic_block *bb, struct instruction
return;
assert(insn->bb == bb);
repeat_phase |= simplify_instruction(insn);
- hash = insn->opcode;
+ hash = (insn->opcode << 3) + (insn->size >> 3);
switch (insn->opcode) {
/* Binary arithmetic */
@@ -218,6 +218,8 @@ static int insn_compare(const void *_i1, const void *_i2)
default:
warning(i1->bb->pos, "bad instruction on hash chain");
}
+ if (i1->size != i2->size)
+ return i1->size < i2->size ? -1 : 1;
return 0;
}