From: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
To: linux-sparse@vger.kernel.org
Cc: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Subject: [PATCH 3/4] slice: OP_SLICE needs the source's type: make it a kind of unop
Date: Fri, 26 Feb 2021 00:39:07 +0100 [thread overview]
Message-ID: <20210225233908.97275-4-luc.vanoostenryck@gmail.com> (raw)
In-Reply-To: <20210225233908.97275-1-luc.vanoostenryck@gmail.com>
OP_SLICE's source's type is needed for some simplifications.
For example, in some cases it can be simplified into OP_TRUNC.
So, merge its representation with the one for unops which also
need the source's type.
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
linearize.c | 5 +++--
linearize.h | 5 +----
liveness.c | 5 +----
3 files changed, 5 insertions(+), 10 deletions(-)
diff --git a/linearize.c b/linearize.c
index 96a717bc2909..7ab69d3ac968 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", show_pseudo(insn->target), show_pseudo(insn->base), insn->from);
+ buf += sprintf(buf, "%s <- %s, %d", show_pseudo(insn->target), show_pseudo(insn->src), insn->from);
break;
case OP_NOT: case OP_NEG:
@@ -1239,7 +1239,8 @@ static pseudo_t linearize_slice(struct entrypoint *ep, struct expression *expr)
insn->target = new;
insn->from = expr->r_bitpos;
- use_pseudo(insn, pre, &insn->base);
+ insn->orig_type = expr->base->ctype;
+ use_pseudo(insn, pre, &insn->src);
add_one_insn(ep, insn);
return new;
}
diff --git a/linearize.h b/linearize.h
index 4d83675caaf1..429f4797e359 100644
--- a/linearize.h
+++ b/linearize.h
@@ -113,6 +113,7 @@ struct instruction {
};
struct /* unops */ {
pseudo_t src;
+ unsigned from; /* slice */
struct symbol *orig_type; /* casts */
};
struct /* memops */ {
@@ -127,10 +128,6 @@ struct instruction {
pseudo_t _src1, _src2; // alias .src[12]
struct symbol *itype; // input operands' type
};
- struct /* slice */ {
- pseudo_t base;
- unsigned from;
- };
struct /* setval */ {
struct expression *val;
};
diff --git a/liveness.c b/liveness.c
index 30a9a5b6b169..755509e59b52 100644
--- a/liveness.c
+++ b/liveness.c
@@ -76,6 +76,7 @@ static void track_instruction_usage(struct basic_block *bb, struct instruction *
/* Uni */
case OP_UNOP ... OP_UNOP_END:
case OP_SYMADDR:
+ case OP_SLICE:
USES(src1); DEFINES(target);
break;
@@ -121,10 +122,6 @@ static void track_instruction_usage(struct basic_block *bb, struct instruction *
} END_FOR_EACH_PTR(pseudo);
break;
- case OP_SLICE:
- USES(base); DEFINES(target);
- break;
-
case OP_ASM:
asm_liveness(bb, insn, def, use);
break;
--
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 ` [PATCH 2/4] slice: remove unneeded nr_nrbits from EXPR_SLICE Luc Van Oostenryck
2021-02-25 23:39 ` Luc Van Oostenryck [this message]
2021-02-26 23:56 ` [PATCH 3/4] slice: OP_SLICE needs the source's type: make it a kind of unop 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-4-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).