aboutsummaryrefslogtreecommitdiffstats
path: root/cse.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2004-11-24 17:29:58 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-07 21:04:46 -0700
commit6e82297e7242122397b6aa37a3c4580f45fa416d (patch)
tree7f9ed8e6970f3fd4bc7f52c56f70f12b0686859d /cse.c
parent06942ef25a3fb8dabde5df1d4ecbca16b2810a9d (diff)
downloadsparse-6e82297e7242122397b6aa37a3c4580f45fa416d.tar.gz
sparse-6e82297e7242122397b6aa37a3c4580f45fa416d.tar.xz
sparse-6e82297e7242122397b6aa37a3c4580f45fa416d.zip
Now that phi sources are just instructions, we can CSE them.
They's _slightly_ special in that they depend on their bb, so we can only combine them within one basic block, but that's easily handled by making the bb be part of the hashing and comparison.
Diffstat (limited to 'cse.c')
-rw-r--r--cse.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/cse.c b/cse.c
index 9e83833..8ad733c 100644
--- a/cse.c
+++ b/cse.c
@@ -291,6 +291,11 @@ static void clean_up_one_instruction(struct basic_block *bb, struct instruction
hash += clean_up_phi(insn);
break;
+ case OP_PHISOURCE:
+ hash += hashval(insn->src1);
+ hash += hashval(insn->bb);
+ break;
+
default:
/*
* Nothing to do, don't even bother hashing them,
@@ -392,6 +397,13 @@ static int insn_compare(const void *_i1, const void *_i2)
case OP_PHI:
return phi_list_compare(i1->phi_list, i2->phi_list);
+ case OP_PHISOURCE:
+ if (i1->src1 != i2->src1)
+ return i1->src1 < i2->src1 ? -1 : 1;
+ if (i1->bb != i2->bb)
+ return i1->bb < i2->bb ? -1 : 1;
+ break;
+
default:
warning(i1->bb->pos, "bad instruction on hash chain");
}