aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
authorLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2018-02-18 11:36:27 +0100
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2018-02-24 10:49:15 +0100
commitc6399ddb863f4a9dfb746589f19299fdbe80e28b (patch)
treec115dea1709fe527284a8d4e5add5df9f78eb234
parentc5ba883e6ac47381f8112ed33f22a931a79ac517 (diff)
downloadsparse-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.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/cse.c b/cse.c
index 5a5cea17..da0faa4e 100644
--- a/cse.c
+++ b/cse.c
@@ -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);