aboutsummaryrefslogtreecommitdiffstats
path: root/cse.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2004-11-25 22:32:23 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-07 21:04:57 -0700
commit01ae1c2449677ef308af0b14e9aa8fa72eb88f1d (patch)
tree2e10532fc8e6de5d5f64117eaa461831b2ae43e9 /cse.c
parentbb708408f097d298c2c518c9082cd4511c3349fc (diff)
downloadsparse-01ae1c2449677ef308af0b14e9aa8fa72eb88f1d.tar.gz
sparse-01ae1c2449677ef308af0b14e9aa8fa72eb88f1d.tar.xz
sparse-01ae1c2449677ef308af0b14e9aa8fa72eb88f1d.zip
Make the CSE "repeat" logic be more fine-grained than just
repeating CSE itself. In particular, some symbol address simplifications imply that we should repeat symbol simplification, since things may have improved.
Diffstat (limited to 'cse.c')
-rw-r--r--cse.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/cse.c b/cse.c
index 016c7f5..7aa7fa2 100644
--- a/cse.c
+++ b/cse.c
@@ -22,7 +22,7 @@ static struct instruction_list *insn_hash_table[INSN_HASH_SIZE];
#define hashval(x) ((unsigned long)(x))
-static int cse_repeat;
+int repeat_phase;
static int phi_compare(pseudo_t phi1, pseudo_t phi2)
{
@@ -44,8 +44,7 @@ static void clean_up_one_instruction(struct basic_block *bb, struct instruction
if (!insn->bb)
return;
assert(insn->bb == bb);
- if (simplify_instruction(insn))
- cse_repeat = 1;
+ repeat_phase |= simplify_instruction(insn);
hash = insn->opcode;
switch (insn->opcode) {
@@ -227,7 +226,7 @@ static struct instruction * cse_one_instruction(struct instruction *insn, struct
{
convert_instruction_target(insn, def->target);
insn->opcode = OP_NOP;
- cse_repeat = 1;
+ repeat_phase |= REPEAT_CSE;
return def;
}
@@ -294,7 +293,7 @@ void cleanup_and_cse(struct entrypoint *ep)
int i;
repeat:
- cse_repeat = 0;
+ repeat_phase = 0;
clean_up_insns(ep);
for (i = 0; i < INSN_HASH_SIZE; i++) {
struct instruction_list **list = insn_hash_table + i;
@@ -319,6 +318,9 @@ repeat:
}
}
- if (cse_repeat)
+ if (repeat_phase & REPEAT_SYMBOL_CLEANUP)
+ simplify_symbol_usage(ep);
+
+ if (repeat_phase & REPEAT_CSE)
goto repeat;
}