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

Function ExtractConditionClause

arch/powerpc/il.cpp:173–197  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

171
172
173static ExprId ExtractConditionClause(LowLevelILFunction& il, uint8_t crBit, bool negate = false)
174{
175 // MYLOG("%s() crbit:%x", __func__, crBit);
176 uint32_t flagBase = (crBit / 4) * 10;
177
178 switch (crBit & 3)
179 {
180 case IL_FLAG_LT:
181 if (negate) return il.FlagGroup(flagBase + IL_FLAGGROUP_CR0_GE);
182 else return il.FlagGroup(flagBase + IL_FLAGGROUP_CR0_LT);
183 case IL_FLAG_GT:
184 if (negate) return il.FlagGroup(flagBase + IL_FLAGGROUP_CR0_LE);
185 else return il.FlagGroup(flagBase + IL_FLAGGROUP_CR0_GT);
186 case IL_FLAG_EQ:
187 if (negate) return il.FlagGroup(flagBase + IL_FLAGGROUP_CR0_NE);
188 else return il.FlagGroup(flagBase + IL_FLAGGROUP_CR0_EQ);
189 }
190
191 ExprId result = il.Flag(crBit);
192
193 if (negate)
194 result = il.Not(0, result);
195
196 return result;
197}
198
199
200static bool LiftConditionalBranch(LowLevelILFunction& il, uint8_t bo, uint8_t bi, BNLowLevelILLabel& takenLabel, BNLowLevelILLabel& falseLabel, size_t addressSize_a=4)

Callers 1

LiftConditionalBranchFunction · 0.85

Calls 3

FlagGroupMethod · 0.80
FlagMethod · 0.45
NotMethod · 0.45

Tested by

no test coverage detected