diff options
| author | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2018-02-18 12:17:59 +0100 |
|---|---|---|
| committer | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2018-02-24 10:49:15 +0100 |
| commit | 1cd676703c37472ee533aaa28090e19bbb83bec0 (patch) | |
| tree | c5eee41a8df8ca87429009cd2f384fb8a2cd7607 /cse.c | |
| parent | e22588735b2ed54a08d1b3fb593cc3a26afb320b (diff) | |
| download | sparse-dev-1cd676703c37472ee533aaa28090e19bbb83bec0.tar.gz | |
move inner optimization loop into optimize.c
The code for the inner optimization loop was in the same file
than the one for CSE. Now that the CSE have a well defined
interface, we can move this inner loop together with
the main optimization loop in optimize.c
This move make the code better structured and make it easier
to understand the optimization logic and make any experiment
or needed changes to it.
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Diffstat (limited to 'cse.c')
| -rw-r--r-- | cse.c | 36 |
1 files changed, 0 insertions, 36 deletions
@@ -21,8 +21,6 @@ #define INSN_HASH_SIZE 256 static struct instruction_list *insn_hash_table[INSN_HASH_SIZE]; -int repeat_phase; - static int phi_compare(pseudo_t phi1, pseudo_t phi2) { const struct instruction *def1 = phi1->def; @@ -132,22 +130,6 @@ void cse_collect(struct instruction *insn) add_instruction(insn_hash_table + hash, insn); } -static void clean_up_insns(struct entrypoint *ep) -{ - struct basic_block *bb; - - FOR_EACH_PTR(ep->bbs, bb) { - struct instruction *insn; - FOR_EACH_PTR(bb->insns, 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); -} - /* Compare two (sorted) phi-lists */ static int phi_list_compare(struct pseudo_list *l1, struct pseudo_list *l2) { @@ -409,21 +391,3 @@ void cse_eliminate(struct entrypoint *ep) } } } - -void cleanup_and_cse(struct entrypoint *ep) -{ - simplify_memops(ep); -repeat: - repeat_phase = 0; - clean_up_insns(ep); - if (repeat_phase & REPEAT_CFG_CLEANUP) - kill_unreachable_bbs(ep); - - cse_eliminate(ep); - - if (repeat_phase & REPEAT_SYMBOL_CLEANUP) - simplify_memops(ep); - - if (repeat_phase & REPEAT_CSE) - goto repeat; -} |
