diff options
| author | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2018-02-18 11:36:27 +0100 |
|---|---|---|
| committer | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2018-02-24 10:49:15 +0100 |
| commit | c6399ddb863f4a9dfb746589f19299fdbe80e28b (patch) | |
| tree | c115dea1709fe527284a8d4e5add5df9f78eb234 | |
| parent | c5ba883e6ac47381f8112ed33f22a931a79ac517 (diff) | |
| download | sparse-dev-c6399ddb863f4a9dfb746589f19299fdbe80e28b.tar.gz | |
extract cse_eliminate() from cleanup_and_cse()
Currently, the same function doing the CSE's elimination phase
also contains the inner part of the optimization loop.
Moving the CSE elimination part in a seperate function will
allow to make a clear interface for CSE and move this inner
optimization loop out of the CSE file.
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
| -rw-r--r-- | cse.c | 20 |
1 files changed, 13 insertions, 7 deletions
@@ -381,16 +381,10 @@ static struct instruction * try_to_cse(struct entrypoint *ep, struct instruction return i1; } -void cleanup_and_cse(struct entrypoint *ep) +static void cse_eliminate(struct entrypoint *ep) { int i; - simplify_memops(ep); -repeat: - repeat_phase = 0; - clean_up_insns(ep); - if (repeat_phase & REPEAT_CFG_CLEANUP) - kill_unreachable_bbs(ep); for (i = 0; i < INSN_HASH_SIZE; i++) { struct instruction_list **list = insn_hash_table + i; if (*list) { @@ -413,6 +407,18 @@ repeat: free_ptr_list((struct ptr_list **)list); } } +} + +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); |
