From da250551336d916ad0058bf200e1f0b29ccb2a8f Mon Sep 17 00:00:00 2001 From: Rusty Wagner Date: Fri, 4 Feb 2022 22:04:52 -0500 Subject: Add unreachable instruction for switch statements with an unreachable default --- highlevelilinstruction.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'highlevelilinstruction.cpp') diff --git a/highlevelilinstruction.cpp b/highlevelilinstruction.cpp index 0e32673b..98c85ea2 100644 --- a/highlevelilinstruction.cpp +++ b/highlevelilinstruction.cpp @@ -66,7 +66,7 @@ unordered_map HighLevelILInstru unordered_map> HighLevelILInstructionBase::operationOperandUsage = {{HLIL_NOP, {}}, {HLIL_BREAK, {}}, {HLIL_CONTINUE, {}}, - {HLIL_NORET, {}}, {HLIL_BP, {}}, {HLIL_UNDEF, {}}, {HLIL_UNIMPL, {}}, + {HLIL_NORET, {}}, {HLIL_BP, {}}, {HLIL_UNDEF, {}}, {HLIL_UNIMPL, {}}, {HLIL_UNREACHABLE, {}}, {HLIL_BLOCK, {BlockExprsHighLevelOperandUsage}}, {HLIL_IF, {ConditionExprHighLevelOperandUsage, TrueExprHighLevelOperandUsage, FalseExprHighLevelOperandUsage}}, {HLIL_WHILE, {ConditionExprHighLevelOperandUsage, LoopExprHighLevelOperandUsage}}, @@ -1371,6 +1371,8 @@ ExprId HighLevelILInstruction::CopyTo( return dest->Return(params, *this); case HLIL_NORET: return dest->NoReturn(*this); + case HLIL_UNREACHABLE: + return dest->Unreachable(*this); case HLIL_NEG: case HLIL_NOT: case HLIL_SX: @@ -2451,6 +2453,12 @@ ExprId HighLevelILFunction::NoReturn(const ILSourceLocation& loc) } +ExprId HighLevelILFunction::Unreachable(const ILSourceLocation& loc) +{ + return AddExprWithLocation(HLIL_UNREACHABLE, loc, 0); +} + + ExprId HighLevelILFunction::Goto(uint64_t target, const ILSourceLocation& loc) { return AddExprWithLocation(HLIL_GOTO, loc, 0, target); -- cgit v1.3.1