summaryrefslogtreecommitdiff
path: root/cse.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2004-11-24 19:17:04 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-07 21:04:47 -0700
commitb09bc678d3a516cd2264daf07d48d1c10726982a (patch)
tree3f4b2d79b794f7dc270755f93b53879a085fbd09 /cse.c
parentAdd "optimize" flag, and collect the flags into lib.c. (diff)
downloadsparse-b09bc678d3a516cd2264daf07d48d1c10726982a.tar.gz
sparse-b09bc678d3a516cd2264daf07d48d1c10726982a.tar.bz2
sparse-b09bc678d3a516cd2264daf07d48d1c10726982a.zip
Damn. We can't actually sort the phi-node list of phi's now
that we keep track of usage notes. The usage trackign tracks the address of the phi pseudo, so sorting the list would need to update that too. This sucks, because it means we can't turn the phi-nodes into canonical format, and thus not CSE phi-nodes as effectively.
Diffstat (limited to 'cse.c')
-rw-r--r--cse.c25
1 files changed, 4 insertions, 21 deletions
diff --git a/cse.c b/cse.c
index 8ad733c..38b8002 100644
--- a/cse.c
+++ b/cse.c
@@ -23,10 +23,8 @@ static struct instruction_list *insn_hash_table[INSN_HASH_SIZE];
static int cse_repeat;
-static int phi_compare(const void *_phi1, const void *_phi2)
+static int phi_compare(pseudo_t phi1, pseudo_t phi2)
{
- const struct pseudo * phi1 = _phi1;
- const struct pseudo * phi2 = _phi2;
const struct instruction *def1 = phi1->def;
const struct instruction *def2 = phi2->def;
@@ -37,11 +35,6 @@ static int phi_compare(const void *_phi1, const void *_phi2)
return 0;
}
-static void sort_phi_list(struct pseudo_list **list)
-{
- sort_list((struct ptr_list **)list , phi_compare);
-}
-
/* Find the trivial parent for a phi-source */
static struct basic_block *phi_parent(struct basic_block *source, pseudo_t pseudo)
{
@@ -149,32 +142,22 @@ static unsigned long clean_up_phi(struct instruction *insn)
unsigned long hash = 0;
int same;
- sort_phi_list(&insn->phi_list);
-
last = NULL;
same = 1;
FOR_EACH_PTR(insn->phi_list, phi) {
struct instruction *def = phi->def;
- if (def->src1 == VOID) {
- DELETE_CURRENT_PTR(phi);
+ if (def->src1 == VOID)
continue;
- }
if (last) {
- if (last->src1 != def->src1) {
+ if (last->src1 != def->src1)
same = 0;
- } else if (last->bb == def->bb) {
- DELETE_CURRENT_PTR(phi);
- continue;
- }
+ continue;
}
last = def;
hash += hashval(def->src1);
hash += hashval(def->bb);
} END_FOR_EACH_PTR(phi);
- /* Whenever we delete pointers, we may have to pack the end result */
- PACK_PTR_LIST(&insn->phi_list);
-
if (same) {
pseudo_t pseudo = last ? last->src1 : VOID;
convert_instruction_target(insn, pseudo);