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

Function ConditionalJump

arch/mips/il.cpp:155–189  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

153
154
155static void ConditionalJump(Architecture* arch, LowLevelILFunction& il, size_t cond, size_t addrSize, uint64_t t, uint64_t f)
156{
157 BNLowLevelILLabel* trueLabel = il.GetLabelForAddress(arch, t);
158 BNLowLevelILLabel* falseLabel = il.GetLabelForAddress(arch, f);
159
160 if (trueLabel && falseLabel)
161 {
162 il.AddInstruction(il.If(cond, *trueLabel, *falseLabel));
163 return;
164 }
165
166 LowLevelILLabel trueCode, falseCode;
167
168 if (trueLabel)
169 {
170 il.AddInstruction(il.If(cond, *trueLabel, falseCode));
171 il.MarkLabel(falseCode);
172 il.AddInstruction(il.Jump(il.ConstPointer(addrSize, f)));
173 return;
174 }
175
176 if (falseLabel)
177 {
178 il.AddInstruction(il.If(cond, trueCode, *falseLabel));
179 il.MarkLabel(trueCode);
180 il.AddInstruction(il.Jump(il.ConstPointer(addrSize, t)));
181 return;
182 }
183
184 il.AddInstruction(il.If(cond, trueCode, falseCode));
185 il.MarkLabel(trueCode);
186 il.AddInstruction(il.Jump(il.ConstPointer(addrSize, t)));
187 il.MarkLabel(falseCode);
188 il.AddInstruction(il.Jump(il.ConstPointer(addrSize, f)));
189}
190
191ExprId GetConditionForInstruction(LowLevelILFunction& il, Instruction& instr, size_t registerSize)
192{

Callers 1

Calls 6

GetLabelForAddressMethod · 0.80
AddInstructionMethod · 0.45
IfMethod · 0.45
MarkLabelMethod · 0.45
JumpMethod · 0.45
ConstPointerMethod · 0.45

Tested by

no test coverage detected