linux-sparse.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] better dealing with OP_PHISOURCE insn
@ 2011-04-09 11:53 Jan Pokorný
  2011-04-09 12:07 ` [PATCH 2/2] " Jan Pokorný
  0 siblings, 1 reply; 9+ messages in thread
From: Jan Pokorný @ 2011-04-09 11:53 UTC (permalink / raw)
  To: sparse; +Cc: linux-sparse

When (sure that) we are dealing with OP_PHISOURCE instruction, we should
use `phi_src' rather then `src1', which is dedicated to "binops and sel"
(linearize.h) and, by chance/intention, aliases with the former one.

On changed places, I used asserts to ensure the only type of
instructions involved in these changes are OP_PHISOURCE and proceeded
sparse itself and linux-2.6.35.12 sources with no assertion violation
encountered.  I'll provide a cumulative patch for this patch series
including these asserts, mainly for testing purposes.

Signed-off-by: Jan Pokorny <pokorny_jan@seznam.cz>
---
 cse.c       |    6 +++---
 flow.c      |    2 +-
 linearize.c |    2 +-
 simplify.c  |    6 +++---
 4 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/cse.c b/cse.c
index 2a15745..dc4d53c 100644
--- a/cse.c
+++ b/cse.c
@@ -27,8 +27,8 @@ static int phi_compare(pseudo_t phi1, pseudo_t phi2)
 	const struct instruction *def1 = phi1->def;
 	const struct instruction *def2 = phi2->def;
 
-	if (def1->src1 != def2->src1)
-		return def1->src1 < def2->src1 ? -1 : 1;
+	if (def1->phi_src != def2->phi_src)
+		return def1->phi_src < def2->phi_src ? -1 : 1;
 	if (def1->bb != def2->bb)
 		return def1->bb < def2->bb ? -1 : 1;
 	return 0;
@@ -105,7 +105,7 @@ static void clean_up_one_instruction(struct basic_block *bb, struct instruction
 			if (phi == VOID || !phi->def)
 				continue;
 			def = phi->def;
-			hash += hashval(def->src1);
+			hash += hashval(def->phi_src);
 			hash += hashval(def->bb);
 		} END_FOR_EACH_PTR(phi);
 		break;
diff --git a/flow.c b/flow.c
index 5bd9a1d..b6e46c7 100644
--- a/flow.c
+++ b/flow.c
@@ -105,7 +105,7 @@ static int try_to_simplify_bb(struct basic_block *bb, struct instruction *first,
 		if (!def)
 			continue;
 		source = def->bb;
-		pseudo = def->src1;
+		pseudo = def->phi_src;
 		if (!pseudo || !source)
 			continue;
 		br = last_instruction(source->insns);
diff --git a/linearize.c b/linearize.c
index f2034ce..f940862 100644
--- a/linearize.c
+++ b/linearize.c
@@ -1643,7 +1643,7 @@ static pseudo_t linearize_compound_statement(struct entrypoint *ep, struct state
 		if (pseudo_list_size(phi_node->phi_list)==1) {
 			pseudo = first_pseudo(phi_node->phi_list);
 			assert(pseudo->type == PSEUDO_PHI);
-			return pseudo->def->src1;
+			return pseudo->def->phi_src;
 		}
 		return phi_node->target;
 	}
diff --git a/simplify.c b/simplify.c
index 8200584..2d3c19d 100644
--- a/simplify.c
+++ b/simplify.c
@@ -126,10 +126,10 @@ static int clean_up_phi(struct instruction *insn)
 		if (phi == VOID)
 			continue;
 		def = phi->def;
-		if (def->src1 == VOID || !def->bb)
+		if (def->phi_src == VOID || !def->bb)
 			continue;
 		if (last) {
-			if (last->src1 != def->src1)
+			if (last->phi_src != def->phi_src)
 				same = 0;
 			continue;
 		}
@@ -137,7 +137,7 @@ static int clean_up_phi(struct instruction *insn)
 	} END_FOR_EACH_PTR(phi);
 
 	if (same) {
-		pseudo_t pseudo = last ? last->src1 : VOID;
+		pseudo_t pseudo = last ? last->phi_src : VOID;
 		convert_instruction_target(insn, pseudo);
 		clear_phi(insn);
 		return REPEAT_CSE;
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2011-04-16 16:21 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-09 11:53 [PATCH 1/2] better dealing with OP_PHISOURCE insn Jan Pokorný
2011-04-09 12:07 ` [PATCH 2/2] " Jan Pokorný
2011-04-09 12:12   ` Jan Pokorný
2011-04-14 10:10     ` Christopher Li
2011-04-15 22:52   ` Jan Pokorný
2011-04-16 10:56     ` Jan Pokorný
2011-04-16 11:16       ` Jan Pokorný
2011-04-16 14:49         ` Jan Pokorný
2011-04-16 16:21         ` Jan Pokorný

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).