aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2020-02-18 00:17:17 +0100
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2021-04-17 20:43:01 +0200
commit0dd7ffba2e72bb83012c6d6e8a5a98ed31c4168e (patch)
tree372dc5f797f4ac3146da2f2a52080898b80faa2b
parente19144ebc795f522a271763b0384610da792bd1a (diff)
downloadsparse-0dd7ffba2e72bb83012c6d6e8a5a98ed31c4168e.tar.gz
memops: dominates()'s first arg is redundant
The first argument of dominates(), 'pseudo', is simply the 'src' pseudo of it's second argument, the load or store instruction. It's thus not needed to give it in a separate argument. So, remove this redundant argument, since it makes things slightly clearer. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
-rw-r--r--flow.c4
-rw-r--r--flow.h2
-rw-r--r--memops.c18
3 files changed, 12 insertions, 12 deletions
diff --git a/flow.c b/flow.c
index c5319ae3..2e35bc1b 100644
--- a/flow.c
+++ b/flow.c
@@ -469,7 +469,7 @@ static inline int distinct_symbols(pseudo_t a, pseudo_t b)
*
* Return 0 if it doesn't, and -1 if you don't know.
*/
-int dominates(pseudo_t pseudo, struct instruction *insn, struct instruction *dom, int local)
+int dominates(struct instruction *insn, struct instruction *dom, int local)
{
switch (dom->opcode) {
case OP_CALL: case OP_ENTRY:
@@ -486,7 +486,7 @@ int dominates(pseudo_t pseudo, struct instruction *insn, struct instruction *dom
return 0;
}
- if (dom->src != pseudo) {
+ if (dom->src != insn->src) {
if (local)
return 0;
/* We don't think two explicitly different symbols ever alias */
diff --git a/flow.h b/flow.h
index 46d76a78..ac122fc3 100644
--- a/flow.h
+++ b/flow.h
@@ -38,7 +38,7 @@ static inline int kill_instruction_force(struct instruction *insn)
}
void check_access(struct instruction *insn);
-int dominates(pseudo_t pseudo, struct instruction *insn, struct instruction *dom, int local);
+int dominates(struct instruction *insn, struct instruction *dom, int local);
extern void vrfy_flow(struct entrypoint *ep);
extern int pseudo_in_list(struct pseudo_list *list, pseudo_t pseudo);
diff --git a/memops.c b/memops.c
index f734f6eb..82138832 100644
--- a/memops.c
+++ b/memops.c
@@ -58,7 +58,7 @@ end:
repeat_phase |= REPEAT_CSE;
}
-static int find_dominating_parents(pseudo_t pseudo, struct instruction *insn,
+static int find_dominating_parents(struct instruction *insn,
struct basic_block *bb, unsigned long generation, struct pseudo_list **dominators,
int local)
{
@@ -75,7 +75,7 @@ static int find_dominating_parents(pseudo_t pseudo, struct instruction *insn,
continue;
if (one == insn)
goto no_dominance;
- dominance = dominates(pseudo, insn, one, local);
+ dominance = dominates(insn, one, local);
if (dominance < 0) {
if (one->opcode == OP_LOAD)
continue;
@@ -90,7 +90,7 @@ no_dominance:
continue;
parent->generation = generation;
- if (!find_dominating_parents(pseudo, insn, parent, generation, dominators, local))
+ if (!find_dominating_parents(insn, parent, generation, dominators, local))
return 0;
continue;
@@ -160,7 +160,7 @@ static void simplify_loads(struct basic_block *bb)
int dominance;
if (!dom->bb)
continue;
- dominance = dominates(pseudo, insn, dom, local);
+ dominance = dominates(insn, dom, local);
if (dominance) {
/* possible partial dominance? */
if (dominance < 0) {
@@ -180,7 +180,7 @@ static void simplify_loads(struct basic_block *bb)
generation = ++bb_generation;
bb->generation = generation;
dominators = NULL;
- if (find_dominating_parents(pseudo, insn, bb, generation, &dominators, local)) {
+ if (find_dominating_parents(insn, bb, generation, &dominators, local)) {
/* This happens with initial assignments to structures etc.. */
if (!dominators) {
if (local) {
@@ -204,10 +204,10 @@ next_load:
} END_FOR_EACH_PTR_REVERSE(insn);
}
-static bool try_to_kill_store(pseudo_t pseudo, struct instruction *insn,
+static bool try_to_kill_store(struct instruction *insn,
struct instruction *dom, int local)
{
- int dominance = dominates(pseudo, insn, dom, local);
+ int dominance = dominates(insn, dom, local);
if (dominance) {
/* possible partial dominance? */
@@ -250,7 +250,7 @@ static void kill_dominated_stores(struct basic_block *bb)
RECURSE_PTR_REVERSE(insn, dom) {
if (!dom->bb)
continue;
- if (!try_to_kill_store(pseudo, insn, dom, local))
+ if (!try_to_kill_store(insn, dom, local))
goto next_store;
} END_FOR_EACH_PTR_REVERSE(dom);
@@ -264,7 +264,7 @@ static void kill_dominated_stores(struct basic_block *bb)
continue;
if (dom == insn)
goto next_parent;
- if (!try_to_kill_store(pseudo, insn, dom, local))
+ if (!try_to_kill_store(insn, dom, local))
goto next_parent;
} END_FOR_EACH_PTR(dom);
next_parent: