diff mbox series

[2/4] slice: remove unneeded nr_nrbits from EXPR_SLICE

Message ID 20210225233908.97275-3-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
EXPR_SLICE::r_nrbits is necessarily equal to its type's bit size.
So remove this redundancy.

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
 evaluate.c   | 1 -
 expression.h | 2 +-
 show-parse.c | 2 +-
 3 files changed, 2 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/evaluate.c b/evaluate.c
index 41871e18503a..e13edf5488b4 100644
--- a/evaluate.c
+++ b/evaluate.c
@@ -2170,7 +2170,6 @@  static struct symbol *evaluate_member_dereference(struct expression *expr)
 		}
 		expr->r_bitpos += bytes_to_bits(offset);
 		expr->type = EXPR_SLICE;
-		expr->r_nrbits = member->bit_size;
 		expr->r_bitpos += member->bit_offset;
 		expr->ctype = member;
 		return member;
diff --git a/expression.h b/expression.h
index 3e9e9d852c27..f733c07697c8 100644
--- a/expression.h
+++ b/expression.h
@@ -206,7 +206,7 @@  struct expression {
 		// EXPR_SLICE
 		struct /* slice */ {
 			struct expression *base;
-			unsigned r_bitpos, r_nrbits;
+			unsigned r_bitpos;
 		};
 		// EXPR_CAST, EXPR_FORCE_CAST, EXPR_IMPLIED_CAST,
 		// EXPR_SIZEOF, EXPR_ALIGNOF and EXPR_PTRSIZEOF
diff --git a/show-parse.c b/show-parse.c
index 3ab8ec8f1894..e2fc18bb4b3d 100644
--- a/show-parse.c
+++ b/show-parse.c
@@ -819,7 +819,7 @@  static int show_slice(struct expression *expr)
 {
 	int target = show_expression(expr->base);
 	int new = new_pseudo();
-	printf("\tslice.%d\t\tv%d,v%d,%d\n", expr->r_nrbits, target, new, expr->r_bitpos);
+	printf("\tslice.%d\t\tv%d,v%d,%d\n", expr->ctype->bit_size, target, new, expr->r_bitpos);
 	return new;
 }