MCPcopy Create free account
hub / github.com/Vector35/binaryninja-api / ConditionalJump

Function ConditionalJump

arch/armv7/il.cpp:69–109  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

67}
68
69static 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
112static void ConditionExecute(LowLevelILFunction& il, Condition cond, ExprId trueCase)

Callers 1

Calls 8

GetLabelForAddressMethod · 0.80
DirectJumpFunction · 0.70
GetConditionFunction · 0.70
AddInstructionMethod · 0.45
IfMethod · 0.45
MarkLabelMethod · 0.45
JumpMethod · 0.45
ConstPointerMethod · 0.45

Tested by

no test coverage detected