diff mbox

give a type to OP_PHISOURCE

Message ID 20170303095421.39740-1-luc.vanoostenryck@gmail.com (mailing list archive)
State Superseded, archived
Headers show

Commit Message

Luc Van Oostenryck March 3, 2017, 9:54 a.m. UTC
Currently, OP_PHISOURCEs are given a size but not a type.

There is no good reasons fro that and it complicate the
further correct processing or make it impossible.

CC: Dibyendu Majumdar <mobile@majumdar.org.uk>
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
 flow.c      |  2 +-
 linearize.c | 16 +++++++---------
 linearize.h |  2 +-
 memops.c    |  2 +-
 4 files changed, 10 insertions(+), 12 deletions(-)

Comments

Christopher Li March 6, 2017, 2:27 a.m. UTC | #1
On Fri, Mar 3, 2017 at 5:54 PM, Luc Van Oostenryck
<luc.vanoostenryck@gmail.com> wrote:
> Currently, OP_PHISOURCEs are given a size but not a type.
>
> There is no good reasons fro that and it complicate the
> further correct processing or make it impossible.
>
> CC: Dibyendu Majumdar <mobile@majumdar.org.uk>
> Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>

I am looking at the llvm patches right now.

These four has similar names in the 13 patches so I assume
they can be safely dropped.

9602773-give-a-type-to-OP_PHISOURCE.patch
9602515-give-a-type-to-OP_SEL-always.patch
9602771-llvm-add-support-for-OP_NEG.patch
9603553-llvm-fix-do-not-mix-pointers-and-floats-when-doing-compares.patch

I am not sure about this two. Should I skip them?

# 9599615-llvm-fix-getting-type-of-values.patch
# 9601521-llvm-stores-does-not-create-or-modify-their-target.patch

Here is the 13 llvm patches I have in my queue.

9604553-01-13-llvm-add-a-helper-to-convert-an-integer-to-a-ValueRef.patch
9604547-02-13-llvm-fix-translation-of-PSEUDO_VALs-into-a-ValueRefs.patch
9604559-03-13-llvm-fix-output_op_store-which-modify-its-operand.patch
9604543-04-13-llvm-fix-output_op_-ptr-cast.patch
9604555-05-13-add-get_nth1_arg.patch
9604557-06-13-llvm-fix-type-of-literal-integer-passed-as-arguments.patch
9604545-07-13-llvm-fix-output-OP_ADD-mixed-with-pointers.patch
9604535-08-13-llvm-add-support-for-OP_NEG.patch
9604537-09-13-give-a-type-to-OP_PHISOURCE.patch
9604549-10-13-give-a-type-to-OP_SEL-always.patch
9604541-11-13-llvm-remove-unneeded-arg-module.patch
9604539-12-13-llvm-remove-unneeded-arg-fn.patch
9604551-13-13-llvm-fix-do-not-mix-pointers-and-floats-when-doing-compares.patch

Chris
--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Luc Van Oostenryck March 6, 2017, 2:44 a.m. UTC | #2
On Mon, Mar 06, 2017 at 10:27:26AM +0800, Christopher Li wrote:
> On Fri, Mar 3, 2017 at 5:54 PM, Luc Van Oostenryck
> <luc.vanoostenryck@gmail.com> wrote:
> > Currently, OP_PHISOURCEs are given a size but not a type.
> >
> > There is no good reasons fro that and it complicate the
> > further correct processing or make it impossible.
> >
> > CC: Dibyendu Majumdar <mobile@majumdar.org.uk>
> > Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
> 
> I am looking at the llvm patches right now.
> 
> These four has similar names in the 13 patches so I assume
> they can be safely dropped.
> 
> 9602773-give-a-type-to-OP_PHISOURCE.patch
> 9602515-give-a-type-to-OP_SEL-always.patch
> 9602771-llvm-add-support-for-OP_NEG.patch
> 9603553-llvm-fix-do-not-mix-pointers-and-floats-when-doing-compares.patch
> 
> I am not sure about this two. Should I skip them?
> 
> # 9599615-llvm-fix-getting-type-of-values.patch
> # 9601521-llvm-stores-does-not-create-or-modify-their-target.patch
> 
> Here is the 13 llvm patches I have in my queue.

Yes, those in the serie are the last version.
The other ones can be discarded (I keep uptodate the status of my
patches on patchwork).
 
Luc
--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Luc Van Oostenryck March 6, 2017, 2:58 a.m. UTC | #3
On Mon, Mar 06, 2017 at 10:27:26AM +0800, Christopher Li wrote:
> I am looking at the llvm patches right now.

Unrelated to this serie, but is it possible that you've somehow
forgot this patch: https://patchwork.kernel.org/patch/9582509/ ?
It was one where I had forgot to add my s-o-b. 

-- Luc
--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Christopher Li March 6, 2017, 3:48 a.m. UTC | #4
On Mon, Mar 6, 2017 at 10:58 AM, Luc Van Oostenryck
<luc.vanoostenryck@gmail.com> wrote:
> Unrelated to this serie, but is it possible that you've somehow
> forgot this patch: https://patchwork.kernel.org/patch/9582509/ ?
> It was one where I had forgot to add my s-o-b.

Thanks for the reminding, I did forget about this patch.

Applied.

Chris
--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Christopher Li March 6, 2017, 3:50 a.m. UTC | #5
On Mon, Mar 6, 2017 at 10:44 AM, Luc Van Oostenryck
<luc.vanoostenryck@gmail.com> wrote:
> Yes, those in the serie are the last version.
> The other ones can be discarded (I keep uptodate the status of my
> patches on patchwork).

So far I have been using patchworks as way to fetch patches.
I should learn to use the status field. That is good to know.

Chris
--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Luc Van Oostenryck March 6, 2017, 4:13 a.m. UTC | #6
On Mon, Mar 06, 2017 at 11:50:06AM +0800, Christopher Li wrote:
> On Mon, Mar 6, 2017 at 10:44 AM, Luc Van Oostenryck
> <luc.vanoostenryck@gmail.com> wrote:
> > Yes, those in the serie are the last version.
> > The other ones can be discarded (I keep uptodate the status of my
> > patches on patchwork).
> 
> So far I have been using patchworks as way to fetch patches.
> I should learn to use the status field. That is good to know.

I keep things simple and normaly just set the status to:
- 'Awaiting upstream' when you have pushed the patch on sparse-next,
- 'Superseded' when I post a newer version
And at more irregular interval I archive entries that are pushed
to the master branch.

For the CSE patch of last week, I've set its status to 'Under review'
instead of 'RFC' so that is stay visible on the web page:
	https://patchwork.kernel.org/project/linux-sparse/list/

Note: if you use the pwclient, you can script the status update
which is nice because otherwise it's a PITA to do this via the
web page when you have to do more than a few.

-- Luc
--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/flow.c b/flow.c
index 7730e70f1..e574d5e98 100644
--- a/flow.c
+++ b/flow.c
@@ -370,7 +370,7 @@  found_dominator:
 		if (dominators && phisrc_in_bb(*dominators, parent))
 			continue;
 		br = delete_last_instruction(&parent->insns);
-		phi = alloc_phi(parent, one->target, one->size);
+		phi = alloc_phi(parent, one->target, one->type);
 		phi->ident = phi->ident ? : pseudo->ident;
 		add_instruction(&parent->insns, br);
 		use_pseudo(insn, phi, add_pseudo(dominators, phi));
diff --git a/linearize.c b/linearize.c
index bdc85beb9..fb4c7bd10 100644
--- a/linearize.c
+++ b/linearize.c
@@ -815,9 +815,9 @@  static pseudo_t argument_pseudo(struct entrypoint *ep, int nr)
 	return pseudo;
 }
 
-pseudo_t alloc_phi(struct basic_block *source, pseudo_t pseudo, int size)
+pseudo_t alloc_phi(struct basic_block *source, pseudo_t pseudo, struct symbol *type)
 {
-	struct instruction *insn = alloc_instruction(OP_PHISOURCE, size);
+	struct instruction *insn = alloc_typed_instruction(OP_PHISOURCE, type);
 	pseudo_t phi = __alloc_pseudo(0);
 	static int nr = 0;
 
@@ -1350,19 +1350,18 @@  static pseudo_t linearize_short_conditional(struct entrypoint *ep, struct expres
 	struct basic_block *bb_false;
 	struct basic_block *merge = alloc_basic_block(ep, expr->pos);
 	pseudo_t phi1, phi2;
-	int size = type_size(expr->ctype);
 
 	if (!expr_false || !ep->active)
 		return VOID;
 
 	bb_false = alloc_basic_block(ep, expr_false->pos);
 	src1 = linearize_expression(ep, cond);
-	phi1 = alloc_phi(ep->active, src1, size);
+	phi1 = alloc_phi(ep->active, src1, expr->ctype);
 	add_branch(ep, expr, src1, merge, bb_false);
 
 	set_activeblock(ep, bb_false);
 	src2 = linearize_expression(ep, expr_false);
-	phi2 = alloc_phi(ep->active, src2, size);
+	phi2 = alloc_phi(ep->active, src2, expr->ctype);
 	set_activeblock(ep, merge);
 
 	return add_join_conditional(ep, expr, phi1, phi2);
@@ -1376,7 +1375,6 @@  static pseudo_t linearize_conditional(struct entrypoint *ep, struct expression *
 	pseudo_t src1, src2;
 	pseudo_t phi1, phi2;
 	struct basic_block *bb_true, *bb_false, *merge;
-	int size = type_size(expr->ctype);
 
 	if (!cond || !expr_true || !expr_false || !ep->active)
 		return VOID;
@@ -1388,12 +1386,12 @@  static pseudo_t linearize_conditional(struct entrypoint *ep, struct expression *
 
 	set_activeblock(ep, bb_true);
 	src1 = linearize_expression(ep, expr_true);
-	phi1 = alloc_phi(ep->active, src1, size);
+	phi1 = alloc_phi(ep->active, src1, expr->ctype);
 	add_goto(ep, merge); 
 
 	set_activeblock(ep, bb_false);
 	src2 = linearize_expression(ep, expr_false);
-	phi2 = alloc_phi(ep->active, src2, size);
+	phi2 = alloc_phi(ep->active, src2, expr->ctype);
 	set_activeblock(ep, merge);
 
 	return add_join_conditional(ep, expr, phi1, phi2);
@@ -1875,7 +1873,7 @@  static pseudo_t linearize_return(struct entrypoint *ep, struct statement *stmt)
 			phi_node->bb = bb_return;
 			add_instruction(&bb_return->insns, phi_node);
 		}
-		phi = alloc_phi(active, src, type_size(expr->ctype));
+		phi = alloc_phi(active, src, expr->ctype);
 		phi->ident = &return_ident;
 		use_pseudo(phi_node, phi, add_pseudo(&phi_node->phi_list, phi));
 	}
diff --git a/linearize.h b/linearize.h
index bac82d7ff..c03940eea 100644
--- a/linearize.h
+++ b/linearize.h
@@ -331,7 +331,7 @@  struct entrypoint {
 extern void insert_select(struct basic_block *bb, struct instruction *br, struct instruction *phi, pseudo_t if_true, pseudo_t if_false);
 extern void insert_branch(struct basic_block *bb, struct instruction *br, struct basic_block *target);
 
-pseudo_t alloc_phi(struct basic_block *source, pseudo_t pseudo, int size);
+pseudo_t alloc_phi(struct basic_block *source, pseudo_t pseudo, struct symbol *type);
 pseudo_t alloc_pseudo(struct instruction *def);
 pseudo_t value_pseudo(long long val);
 
diff --git a/memops.c b/memops.c
index 5efdd6f2d..187a63284 100644
--- a/memops.c
+++ b/memops.c
@@ -52,7 +52,7 @@  no_dominance:
 
 found_dominator:
 		br = delete_last_instruction(&parent->insns);
-		phi = alloc_phi(parent, one->target, one->size);
+		phi = alloc_phi(parent, one->target, one->type);
 		phi->ident = phi->ident ? : one->target->ident;
 		add_instruction(&parent->insns, br);
 		use_pseudo(insn, phi, add_pseudo(dominators, phi));