diff mbox series

[1/4] slice: remove unneeded len from OP_SLICE

Message ID 20210225233908.97275-2-luc.vanoostenryck@gmail.com (mailing list archive)
State Mainlined, archived
Headers show
Series small reorganization of OP_SLICE | expand

Commit Message

Luc Van Oostenryck Feb. 25, 2021, 11:39 p.m. UTC
OP_SLICE::len is necessarily equal to the result size.
So remove this redundancy.

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
 Documentation/IR.rst | 2 +-
 linearize.c          | 3 +--
 linearize.h          | 2 +-
 3 files changed, 3 insertions(+), 4 deletions(-)

Comments

Ramsay Jones Feb. 26, 2021, 11:46 p.m. UTC | #1
On 25/02/2021 23:39, Luc Van Oostenryck wrote:
> OP_SLICE::len is necessarily equal to the result size.
> So remove this redundancy.
> 
> Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
> ---
>  Documentation/IR.rst | 2 +-
>  linearize.c          | 3 +--
>  linearize.h          | 2 +-
>  3 files changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/Documentation/IR.rst b/Documentation/IR.rst
> index 38df84ff3954..c7db32073361 100644
> --- a/Documentation/IR.rst
> +++ b/Documentation/IR.rst
> @@ -408,7 +408,7 @@ Others
>  	Extract a "slice" from an aggregate.
>  
>  	* .base: (pseudo_t) aggregate (alias .src)
> -	* .from, .len: offet & size of the "slice" within the aggregate
> +	* .from: offet of the "slice" within the aggregate

s/offet/offset/

ATB,
Ramsay Jones

>  	* .target: result
>  	* .type: type of .target
>  
> diff --git a/linearize.c b/linearize.c
> index 0c9b0e59cc4b..96a717bc2909 100644
> --- a/linearize.c
> +++ b/linearize.c
> @@ -470,7 +470,7 @@ const char *show_instruction(struct instruction *insn)
>  		break;
>  
>  	case OP_SLICE:
> -		buf += sprintf(buf, "%s <- %s, %d, %d", show_pseudo(insn->target), show_pseudo(insn->base), insn->from, insn->len);
> +		buf += sprintf(buf, "%s <- %s, %d", show_pseudo(insn->target), show_pseudo(insn->base), insn->from);
>  		break;
>  
>  	case OP_NOT: case OP_NEG:
> @@ -1239,7 +1239,6 @@ static pseudo_t linearize_slice(struct entrypoint *ep, struct expression *expr)
>  
>  	insn->target = new;
>  	insn->from = expr->r_bitpos;
> -	insn->len = expr->r_nrbits;
>  	use_pseudo(insn, pre, &insn->base);
>  	add_one_insn(ep, insn);
>  	return new;
> diff --git a/linearize.h b/linearize.h
> index cf0cf066a8e5..4d83675caaf1 100644
> --- a/linearize.h
> +++ b/linearize.h
> @@ -129,7 +129,7 @@ struct instruction {
>  		};
>  		struct /* slice */ {
>  			pseudo_t base;
> -			unsigned from, len;
> +			unsigned from;
>  		};
>  		struct /* setval */ {
>  			struct expression *val;
>
diff mbox series

Patch

diff --git a/Documentation/IR.rst b/Documentation/IR.rst
index 38df84ff3954..c7db32073361 100644
--- a/Documentation/IR.rst
+++ b/Documentation/IR.rst
@@ -408,7 +408,7 @@  Others
 	Extract a "slice" from an aggregate.
 
 	* .base: (pseudo_t) aggregate (alias .src)
-	* .from, .len: offet & size of the "slice" within the aggregate
+	* .from: offet of the "slice" within the aggregate
 	* .target: result
 	* .type: type of .target
 
diff --git a/linearize.c b/linearize.c
index 0c9b0e59cc4b..96a717bc2909 100644
--- a/linearize.c
+++ b/linearize.c
@@ -470,7 +470,7 @@  const char *show_instruction(struct instruction *insn)
 		break;
 
 	case OP_SLICE:
-		buf += sprintf(buf, "%s <- %s, %d, %d", show_pseudo(insn->target), show_pseudo(insn->base), insn->from, insn->len);
+		buf += sprintf(buf, "%s <- %s, %d", show_pseudo(insn->target), show_pseudo(insn->base), insn->from);
 		break;
 
 	case OP_NOT: case OP_NEG:
@@ -1239,7 +1239,6 @@  static pseudo_t linearize_slice(struct entrypoint *ep, struct expression *expr)
 
 	insn->target = new;
 	insn->from = expr->r_bitpos;
-	insn->len = expr->r_nrbits;
 	use_pseudo(insn, pre, &insn->base);
 	add_one_insn(ep, insn);
 	return new;
diff --git a/linearize.h b/linearize.h
index cf0cf066a8e5..4d83675caaf1 100644
--- a/linearize.h
+++ b/linearize.h
@@ -129,7 +129,7 @@  struct instruction {
 		};
 		struct /* slice */ {
 			pseudo_t base;
-			unsigned from, len;
+			unsigned from;
 		};
 		struct /* setval */ {
 			struct expression *val;