From: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
To: linux-sparse@vger.kernel.org
Cc: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Subject: [PATCH 2/4] slice: remove unneeded nr_nrbits from EXPR_SLICE
Date: Fri, 26 Feb 2021 00:39:06 +0100 [thread overview]
Message-ID: <20210225233908.97275-3-luc.vanoostenryck@gmail.com> (raw)
In-Reply-To: <20210225233908.97275-1-luc.vanoostenryck@gmail.com>
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 --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;
}
--
2.30.0
next prev parent reply other threads:[~2021-02-25 23:40 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-25 23:39 [PATCH 0/4] small reorganization of OP_SLICE Luc Van Oostenryck
2021-02-25 23:39 ` [PATCH 1/4] slice: remove unneeded len from OP_SLICE Luc Van Oostenryck
2021-02-26 23:46 ` Ramsay Jones
2021-02-25 23:39 ` Luc Van Oostenryck [this message]
2021-02-25 23:39 ` [PATCH 3/4] slice: OP_SLICE needs the source's type: make it a kind of unop Luc Van Oostenryck
2021-02-26 23:56 ` Ramsay Jones
2021-02-28 21:40 ` Luc Van Oostenryck
2021-02-25 23:39 ` [PATCH 4/4] slice: display the source's size, like for unops Luc Van Oostenryck
2021-02-27 0:04 ` Ramsay Jones
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210225233908.97275-3-luc.vanoostenryck@gmail.com \
--to=luc.vanoostenryck@gmail.com \
--cc=linux-sparse@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).