aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/flow.c
diff options
authorLinus Torvalds <torvalds@ppc970.osdl.org>2004-11-23 13:26:50 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-07 21:04:35 -0700
commitfe8df476cce241da882b6895b219e082ad3960f2 (patch)
treec1d2d6677ed26e25ad8dedfbcbbfa19d9b8d3d19 /flow.c
parent34038a899aa290c162229cab3289264961fd1772 (diff)
downloadsparse-dev-fe8df476cce241da882b6895b219e082ad3960f2.tar.gz
Add initial CSE pass
It ain't very smart yet, but give it time. In particular, right now it gathers information for the whole function, but it only does the actual replacement if the instructions are in the same basic block.
Diffstat (limited to 'flow.c')
-rw-r--r--flow.c13
1 files changed, 2 insertions, 11 deletions
diff --git a/flow.c b/flow.c
index c1467e13..d8d8b72c 100644
--- a/flow.c
+++ b/flow.c
@@ -14,6 +14,7 @@
#include "parse.h"
#include "expression.h"
#include "linearize.h"
+#include "flow.h"
static unsigned long bb_generation;
@@ -134,7 +135,7 @@ static inline void concat_user_list(struct pseudo_ptr_list *src, struct pseudo_p
concat_ptr_list((struct ptr_list *)src, (struct ptr_list **)dst);
}
-static void convert_load_insn(struct instruction *insn, pseudo_t src)
+void convert_load_insn(struct instruction *insn, pseudo_t src)
{
pseudo_t target, *usep;
@@ -606,16 +607,6 @@ static void kill_unreachable_bbs(struct entrypoint *ep)
} END_FOR_EACH_PTR(bb);
}
-static void try_to_replace(struct basic_block *bb, struct basic_block **target,
- struct basic_block *old, struct basic_block *new)
-{
- if (*target == old) {
- *target = new;
- /* FIXME!! Fix child information */
- warning(bb->pos, "changed child from %p to %p", old, new);
- }
-}
-
static int rewrite_parent_branch(struct basic_block *bb, struct basic_block *old, struct basic_block *new)
{
struct instruction *insn = last_instruction(bb->insns);