diff options
| author | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2017-03-29 01:33:34 +0200 |
|---|---|---|
| committer | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2018-02-24 10:49:15 +0100 |
| commit | c5ba883e6ac47381f8112ed33f22a931a79ac517 (patch) | |
| tree | 7a945cb1ab8810188e16cb8785f63f4799b0ec49 | |
| parent | adc4d32ef551907128637600a98ba28153ef79d8 (diff) | |
| download | sparse-dev-c5ba883e6ac47381f8112ed33f22a931a79ac517.tar.gz | |
cse: untangle simplification & hashing
Currently, the simplification of individual instructions
is done at the beginnig of the function doing the hashing
for CSE.
Separate the two help a little bit to understand the code
there and making any changes if needed.
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
| -rw-r--r-- | cse.c | 14 |
1 files changed, 6 insertions, 8 deletions
@@ -35,16 +35,10 @@ static int phi_compare(pseudo_t phi1, pseudo_t phi2) } -static void clean_up_one_instruction(struct basic_block *bb, struct instruction *insn) +static void cse_collect(struct instruction *insn) { unsigned long hash; - if (!insn->bb) - return; - assert(insn->bb == bb); - repeat_phase |= simplify_instruction(insn); - if (!insn->bb) - return; hash = (insn->opcode << 3) + (insn->size >> 3); switch (insn->opcode) { case OP_SEL: @@ -144,7 +138,11 @@ static void clean_up_insns(struct entrypoint *ep) FOR_EACH_PTR(ep->bbs, bb) { struct instruction *insn; FOR_EACH_PTR(bb->insns, insn) { - clean_up_one_instruction(bb, insn); + repeat_phase |= simplify_instruction(insn); + if (!insn->bb) + continue; + assert(insn->bb == bb); + cse_collect(insn); } END_FOR_EACH_PTR(insn); } END_FOR_EACH_PTR(bb); } |
