diff options
author | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2020-03-18 00:15:11 +0100 |
---|---|---|
committer | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2020-03-20 00:52:39 +0100 |
commit | 326046a5850b2a50769f1c787b293f0ed7564aa9 (patch) | |
tree | 9bb650de8f54cfa918df5500142aae0d48611924 | |
parent | 0095a95a31bb0acd57ce91b55c53a5d95de775d2 (diff) | |
download | sparse-326046a5850b2a50769f1c787b293f0ed7564aa9.tar.gz |
add instruction OP_UNREACH
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
-rw-r--r-- | Documentation/IR.rst | 3 | ||||
-rw-r--r-- | linearize.c | 3 | ||||
-rw-r--r-- | opcode.def | 1 |
3 files changed, 7 insertions, 0 deletions
diff --git a/Documentation/IR.rst b/Documentation/IR.rst index 9d6f2299..33a76166 100644 --- a/Documentation/IR.rst +++ b/Documentation/IR.rst @@ -47,6 +47,9 @@ Terminators * .type: type of .cond, must be an integral type * .multijmp_list: pairs of case-value - destination basic block +.. op:: OP_UNREACH + Mark code as unreachable + .. op:: OP_COMPUTEDGOTO Computed goto / branch to register diff --git a/linearize.c b/linearize.c index 30ed2a30..8e45f414 100644 --- a/linearize.c +++ b/linearize.c @@ -183,6 +183,7 @@ static const char *opcodes[] = { [OP_BR] = "br", [OP_CBR] = "cbr", [OP_SWITCH] = "switch", + [OP_UNREACH] = "unreachable", [OP_COMPUTEDGOTO] = "jmp *", /* Binary */ @@ -399,6 +400,8 @@ const char *show_instruction(struct instruction *insn) } END_FOR_EACH_PTR(jmp); break; } + case OP_UNREACH: + break; case OP_PHISOURCE: { struct instruction *phi; @@ -10,6 +10,7 @@ OPCODE(RET, BADOP, BADOP, BADOP, 1, OPF_NONE) OPCODE(BR, BADOP, BADOP, BADOP, 0, OPF_NONE) OPCODE(CBR, BADOP, BADOP, BADOP, 1, OPF_NONE) OPCODE(SWITCH, BADOP, BADOP, BADOP, 1, OPF_NONE) +OPCODE(UNREACH, BADOP, BADOP, BADOP, 0, OPF_NONE) OPCODE(COMPUTEDGOTO, BADOP, BADOP, BADOP, 1, OPF_NONE) OPCODE_RANGE(TERMINATOR, RET, COMPUTEDGOTO) |