diff options
| author | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2021-02-26 00:04:27 +0100 |
|---|---|---|
| committer | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2021-02-28 22:41:40 +0100 |
| commit | 04c02822a0750e3eb8ef2487e2407b3aa0b66245 (patch) | |
| tree | 41df68494a291077409eb45763e33b8cd4bca39b /linearize.c | |
| parent | fc5213b3f0040d21d0579b20cea9c4212e7cb504 (diff) | |
| download | sparse-dev-04c02822a0750e3eb8ef2487e2407b3aa0b66245.tar.gz | |
slice: OP_SLICE needs the source's type: make it a kind of unop
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>
Diffstat (limited to 'linearize.c')
| -rw-r--r-- | linearize.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/linearize.c b/linearize.c index 96a717bc..7ab69d3a 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; } |
