From 326046a5850b2a50769f1c787b293f0ed7564aa9 Mon Sep 17 00:00:00 2001 From: Luc Van Oostenryck Date: Wed, 18 Mar 2020 00:15:11 +0100 Subject: add instruction OP_UNREACH Signed-off-by: Luc Van Oostenryck --- Documentation/IR.rst | 3 +++ linearize.c | 3 +++ opcode.def | 1 + 3 files changed, 7 insertions(+) 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; diff --git a/opcode.def b/opcode.def index 57d827f4..2583e2f4 100644 --- a/opcode.def +++ b/opcode.def @@ -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) -- cgit 1.2.3-korg