aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cse.c4
-rw-r--r--flow.c6
-rw-r--r--flow.h2
-rw-r--r--linearize.c3
-rw-r--r--linearize.h1
5 files changed, 12 insertions, 4 deletions
diff --git a/cse.c b/cse.c
index b5ae172..6a55234 100644
--- a/cse.c
+++ b/cse.c
@@ -223,8 +223,8 @@ static void sort_instruction_list(struct instruction_list **list)
static struct instruction * cse_one_instruction(struct instruction *insn, struct instruction *def)
{
- /* We re-use the "convert_load_insn()" function. Does the same thing */
- convert_load_insn(insn, def->target);
+ convert_instruction_target(insn, def->target);
+ insn->opcode = OP_NOP;
return def;
}
diff --git a/flow.c b/flow.c
index 7850b83..ff95d43 100644
--- a/flow.c
+++ b/flow.c
@@ -135,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);
}
-void convert_load_insn(struct instruction *insn, pseudo_t src)
+void convert_instruction_target(struct instruction *insn, pseudo_t src)
{
pseudo_t target, *usep;
@@ -147,7 +147,11 @@ void convert_load_insn(struct instruction *insn, pseudo_t src)
*usep = src;
} END_FOR_EACH_PTR(usep);
concat_user_list(target->users, &src->users);
+}
+static void convert_load_insn(struct instruction *insn, pseudo_t src)
+{
+ convert_instruction_target(insn, src);
/* Turn the load into a no-op */
insn->opcode = OP_LNOP;
}
diff --git a/flow.h b/flow.h
index 39d072d..29cf6e0 100644
--- a/flow.h
+++ b/flow.h
@@ -7,7 +7,7 @@ extern void simplify_symbol_usage(struct entrypoint *ep);
extern void simplify_phi_nodes(struct entrypoint *ep);
extern void pack_basic_blocks(struct entrypoint *ep);
-extern void convert_load_insn(struct instruction *insn, pseudo_t src);
+extern void convert_instruction_target(struct instruction *insn, pseudo_t src);
extern void cleanup_and_cse(struct entrypoint *ep);
#endif
diff --git a/linearize.c b/linearize.c
index 1479428..040acc2 100644
--- a/linearize.c
+++ b/linearize.c
@@ -340,6 +340,9 @@ void show_instruction(struct instruction *insn)
printf("\tnop (%s <- %d.%d.%d[%s])\n", show_pseudo(insn->target), insn->offset,
insn->type->bit_offset, insn->type->bit_size, show_pseudo(insn->src));
break;
+ case OP_NOP:
+ printf("\tnop (cse'd %s)\n", show_pseudo(insn->target));
+ break;
default:
printf("\top %d ???\n", op);
}
diff --git a/linearize.h b/linearize.h
index b6d8c6a..9fb4e81 100644
--- a/linearize.h
+++ b/linearize.h
@@ -160,6 +160,7 @@ enum opcode {
OP_SLICE,
OP_SNOP,
OP_LNOP,
+ OP_NOP,
/* Sparse tagging (line numbers, context, whatever) */
OP_CONTEXT,