aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2020-01-03 15:10:46 +0100
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2020-11-28 11:46:40 +0100
commit7624a18d61481b8411eff306a3dbf68209f0247b (patch)
tree7f59a31fe96c2af02caacb3c17c5240445e0175b
parentd50ca778c27ebf10c75036d54b2954ad8d057083 (diff)
downloadsparse-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.c7
-rw-r--r--flow.h1
-rw-r--r--memops.c7
-rw-r--r--ssa.c9
4 files changed, 10 insertions, 14 deletions
diff --git a/flow.c b/flow.c
index 20827acc..95e44ac1 100644
--- a/flow.c
+++ b/flow.c
@@ -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);
diff --git a/flow.h b/flow.h
index c55362de..46d76a78 100644
--- a/flow.h
+++ b/flow.h
@@ -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);
diff --git a/memops.c b/memops.c
index 66206882..7efade22 100644
--- a/memops.c
+++ b/memops.c
@@ -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;
}
diff --git a/ssa.c b/ssa.c
index 3e880050..a2e27030 100644
--- a/ssa.c
+++ b/ssa.c
@@ -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;