| 67 | } |
| 68 | |
| 69 | static void ConditionalJump(Architecture* arch, LowLevelILFunction& il, Condition cond, size_t addrSize, uint64_t t, uint64_t f) |
| 70 | { |
| 71 | BNLowLevelILLabel* trueLabel = il.GetLabelForAddress(arch, t); |
| 72 | BNLowLevelILLabel* falseLabel = il.GetLabelForAddress(arch, f); |
| 73 | |
| 74 | if (UNCONDITIONAL(cond)) |
| 75 | { |
| 76 | il.AddInstruction(DirectJump(arch, il, t, addrSize)); |
| 77 | return; |
| 78 | } |
| 79 | |
| 80 | if (trueLabel && falseLabel) |
| 81 | { |
| 82 | il.AddInstruction(il.If(GetCondition(il, cond), *trueLabel, *falseLabel)); |
| 83 | return; |
| 84 | } |
| 85 | |
| 86 | LowLevelILLabel trueCode, falseCode; |
| 87 | |
| 88 | if (trueLabel) |
| 89 | { |
| 90 | il.AddInstruction(il.If(GetCondition(il, cond), *trueLabel, falseCode)); |
| 91 | il.MarkLabel(falseCode); |
| 92 | il.AddInstruction(il.Jump(il.ConstPointer(addrSize, f))); |
| 93 | return; |
| 94 | } |
| 95 | |
| 96 | if (falseLabel) |
| 97 | { |
| 98 | il.AddInstruction(il.If(GetCondition(il, cond), trueCode, *falseLabel)); |
| 99 | il.MarkLabel(trueCode); |
| 100 | il.AddInstruction(il.Jump(il.ConstPointer(addrSize, t))); |
| 101 | return; |
| 102 | } |
| 103 | |
| 104 | il.AddInstruction(il.If(GetCondition(il, cond), trueCode, falseCode)); |
| 105 | il.MarkLabel(trueCode); |
| 106 | il.AddInstruction(il.Jump(il.ConstPointer(addrSize, t))); |
| 107 | il.MarkLabel(falseCode); |
| 108 | il.AddInstruction(il.Jump(il.ConstPointer(addrSize, f))); |
| 109 | } |
| 110 | |
| 111 | |
| 112 | static void ConditionExecute(LowLevelILFunction& il, Condition cond, ExprId trueCase) |
no test coverage detected