diff options
author | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2020-01-03 15:10:46 +0100 |
---|---|---|
committer | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2020-11-28 11:46:40 +0100 |
commit | 7624a18d61481b8411eff306a3dbf68209f0247b (patch) | |
tree | 7f59a31fe96c2af02caacb3c17c5240445e0175b | |
parent | d50ca778c27ebf10c75036d54b2954ad8d057083 (diff) | |
download | sparse-7624a18d61481b8411eff306a3dbf68209f0247b.tar.gz |
replace convert_load_instruction() by replace_with_pseudo()
These two functions are now exactly the same, so replace the
first one by the second one.
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
-rw-r--r-- | flow.c | 7 | ||||
-rw-r--r-- | flow.h | 1 | ||||
-rw-r--r-- | memops.c | 7 | ||||
-rw-r--r-- | ssa.c | 9 |
4 files changed, 10 insertions, 14 deletions
@@ -16,6 +16,7 @@ #include "parse.h" #include "expression.h" #include "linearize.h" +#include "simplify.h" #include "flow.h" #include "target.h" #include "flowgraph.h" @@ -453,12 +454,6 @@ void convert_instruction_target(struct instruction *insn, pseudo_t src) target->users = NULL; } -void convert_load_instruction(struct instruction *insn, pseudo_t src) -{ - convert_instruction_target(insn, src); - kill_instruction(insn); -} - static int overlapping_memop(struct instruction *a, struct instruction *b) { unsigned int a_start = bytes_to_bits(a->offset); @@ -38,7 +38,6 @@ static inline int kill_instruction_force(struct instruction *insn) } void check_access(struct instruction *insn); -void convert_load_instruction(struct instruction *, pseudo_t); int dominates(pseudo_t pseudo, struct instruction *insn, struct instruction *dom, int local); extern void vrfy_flow(struct entrypoint *ep); @@ -14,6 +14,7 @@ #include "parse.h" #include "expression.h" #include "linearize.h" +#include "simplify.h" #include "flow.h" /* @@ -40,7 +41,7 @@ static void rewrite_load_instruction(struct instruction *insn, struct pseudo_lis * and convert the load into a LNOP and replace the * pseudo. */ - convert_load_instruction(insn, new); + replace_with_pseudo(insn, new); FOR_EACH_PTR(dominators, phi) { kill_instruction(phi->def); } END_FOR_EACH_PTR(phi); @@ -167,7 +168,7 @@ static void simplify_loads(struct basic_block *bb) if (!compatible_loads(insn, dom)) goto next_load; /* Yeehaa! Found one! */ - convert_load_instruction(insn, dom->target); + replace_with_pseudo(insn, dom->target); goto next_load; } } END_FOR_EACH_PTR_REVERSE(dom); @@ -181,7 +182,7 @@ static void simplify_loads(struct basic_block *bb) if (!dominators) { if (local) { assert(pseudo->type != PSEUDO_ARG); - convert_load_instruction(insn, value_pseudo(0)); + replace_with_pseudo(insn, value_pseudo(0)); } goto next_load; } @@ -11,7 +11,8 @@ #include "dominate.h" #include "flowgraph.h" #include "linearize.h" -#include "flow.h" // for convert_load_instruction() +#include "simplify.h" +#include "flow.h" // Is it possible and desirable for this to be promoted to a pseudo? @@ -109,7 +110,7 @@ static void rewrite_local_var(struct basic_block *bb, pseudo_t addr, int nbr_sto case OP_LOAD: if (!val) val = undef_pseudo(); - convert_load_instruction(insn, val); + replace_with_pseudo(insn, val); break; case OP_STORE: val = insn->target; @@ -150,7 +151,7 @@ static bool rewrite_single_store(struct instruction *store) // undefs ? - convert_load_instruction(insn, store->target); + replace_with_pseudo(insn, store->target); } END_FOR_EACH_PTR(pu); // is there some unconverted loads? @@ -292,7 +293,7 @@ static void ssa_rename_insn(struct basic_block *bb, struct instruction *insn) if (!var || !var->torename) break; val = lookup_var(bb, var); - convert_load_instruction(insn, val); + replace_with_pseudo(insn, val); break; case OP_PHI: var = insn->type; |