diff options
| author | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2020-11-21 13:09:36 +0100 |
|---|---|---|
| committer | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2020-11-21 23:05:03 +0100 |
| commit | 45e0e859a9cf2d14546dd5597a777926087928f0 (patch) | |
| tree | ae6bd62a48241896b4708b704f37251973aecd50 /linearize.c | |
| parent | 1221dc1c8c4299c57bb53a7b0b8a8e4e8729f9d6 (diff) | |
| download | sparse-dev-45e0e859a9cf2d14546dd5597a777926087928f0.tar.gz | |
add a new instruction for label-as-value
Convert OP_SETVAL of a label into a new instruction: OP_LABEL.
There is 2 reasons to do this:
*) there is slightly less checking to be done in later phases
(since OP_SETVAL can be for labels but also strings)
*) OP_SETVAL is CSEd but this is largely useless because this
instruction is hashed on the expression's address and these
are (most) often not shared. With a separate instruction
for label expressions, their CSE is now OK because the hashing
is done on the BB.
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Diffstat (limited to 'linearize.c')
| -rw-r--r-- | linearize.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/linearize.c b/linearize.c index ab91113d..4391f09c 100644 --- a/linearize.c +++ b/linearize.c @@ -249,6 +249,7 @@ static const char *opcodes[] = { /* Memory */ [OP_LOAD] = "load", [OP_STORE] = "store", + [OP_LABEL] = "label", [OP_SETVAL] = "set", [OP_SETFVAL] = "setfval", [OP_SYMADDR] = "symaddr", @@ -345,6 +346,11 @@ const char *show_instruction(struct instruction *insn) buf += sprintf(buf, "%s", show_label(insn->bb_true)); break; + case OP_LABEL: + buf += sprintf(buf, "%s <- ", show_pseudo(insn->target)); + buf += sprintf(buf, "%s", show_label(insn->bb_true)); + break; + case OP_SETVAL: { struct expression *expr = insn->val; buf += sprintf(buf, "%s <- ", show_pseudo(insn->target)); |
