summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRusty Wagner <rusty@vector35.com>2017-09-18 23:25:08 -0400
committerRusty Wagner <rusty@vector35.com>2017-10-03 23:08:48 -0400
commit1c6f11277096534479c958b6d9fc5265d318ca2a (patch)
tree8263ebd0ecbcd72840bb70d008c33d6d21f73c24
parentd7701ace7ac399c26e3ef3eca17e36324c5ea19d (diff)
Add basic floating point instructions
-rw-r--r--binaryninjaapi.h61
-rw-r--r--binaryninjacore.h42
-rw-r--r--lowlevelilinstruction.cpp244
-rw-r--r--lowlevelilinstruction.h61
-rw-r--r--mediumlevelilinstruction.cpp250
-rw-r--r--mediumlevelilinstruction.h59
-rw-r--r--python/lowlevelil.py313
-rw-r--r--python/mediumlevelil.py27
8 files changed, 861 insertions, 196 deletions
diff --git a/binaryninjaapi.h b/binaryninjaapi.h
index 9d4a7257..7d686142 100644
--- a/binaryninjaapi.h
+++ b/binaryninjaapi.h
@@ -2453,6 +2453,9 @@ namespace BinaryNinja
ExprId RegisterSSA(size_t size, const SSARegister& reg, const ILSourceLocation& loc = ILSourceLocation());
ExprId RegisterSSAPartial(size_t size, const SSARegister& fullReg, uint32_t partialReg,
const ILSourceLocation& loc = ILSourceLocation());
+ ExprId RegisterSplit(size_t size, uint32_t high, uint32_t low, const ILSourceLocation& loc = ILSourceLocation());
+ ExprId RegisterSplitSSA(size_t size, const SSARegister& high, const SSARegister& low,
+ const ILSourceLocation& loc = ILSourceLocation());
ExprId Const(size_t size, uint64_t val, const ILSourceLocation& loc = ILSourceLocation());
ExprId ConstPointer(size_t size, uint64_t val, const ILSourceLocation& loc = ILSourceLocation());
ExprId Flag(uint32_t flag, const ILSourceLocation& loc = ILSourceLocation());
@@ -2497,19 +2500,19 @@ namespace BinaryNinja
const ILSourceLocation& loc = ILSourceLocation());
ExprId DivUnsigned(size_t size, ExprId a, ExprId b, uint32_t flags = 0,
const ILSourceLocation& loc = ILSourceLocation());
- ExprId DivDoublePrecUnsigned(size_t size, ExprId high, ExprId low, ExprId div, uint32_t flags = 0,
+ ExprId DivDoublePrecUnsigned(size_t size, ExprId a, ExprId b, uint32_t flags = 0,
const ILSourceLocation& loc = ILSourceLocation());
ExprId DivSigned(size_t size, ExprId a, ExprId b, uint32_t flags = 0,
const ILSourceLocation& loc = ILSourceLocation());
- ExprId DivDoublePrecSigned(size_t size, ExprId high, ExprId low, ExprId div, uint32_t flags = 0,
+ ExprId DivDoublePrecSigned(size_t size, ExprId a, ExprId b, uint32_t flags = 0,
const ILSourceLocation& loc = ILSourceLocation());
ExprId ModUnsigned(size_t size, ExprId a, ExprId b, uint32_t flags = 0,
const ILSourceLocation& loc = ILSourceLocation());
- ExprId ModDoublePrecUnsigned(size_t size, ExprId high, ExprId low, ExprId div, uint32_t flags = 0,
+ ExprId ModDoublePrecUnsigned(size_t size, ExprId a, ExprId b, uint32_t flags = 0,
const ILSourceLocation& loc = ILSourceLocation());
ExprId ModSigned(size_t size, ExprId a, ExprId b, uint32_t flags = 0,
const ILSourceLocation& loc = ILSourceLocation());
- ExprId ModDoublePrecSigned(size_t size, ExprId high, ExprId low, ExprId div, uint32_t flags = 0,
+ ExprId ModDoublePrecSigned(size_t size, ExprId a, ExprId b, uint32_t flags = 0,
const ILSourceLocation& loc = ILSourceLocation());
ExprId Neg(size_t size, ExprId a, uint32_t flags = 0, const ILSourceLocation& loc = ILSourceLocation());
ExprId Not(size_t size, ExprId a, uint32_t flags = 0, const ILSourceLocation& loc = ILSourceLocation());
@@ -2567,6 +2570,27 @@ namespace BinaryNinja
const ILSourceLocation& loc = ILSourceLocation());
ExprId MemoryPhi(size_t dest, const std::vector<size_t>& sources,
const ILSourceLocation& loc = ILSourceLocation());
+ ExprId FloatAdd(size_t size, ExprId a, ExprId b, uint32_t flags = 0,
+ const ILSourceLocation& loc = ILSourceLocation());
+ ExprId FloatSub(size_t size, ExprId a, ExprId b, uint32_t flags = 0,
+ const ILSourceLocation& loc = ILSourceLocation());
+ ExprId FloatMult(size_t size, ExprId a, ExprId b, uint32_t flags = 0,
+ const ILSourceLocation& loc = ILSourceLocation());
+ ExprId FloatDiv(size_t size, ExprId a, ExprId b, uint32_t flags = 0,
+ const ILSourceLocation& loc = ILSourceLocation());
+ ExprId FloatSqrt(size_t size, ExprId a, uint32_t flags = 0, const ILSourceLocation& loc = ILSourceLocation());
+ ExprId FloatNeg(size_t size, ExprId a, uint32_t flags = 0, const ILSourceLocation& loc = ILSourceLocation());
+ ExprId FloatAbs(size_t size, ExprId a, uint32_t flags = 0, const ILSourceLocation& loc = ILSourceLocation());
+ ExprId FloatToInt(size_t size, ExprId a, uint32_t flags = 0, const ILSourceLocation& loc = ILSourceLocation());
+ ExprId IntToFloat(size_t size, ExprId a, uint32_t flags = 0, const ILSourceLocation& loc = ILSourceLocation());
+ ExprId FloatConvert(size_t size, ExprId a, uint32_t flags = 0, const ILSourceLocation& loc = ILSourceLocation());
+ ExprId FloatCompareEqual(size_t size, ExprId a, ExprId b, const ILSourceLocation& loc = ILSourceLocation());
+ ExprId FloatCompareNotEqual(size_t size, ExprId a, ExprId b, const ILSourceLocation& loc = ILSourceLocation());
+ ExprId FloatCompareLessThan(size_t size, ExprId a, ExprId b, const ILSourceLocation& loc = ILSourceLocation());
+ ExprId FloatCompareLessEqual(size_t size, ExprId a, ExprId b, const ILSourceLocation& loc = ILSourceLocation());
+ ExprId FloatCompareGreaterEqual(size_t size, ExprId a, ExprId b, const ILSourceLocation& loc = ILSourceLocation());
+ ExprId FloatCompareGreaterThan(size_t size, ExprId a, ExprId b, const ILSourceLocation& loc = ILSourceLocation());
+ ExprId FloatCompareUnordered(size_t size, ExprId a, ExprId b, const ILSourceLocation& loc = ILSourceLocation());
ExprId Goto(BNLowLevelILLabel& label, const ILSourceLocation& loc = ILSourceLocation());
ExprId If(ExprId operand, BNLowLevelILLabel& t, BNLowLevelILLabel& f,
@@ -2725,6 +2749,8 @@ namespace BinaryNinja
ExprId Var(size_t size, const Variable& src, const ILSourceLocation& loc = ILSourceLocation());
ExprId VarField(size_t size, const Variable& src, uint64_t offset,
const ILSourceLocation& loc = ILSourceLocation());
+ ExprId VarSplit(size_t size, const Variable& high, const Variable& low,
+ const ILSourceLocation& loc = ILSourceLocation());
ExprId VarSSA(size_t size, const SSAVariable& src, const ILSourceLocation& loc = ILSourceLocation());
ExprId VarSSAField(size_t size, const SSAVariable& src, uint64_t offset,
const ILSourceLocation& loc = ILSourceLocation());
@@ -2732,6 +2758,8 @@ namespace BinaryNinja
const ILSourceLocation& loc = ILSourceLocation());
ExprId VarAliasedField(size_t size, const Variable& src, size_t memVersion, uint64_t offset,
const ILSourceLocation& loc = ILSourceLocation());
+ ExprId VarSplitSSA(size_t size, const SSAVariable& high, const SSAVariable& low,
+ const ILSourceLocation& loc = ILSourceLocation());
ExprId AddressOf(const Variable& var, const ILSourceLocation& loc = ILSourceLocation());
ExprId AddressOfField(const Variable& var, uint64_t offset,
const ILSourceLocation& loc = ILSourceLocation());
@@ -2770,17 +2798,17 @@ namespace BinaryNinja
const ILSourceLocation& loc = ILSourceLocation());
ExprId DivUnsigned(size_t size, ExprId left, ExprId right,
const ILSourceLocation& loc = ILSourceLocation());
- ExprId DivDoublePrecSigned(size_t size, ExprId high, ExprId low, ExprId right,
+ ExprId DivDoublePrecSigned(size_t size, ExprId left, ExprId right,
const ILSourceLocation& loc = ILSourceLocation());
- ExprId DivDoublePrecUnsigned(size_t size, ExprId high, ExprId low, ExprId right,
+ ExprId DivDoublePrecUnsigned(size_t size, ExprId left, ExprId right,
const ILSourceLocation& loc = ILSourceLocation());
ExprId ModSigned(size_t size, ExprId left, ExprId right,
const ILSourceLocation& loc = ILSourceLocation());
ExprId ModUnsigned(size_t size, ExprId left, ExprId right,
const ILSourceLocation& loc = ILSourceLocation());
- ExprId ModDoublePrecSigned(size_t size, ExprId high, ExprId low, ExprId right,
+ ExprId ModDoublePrecSigned(size_t size, ExprId left, ExprId right,
const ILSourceLocation& loc = ILSourceLocation());
- ExprId ModDoublePrecUnsigned(size_t size, ExprId high, ExprId low, ExprId right,
+ ExprId ModDoublePrecUnsigned(size_t size, ExprId left, ExprId right,
const ILSourceLocation& loc = ILSourceLocation());
ExprId Neg(size_t size, ExprId src, const ILSourceLocation& loc = ILSourceLocation());
ExprId Not(size_t size, ExprId src, const ILSourceLocation& loc = ILSourceLocation());
@@ -2845,6 +2873,23 @@ namespace BinaryNinja
const ILSourceLocation& loc = ILSourceLocation());
ExprId MemoryPhi(size_t destMemVersion, const std::vector<size_t>& sourceMemVersions,
const ILSourceLocation& loc = ILSourceLocation());
+ ExprId FloatAdd(size_t size, ExprId a, ExprId b, const ILSourceLocation& loc = ILSourceLocation());
+ ExprId FloatSub(size_t size, ExprId a, ExprId b, const ILSourceLocation& loc = ILSourceLocation());
+ ExprId FloatMult(size_t size, ExprId a, ExprId b, const ILSourceLocation& loc = ILSourceLocation());
+ ExprId FloatDiv(size_t size, ExprId a, ExprId b, const ILSourceLocation& loc = ILSourceLocation());
+ ExprId FloatSqrt(size_t size, ExprId a, const ILSourceLocation& loc = ILSourceLocation());
+ ExprId FloatNeg(size_t size, ExprId a, const ILSourceLocation& loc = ILSourceLocation());
+ ExprId FloatAbs(size_t size, ExprId a, const ILSourceLocation& loc = ILSourceLocation());
+ ExprId FloatToInt(size_t size, ExprId a, const ILSourceLocation& loc = ILSourceLocation());
+ ExprId IntToFloat(size_t size, ExprId a, const ILSourceLocation& loc = ILSourceLocation());
+ ExprId FloatConvert(size_t size, ExprId a, const ILSourceLocation& loc = ILSourceLocation());
+ ExprId FloatCompareEqual(size_t size, ExprId a, ExprId b, const ILSourceLocation& loc = ILSourceLocation());
+ ExprId FloatCompareNotEqual(size_t size, ExprId a, ExprId b, const ILSourceLocation& loc = ILSourceLocation());
+ ExprId FloatCompareLessThan(size_t size, ExprId a, ExprId b, const ILSourceLocation& loc = ILSourceLocation());
+ ExprId FloatCompareLessEqual(size_t size, ExprId a, ExprId b, const ILSourceLocation& loc = ILSourceLocation());
+ ExprId FloatCompareGreaterEqual(size_t size, ExprId a, ExprId b, const ILSourceLocation& loc = ILSourceLocation());
+ ExprId FloatCompareGreaterThan(size_t size, ExprId a, ExprId b, const ILSourceLocation& loc = ILSourceLocation());
+ ExprId FloatCompareUnordered(size_t size, ExprId a, ExprId b, const ILSourceLocation& loc = ILSourceLocation());
ExprId Goto(BNMediumLevelILLabel& label, const ILSourceLocation& loc = ILSourceLocation());
ExprId If(ExprId operand, BNMediumLevelILLabel& t, BNMediumLevelILLabel& f,
diff --git a/binaryninjacore.h b/binaryninjacore.h
index 1bb4c726..9bbea512 100644
--- a/binaryninjacore.h
+++ b/binaryninjacore.h
@@ -286,6 +286,7 @@ extern "C"
LLIL_PUSH, // Not valid in SSA form (expanded)
LLIL_POP, // Not valid in SSA form (expanded)
LLIL_REG, // Not valid in SSA form (see LLIL_REG_SSA)
+ LLIL_REG_SPLIT, // Not valid in SSA form (see LLIL_REG_SPLIT_SSA)
LLIL_CONST,
LLIL_CONST_PTR,
LLIL_FLAG, // Not valid in SSA form (see LLIL_FLAG_SSA)
@@ -349,6 +350,25 @@ extern "C"
LLIL_UNIMPL,
LLIL_UNIMPL_MEM,
+ // Floating point
+ LLIL_FADD,
+ LLIL_FSUB,
+ LLIL_FMUL,
+ LLIL_FDIV,
+ LLIL_FSQRT,
+ LLIL_FNEG,
+ LLIL_FABS,
+ LLIL_FLOAT_TO_INT,
+ LLIL_INT_TO_FLOAT,
+ LLIL_FLOAT_CONV,
+ LLIL_FCMP_E,
+ LLIL_FCMP_NE,
+ LLIL_FCMP_LT,
+ LLIL_FCMP_LE,
+ LLIL_FCMP_GE,
+ LLIL_FCMP_GT,
+ LLIL_FCMP_UO,
+
// The following instructions are only used in SSA form
LLIL_SET_REG_SSA,
LLIL_SET_REG_SSA_PARTIAL,
@@ -356,6 +376,7 @@ extern "C"
LLIL_REG_SPLIT_DEST_SSA, // Only valid within an LLIL_SET_REG_SPLIT_SSA instruction
LLIL_REG_SSA,
LLIL_REG_SSA_PARTIAL,
+ LLIL_REG_SPLIT_SSA,
LLIL_SET_FLAG_SSA,
LLIL_FLAG_SSA,
LLIL_FLAG_BIT_SSA,
@@ -745,6 +766,7 @@ extern "C"
MLIL_STORE_STRUCT, // Not valid in SSA form (see MLIL_STORE_STRUCT_SSA)
MLIL_VAR, // Not valid in SSA form (see MLIL_VAR_SSA)
MLIL_VAR_FIELD, // Not valid in SSA form (see MLIL_VAR_SSA_FIELD)
+ MLIL_VAR_SPLIT, // Not valid in SSA form (see MLIL_VAR_SSA)
MLIL_ADDRESS_OF,
MLIL_ADDRESS_OF_FIELD,
MLIL_CONST,
@@ -811,6 +833,25 @@ extern "C"
MLIL_UNIMPL,
MLIL_UNIMPL_MEM,
+ // Floating point
+ MLIL_FADD,
+ MLIL_FSUB,
+ MLIL_FMUL,
+ MLIL_FDIV,
+ MLIL_FSQRT,
+ MLIL_FNEG,
+ MLIL_FABS,
+ MLIL_FLOAT_TO_INT,
+ MLIL_INT_TO_FLOAT,
+ MLIL_FLOAT_CONV,
+ MLIL_FCMP_E,
+ MLIL_FCMP_NE,
+ MLIL_FCMP_LT,
+ MLIL_FCMP_LE,
+ MLIL_FCMP_GE,
+ MLIL_FCMP_GT,
+ MLIL_FCMP_UO,
+
// The following instructions are only used in SSA form
MLIL_SET_VAR_SSA,
MLIL_SET_VAR_SSA_FIELD,
@@ -821,6 +862,7 @@ extern "C"
MLIL_VAR_SSA_FIELD,
MLIL_VAR_ALIASED,
MLIL_VAR_ALIASED_FIELD,
+ MLIL_VAR_SPLIT_SSA,
MLIL_CALL_SSA,
MLIL_CALL_UNTYPED_SSA,
MLIL_SYSCALL_SSA,
diff --git a/lowlevelilinstruction.cpp b/lowlevelilinstruction.cpp
index d85e4f17..501b7b72 100644
--- a/lowlevelilinstruction.cpp
+++ b/lowlevelilinstruction.cpp
@@ -51,8 +51,6 @@ unordered_map<LowLevelILOperandUsage, LowLevelILOperandType>
{LeftExprLowLevelOperandUsage, ExprLowLevelOperand},
{RightExprLowLevelOperandUsage, ExprLowLevelOperand},
{CarryExprLowLevelOperandUsage, ExprLowLevelOperand},
- {HighExprLowLevelOperandUsage, ExprLowLevelOperand},
- {LowExprLowLevelOperandUsage, ExprLowLevelOperand},
{ConditionExprLowLevelOperandUsage, ExprLowLevelOperand},
{HighRegisterLowLevelOperandUsage, RegisterLowLevelOperand},
{HighSSARegisterLowLevelOperandUsage, SSARegisterLowLevelOperand},
@@ -105,6 +103,8 @@ unordered_map<BNLowLevelILOperation, vector<LowLevelILOperandUsage>>
{LLIL_REG, {SourceRegisterLowLevelOperandUsage}},
{LLIL_REG_SSA, {SourceSSARegisterLowLevelOperandUsage}},
{LLIL_REG_SSA_PARTIAL, {SourceSSARegisterLowLevelOperandUsage, PartialRegisterLowLevelOperandUsage}},
+ {LLIL_REG_SPLIT, {HighRegisterLowLevelOperandUsage, LowRegisterLowLevelOperandUsage}},
+ {LLIL_REG_SPLIT_SSA, {HighSSARegisterLowLevelOperandUsage, LowSSARegisterLowLevelOperandUsage}},
{LLIL_FLAG, {SourceFlagLowLevelOperandUsage}},
{LLIL_FLAG_BIT, {SourceFlagLowLevelOperandUsage, BitIndexLowLevelOperandUsage}},
{LLIL_FLAG_SSA, {SourceSSAFlagLowLevelOperandUsage}},
@@ -163,10 +163,10 @@ unordered_map<BNLowLevelILOperation, vector<LowLevelILOperandUsage>>
{LLIL_SBB, {LeftExprLowLevelOperandUsage, RightExprLowLevelOperandUsage, CarryExprLowLevelOperandUsage}},
{LLIL_RLC, {LeftExprLowLevelOperandUsage, RightExprLowLevelOperandUsage, CarryExprLowLevelOperandUsage}},
{LLIL_RRC, {LeftExprLowLevelOperandUsage, RightExprLowLevelOperandUsage, CarryExprLowLevelOperandUsage}},
- {LLIL_DIVU_DP, {HighExprLowLevelOperandUsage, LowExprLowLevelOperandUsage, RightExprLowLevelOperandUsage}},
- {LLIL_DIVS_DP, {HighExprLowLevelOperandUsage, LowExprLowLevelOperandUsage, RightExprLowLevelOperandUsage}},
- {LLIL_MODU_DP, {HighExprLowLevelOperandUsage, LowExprLowLevelOperandUsage, RightExprLowLevelOperandUsage}},
- {LLIL_MODS_DP, {HighExprLowLevelOperandUsage, LowExprLowLevelOperandUsage, RightExprLowLevelOperandUsage}},
+ {LLIL_DIVU_DP, {LeftExprLowLevelOperandUsage, RightExprLowLevelOperandUsage}},
+ {LLIL_DIVS_DP, {LeftExprLowLevelOperandUsage, RightExprLowLevelOperandUsage}},
+ {LLIL_MODU_DP, {LeftExprLowLevelOperandUsage, RightExprLowLevelOperandUsage}},
+ {LLIL_MODS_DP, {LeftExprLowLevelOperandUsage, RightExprLowLevelOperandUsage}},
{LLIL_PUSH, {SourceExprLowLevelOperandUsage}},
{LLIL_NEG, {SourceExprLowLevelOperandUsage}},
{LLIL_NOT, {SourceExprLowLevelOperandUsage}},
@@ -174,7 +174,24 @@ unordered_map<BNLowLevelILOperation, vector<LowLevelILOperandUsage>>
{LLIL_ZX, {SourceExprLowLevelOperandUsage}},
{LLIL_LOW_PART, {SourceExprLowLevelOperandUsage}},
{LLIL_BOOL_TO_INT, {SourceExprLowLevelOperandUsage}},
- {LLIL_UNIMPL_MEM, {SourceExprLowLevelOperandUsage}}
+ {LLIL_UNIMPL_MEM, {SourceExprLowLevelOperandUsage}},
+ {LLIL_FADD, {LeftExprLowLevelOperandUsage, RightExprLowLevelOperandUsage}},
+ {LLIL_FSUB, {LeftExprLowLevelOperandUsage, RightExprLowLevelOperandUsage}},
+ {LLIL_FMUL, {LeftExprLowLevelOperandUsage, RightExprLowLevelOperandUsage}},
+ {LLIL_FDIV, {LeftExprLowLevelOperandUsage, RightExprLowLevelOperandUsage}},
+ {LLIL_FSQRT, {SourceExprLowLevelOperandUsage}},
+ {LLIL_FNEG, {SourceExprLowLevelOperandUsage}},
+ {LLIL_FABS, {SourceExprLowLevelOperandUsage}},
+ {LLIL_FLOAT_TO_INT, {SourceExprLowLevelOperandUsage}},
+ {LLIL_INT_TO_FLOAT, {SourceExprLowLevelOperandUsage}},
+ {LLIL_FLOAT_CONV, {SourceExprLowLevelOperandUsage}},
+ {LLIL_FCMP_E, {LeftExprLowLevelOperandUsage, RightExprLowLevelOperandUsage}},
+ {LLIL_FCMP_NE, {LeftExprLowLevelOperandUsage, RightExprLowLevelOperandUsage}},
+ {LLIL_FCMP_LT, {LeftExprLowLevelOperandUsage, RightExprLowLevelOperandUsage}},
+ {LLIL_FCMP_LE, {LeftExprLowLevelOperandUsage, RightExprLowLevelOperandUsage}},
+ {LLIL_FCMP_GE, {LeftExprLowLevelOperandUsage, RightExprLowLevelOperandUsage}},
+ {LLIL_FCMP_GT, {LeftExprLowLevelOperandUsage, RightExprLowLevelOperandUsage}},
+ {LLIL_FCMP_UO, {LeftExprLowLevelOperandUsage, RightExprLowLevelOperandUsage}}
};
@@ -1179,6 +1196,12 @@ void LowLevelILInstruction::VisitExprs(const std::function<bool(const LowLevelIL
case LLIL_LOW_PART:
case LLIL_BOOL_TO_INT:
case LLIL_UNIMPL_MEM:
+ case LLIL_FSQRT:
+ case LLIL_FNEG:
+ case LLIL_FABS:
+ case LLIL_FLOAT_TO_INT:
+ case LLIL_INT_TO_FLOAT:
+ case LLIL_FLOAT_CONV:
AsOneOperand().GetSourceExpr().VisitExprs(func);
break;
case LLIL_ADD:
@@ -1198,6 +1221,10 @@ void LowLevelILInstruction::VisitExprs(const std::function<bool(const LowLevelIL
case LLIL_DIVS:
case LLIL_MODU:
case LLIL_MODS:
+ case LLIL_DIVU_DP:
+ case LLIL_DIVS_DP:
+ case LLIL_MODU_DP:
+ case LLIL_MODS_DP:
case LLIL_CMP_E:
case LLIL_CMP_NE:
case LLIL_CMP_SLT:
@@ -1210,6 +1237,17 @@ void LowLevelILInstruction::VisitExprs(const std::function<bool(const LowLevelIL
case LLIL_CMP_UGT:
case LLIL_TEST_BIT:
case LLIL_ADD_OVERFLOW:
+ case LLIL_FADD:
+ case LLIL_FSUB:
+ case LLIL_FMUL:
+ case LLIL_FDIV:
+ case LLIL_FCMP_E:
+ case LLIL_FCMP_NE:
+ case LLIL_FCMP_LT:
+ case LLIL_FCMP_LE:
+ case LLIL_FCMP_GE:
+ case LLIL_FCMP_GT:
+ case LLIL_FCMP_UO:
AsTwoOperand().GetLeftExpr().VisitExprs(func);
AsTwoOperand().GetRightExpr().VisitExprs(func);
break;
@@ -1221,14 +1259,6 @@ void LowLevelILInstruction::VisitExprs(const std::function<bool(const LowLevelIL
AsTwoOperandWithCarry().GetRightExpr().VisitExprs(func);
AsTwoOperandWithCarry().GetCarryExpr().VisitExprs(func);
break;
- case LLIL_DIVU_DP:
- case LLIL_DIVS_DP:
- case LLIL_MODU_DP:
- case LLIL_MODS_DP:
- AsDoublePrecision().GetHighExpr().VisitExprs(func);
- AsDoublePrecision().GetLowExpr().VisitExprs(func);
- AsDoublePrecision().GetRightExpr().VisitExprs(func);
- break;
default:
break;
}
@@ -1294,6 +1324,12 @@ ExprId LowLevelILInstruction::CopyTo(LowLevelILFunction* dest,
case LLIL_REG_SSA_PARTIAL:
return dest->RegisterSSAPartial(size, GetSourceSSARegister<LLIL_REG_SSA_PARTIAL>(),
GetPartialRegister<LLIL_REG_SSA_PARTIAL>(), *this);
+ case LLIL_REG_SPLIT:
+ return dest->RegisterSplit(size, GetHighRegister<LLIL_REG_SPLIT>(),
+ GetLowRegister<LLIL_REG_SPLIT>(), *this);
+ case LLIL_REG_SPLIT_SSA:
+ return dest->RegisterSplitSSA(size, GetHighSSARegister<LLIL_REG_SPLIT_SSA>(),
+ GetLowSSARegister<LLIL_REG_SPLIT_SSA>(), *this);
case LLIL_FLAG:
return dest->Flag(GetSourceFlag<LLIL_FLAG>(), *this);
case LLIL_FLAG_SSA:
@@ -1371,6 +1407,12 @@ ExprId LowLevelILInstruction::CopyTo(LowLevelILFunction* dest,
case LLIL_LOW_PART:
case LLIL_BOOL_TO_INT:
case LLIL_UNIMPL_MEM:
+ case LLIL_FSQRT:
+ case LLIL_FNEG:
+ case LLIL_FABS:
+ case LLIL_FLOAT_TO_INT:
+ case LLIL_INT_TO_FLOAT:
+ case LLIL_FLOAT_CONV:
return dest->AddExprWithLocation(operation, *this, size, flags,
subExprHandler(AsOneOperand().GetSourceExpr()));
case LLIL_ADD:
@@ -1390,6 +1432,10 @@ ExprId LowLevelILInstruction::CopyTo(LowLevelILFunction* dest,
case LLIL_DIVS:
case LLIL_MODU:
case LLIL_MODS:
+ case LLIL_DIVU_DP:
+ case LLIL_DIVS_DP:
+ case LLIL_MODU_DP:
+ case LLIL_MODS_DP:
case LLIL_CMP_E:
case LLIL_CMP_NE:
case LLIL_CMP_SLT:
@@ -1402,6 +1448,17 @@ ExprId LowLevelILInstruction::CopyTo(LowLevelILFunction* dest,
case LLIL_CMP_UGT:
case LLIL_TEST_BIT:
case LLIL_ADD_OVERFLOW:
+ case LLIL_FADD:
+ case LLIL_FSUB:
+ case LLIL_FMUL:
+ case LLIL_FDIV:
+ case LLIL_FCMP_E:
+ case LLIL_FCMP_NE:
+ case LLIL_FCMP_LT:
+ case LLIL_FCMP_LE:
+ case LLIL_FCMP_GE:
+ case LLIL_FCMP_GT:
+ case LLIL_FCMP_UO:
return dest->AddExprWithLocation(operation, *this, size, flags,
subExprHandler(AsTwoOperand().GetLeftExpr()), subExprHandler(AsTwoOperand().GetRightExpr()));
case LLIL_ADC:
@@ -1412,14 +1469,6 @@ ExprId LowLevelILInstruction::CopyTo(LowLevelILFunction* dest,
subExprHandler(AsTwoOperandWithCarry().GetLeftExpr()),
subExprHandler(AsTwoOperandWithCarry().GetRightExpr()),
subExprHandler(AsTwoOperandWithCarry().GetCarryExpr()));
- case LLIL_DIVU_DP:
- case LLIL_DIVS_DP:
- case LLIL_MODU_DP:
- case LLIL_MODS_DP:
- return dest->AddExprWithLocation(operation, *this, size, flags,
- subExprHandler(AsDoublePrecision().GetHighExpr()),
- subExprHandler(AsDoublePrecision().GetLowExpr()),
- subExprHandler(AsDoublePrecision().GetRightExpr()));
default:
throw LowLevelILInstructionAccessException();
}
@@ -1574,24 +1623,6 @@ LowLevelILInstruction LowLevelILInstruction::GetCarryExpr() const
}
-LowLevelILInstruction LowLevelILInstruction::GetHighExpr() const
-{
- size_t operandIndex;
- if (GetOperandIndexForUsage(HighExprLowLevelOperandUsage, operandIndex))
- return GetRawOperandAsExpr(operandIndex);
- throw LowLevelILInstructionAccessException();
-}
-
-
-LowLevelILInstruction LowLevelILInstruction::GetLowExpr() const
-{
- size_t operandIndex;
- if (GetOperandIndexForUsage(LowExprLowLevelOperandUsage, operandIndex))
- return GetRawOperandAsExpr(operandIndex);
- throw LowLevelILInstructionAccessException();
-}
-
-
LowLevelILInstruction LowLevelILInstruction::GetConditionExpr() const
{
size_t operandIndex;
@@ -1899,6 +1930,19 @@ ExprId LowLevelILFunction::RegisterSSAPartial(size_t size, const SSARegister& fu
}
+ExprId LowLevelILFunction::RegisterSplit(size_t size, uint32_t high, uint32_t low, const ILSourceLocation& loc)
+{
+ return AddExprWithLocation(LLIL_REG_SPLIT, loc, size, 0, high, low);
+}
+
+
+ExprId LowLevelILFunction::RegisterSplitSSA(size_t size, const SSARegister& high, const SSARegister& low,
+ const ILSourceLocation& loc)
+{
+ return AddExprWithLocation(LLIL_REG_SPLIT_SSA, loc, size, 0, high.reg, high.version, low.reg, low.version);
+}
+
+
ExprId LowLevelILFunction::Const(size_t size, uint64_t val, const ILSourceLocation& loc)
{
return AddExprWithLocation(LLIL_CONST, loc, size, 0, val);
@@ -2054,10 +2098,10 @@ ExprId LowLevelILFunction::DivUnsigned(size_t size, ExprId a, ExprId b, uint32_t
}
-ExprId LowLevelILFunction::DivDoublePrecUnsigned(size_t size, ExprId high, ExprId low, ExprId div, uint32_t flags,
+ExprId LowLevelILFunction::DivDoublePrecUnsigned(size_t size, ExprId a, ExprId b, uint32_t flags,
const ILSourceLocation& loc)
{
- return AddExprWithLocation(LLIL_DIVU_DP, loc, size, flags, high, low, div);
+ return AddExprWithLocation(LLIL_DIVU_DP, loc, size, flags, a, b);
}
@@ -2067,10 +2111,10 @@ ExprId LowLevelILFunction::DivSigned(size_t size, ExprId a, ExprId b, uint32_t f
}
-ExprId LowLevelILFunction::DivDoublePrecSigned(size_t size, ExprId high, ExprId low, ExprId div, uint32_t flags,
+ExprId LowLevelILFunction::DivDoublePrecSigned(size_t size, ExprId a, ExprId b, uint32_t flags,
const ILSourceLocation& loc)
{
- return AddExprWithLocation(LLIL_DIVS_DP, loc, size, flags, high, low, div);
+ return AddExprWithLocation(LLIL_DIVS_DP, loc, size, flags, a, b);
}
@@ -2081,10 +2125,10 @@ ExprId LowLevelILFunction::ModUnsigned(size_t size, ExprId a, ExprId b, uint32_t
}
-ExprId LowLevelILFunction::ModDoublePrecUnsigned(size_t size, ExprId high, ExprId low, ExprId div, uint32_t flags,
+ExprId LowLevelILFunction::ModDoublePrecUnsigned(size_t size, ExprId a, ExprId b, uint32_t flags,
const ILSourceLocation& loc)
{
- return AddExprWithLocation(LLIL_MODU_DP, loc, size, flags, high, low, div);
+ return AddExprWithLocation(LLIL_MODU_DP, loc, size, flags, a, b);
}
@@ -2094,10 +2138,10 @@ ExprId LowLevelILFunction::ModSigned(size_t size, ExprId a, ExprId b, uint32_t f
}
-ExprId LowLevelILFunction::ModDoublePrecSigned(size_t size, ExprId high, ExprId low, ExprId div, uint32_t flags,
+ExprId LowLevelILFunction::ModDoublePrecSigned(size_t size, ExprId a, ExprId b, uint32_t flags,
const ILSourceLocation& loc)
{
- return AddExprWithLocation(LLIL_MODS_DP, loc, size, flags, high, low, div);
+ return AddExprWithLocation(LLIL_MODS_DP, loc, size, flags, a, b);
}
@@ -2326,3 +2370,105 @@ ExprId LowLevelILFunction::MemoryPhi(size_t dest, const vector<size_t>& sources,
{
return AddExprWithLocation(LLIL_MEM_PHI, loc, 0, 0, dest, sources.size(), AddIndexList(sources));
}
+
+
+ExprId LowLevelILFunction::FloatAdd(size_t size, ExprId a, ExprId b, uint32_t flags, const ILSourceLocation& loc)
+{
+ return AddExprWithLocation(LLIL_FADD, loc, size, flags, a, b);
+}
+
+
+ExprId LowLevelILFunction::FloatSub(size_t size, ExprId a, ExprId b, uint32_t flags, const ILSourceLocation& loc)
+{
+ return AddExprWithLocation(LLIL_FSUB, loc, size, flags, a, b);
+}
+
+
+ExprId LowLevelILFunction::FloatMult(size_t size, ExprId a, ExprId b, uint32_t flags, const ILSourceLocation& loc)
+{
+ return AddExprWithLocation(LLIL_FMUL, loc, size, flags, a, b);
+}
+
+
+ExprId LowLevelILFunction::FloatDiv(size_t size, ExprId a, ExprId b, uint32_t flags, const ILSourceLocation& loc)
+{
+ return AddExprWithLocation(LLIL_FDIV, loc, size, flags, a, b);
+}
+
+
+ExprId LowLevelILFunction::FloatSqrt(size_t size, ExprId a, uint32_t flags, const ILSourceLocation& loc)
+{
+ return AddExprWithLocation(LLIL_FSQRT, loc, size, flags, a);
+}
+
+
+ExprId LowLevelILFunction::FloatNeg(size_t size, ExprId a, uint32_t flags, const ILSourceLocation& loc)
+{
+ return AddExprWithLocation(LLIL_FNEG, loc, size, flags, a);
+}
+
+
+ExprId LowLevelILFunction::FloatAbs(size_t size, ExprId a, uint32_t flags, const ILSourceLocation& loc)
+{
+ return AddExprWithLocation(LLIL_FABS, loc, size, flags, a);
+}
+
+
+ExprId LowLevelILFunction::FloatToInt(size_t size, ExprId a, uint32_t flags, const ILSourceLocation& loc)
+{
+ return AddExprWithLocation(LLIL_FLOAT_TO_INT, loc, size, flags, a);
+}
+
+
+ExprId LowLevelILFunction::IntToFloat(size_t size, ExprId a, uint32_t flags, const ILSourceLocation& loc)
+{
+ return AddExprWithLocation(LLIL_INT_TO_FLOAT, loc, size, flags, a);
+}
+
+
+ExprId LowLevelILFunction::FloatConvert(size_t size, ExprId a, uint32_t flags, const ILSourceLocation& loc)
+{
+ return AddExprWithLocation(LLIL_FLOAT_CONV, loc, size, flags, a);
+}
+
+
+ExprId LowLevelILFunction::FloatCompareEqual(size_t size, ExprId a, ExprId b, const ILSourceLocation& loc)
+{
+ return AddExprWithLocation(LLIL_FCMP_E, loc, size, 0, a, b);
+}
+
+
+ExprId LowLevelILFunction::FloatCompareNotEqual(size_t size, ExprId a, ExprId b, const ILSourceLocation& loc)
+{
+ return AddExprWithLocation(LLIL_FCMP_NE, loc, size, 0, a, b);
+}
+
+
+ExprId LowLevelILFunction::FloatCompareLessThan(size_t size, ExprId a, ExprId b, const ILSourceLocation& loc)
+{
+ return AddExprWithLocation(LLIL_FCMP_LT, loc, size, 0, a, b);
+}
+
+
+ExprId LowLevelILFunction::FloatCompareLessEqual(size_t size, ExprId a, ExprId b, const ILSourceLocation& loc)
+{
+ return AddExprWithLocation(LLIL_FCMP_LE, loc, size, 0, a, b);
+}
+
+
+ExprId LowLevelILFunction::FloatCompareGreaterEqual(size_t size, ExprId a, ExprId b, const ILSourceLocation& loc)
+{
+ return AddExprWithLocation(LLIL_FCMP_GE, loc, size, 0, a, b);
+}
+
+
+ExprId LowLevelILFunction::FloatCompareGreaterThan(size_t size, ExprId a, ExprId b, const ILSourceLocation& loc)
+{
+ return AddExprWithLocation(LLIL_FCMP_GT, loc, size, 0, a, b);
+}
+
+
+ExprId LowLevelILFunction::FloatCompareUnordered(size_t size, ExprId a, ExprId b, const ILSourceLocation& loc)
+{
+ return AddExprWithLocation(LLIL_FCMP_UO, loc, size, 0, a, b);
+}
diff --git a/lowlevelilinstruction.h b/lowlevelilinstruction.h
index b2849d44..8c8fe55f 100644
--- a/lowlevelilinstruction.h
+++ b/lowlevelilinstruction.h
@@ -49,7 +49,6 @@ namespace BinaryNinja
struct LowLevelILOneOperandInstruction;
struct LowLevelILTwoOperandInstruction;
struct LowLevelILTwoOperandWithCarryInstruction;
- struct LowLevelILDoublePrecisionInstruction;
struct LowLevelILLabel;
struct MediumLevelILInstruction;
class LowLevelILOperand;
@@ -118,8 +117,6 @@ namespace BinaryNinja
LeftExprLowLevelOperandUsage,
RightExprLowLevelOperandUsage,
CarryExprLowLevelOperandUsage,
- HighExprLowLevelOperandUsage,
- LowExprLowLevelOperandUsage,
ConditionExprLowLevelOperandUsage,
HighRegisterLowLevelOperandUsage,
HighSSARegisterLowLevelOperandUsage,
@@ -428,10 +425,6 @@ namespace BinaryNinja
{
return *(LowLevelILTwoOperandWithCarryInstruction*)this;
}
- LowLevelILDoublePrecisionInstruction& AsDoublePrecision()
- {
- return *(LowLevelILDoublePrecisionInstruction*)this;
- }
template <BNLowLevelILOperation N>
const LowLevelILInstructionAccessor<N>& As() const
@@ -456,10 +449,6 @@ namespace BinaryNinja
{
return *(const LowLevelILTwoOperandWithCarryInstruction*)this;
}
- const LowLevelILDoublePrecisionInstruction& AsDoublePrecision() const
- {
- return *(const LowLevelILDoublePrecisionInstruction*)this;
- }
};
struct LowLevelILInstruction: public LowLevelILInstructionBase
@@ -491,8 +480,6 @@ namespace BinaryNinja
template <BNLowLevelILOperation N> LowLevelILInstruction GetLeftExpr() const { return As<N>().GetLeftExpr(); }
template <BNLowLevelILOperation N> LowLevelILInstruction GetRightExpr() const { return As<N>().GetRightExpr(); }
template <BNLowLevelILOperation N> LowLevelILInstruction GetCarryExpr() const { return As<N>().GetCarryExpr(); }
- template <BNLowLevelILOperation N> LowLevelILInstruction GetHighExpr() const { return As<N>().GetHighExpr(); }
- template <BNLowLevelILOperation N> LowLevelILInstruction GetLowExpr() const { return As<N>().GetLowExpr(); }
template <BNLowLevelILOperation N> LowLevelILInstruction GetConditionExpr() const { return As<N>().GetConditionExpr(); }
template <BNLowLevelILOperation N> uint32_t GetHighRegister() const { return As<N>().GetHighRegister(); }
template <BNLowLevelILOperation N> SSARegister GetHighSSARegister() const { return As<N>().GetHighSSARegister(); }
@@ -544,8 +531,6 @@ namespace BinaryNinja
LowLevelILInstruction GetLeftExpr() const;
LowLevelILInstruction GetRightExpr() const;
LowLevelILInstruction GetCarryExpr() const;
- LowLevelILInstruction GetHighExpr() const;
- LowLevelILInstruction GetLowExpr() const;
LowLevelILInstruction GetConditionExpr() const;
uint32_t GetHighRegister() const;
SSARegister GetHighSSARegister() const;
@@ -651,13 +636,6 @@ namespace BinaryNinja
LowLevelILInstruction GetCarryExpr() const { return GetRawOperandAsExpr(2); }
};
- struct LowLevelILDoublePrecisionInstruction: public LowLevelILInstructionBase
- {
- LowLevelILInstruction GetHighExpr() const { return GetRawOperandAsExpr(0); }
- LowLevelILInstruction GetLowExpr() const { return GetRawOperandAsExpr(1); }
- LowLevelILInstruction GetRightExpr() const { return GetRawOperandAsExpr(2); }
- };
-
// Implementations of each instruction to fetch the correct operand value for the valid operands, these
// are derived from LowLevelILInstructionBase so that invalid operand accessor functions will generate
// a compiler error.
@@ -764,6 +742,19 @@ namespace BinaryNinja
void SetSourceSSAVersion(size_t version) { UpdateRawOperand(1, version); }
};
+ template <> struct LowLevelILInstructionAccessor<LLIL_REG_SPLIT>: public LowLevelILInstructionBase
+ {
+ uint32_t GetHighRegister() const { return GetRawOperandAsRegister(0); }
+ uint32_t GetLowRegister() const { return GetRawOperandAsRegister(1); }
+ };
+ template <> struct LowLevelILInstructionAccessor<LLIL_REG_SPLIT_SSA>: public LowLevelILInstructionBase
+ {
+ SSARegister GetHighSSARegister() const { return GetRawOperandAsSSARegister(0); }
+ SSARegister GetLowSSARegister() const { return GetRawOperandAsSSARegister(2); }
+ void SetHighSSAVersion(size_t version) { UpdateRawOperand(1, version); }
+ void SetLowSSAVersion(size_t version) { UpdateRawOperand(3, version); }
+ };
+
template <> struct LowLevelILInstructionAccessor<LLIL_JUMP>: public LowLevelILInstructionBase
{
LowLevelILInstruction GetDestExpr() const { return GetRawOperandAsExpr(0); }
@@ -880,6 +871,10 @@ namespace BinaryNinja
template <> struct LowLevelILInstructionAccessor<LLIL_DIVS>: public LowLevelILTwoOperandInstruction {};
template <> struct LowLevelILInstructionAccessor<LLIL_MODU>: public LowLevelILTwoOperandInstruction {};
template <> struct LowLevelILInstructionAccessor<LLIL_MODS>: public LowLevelILTwoOperandInstruction {};
+ template <> struct LowLevelILInstructionAccessor<LLIL_DIVU_DP>: public LowLevelILTwoOperandInstruction {};
+ template <> struct LowLevelILInstructionAccessor<LLIL_DIVS_DP>: public LowLevelILTwoOperandInstruction {};
+ template <> struct LowLevelILInstructionAccessor<LLIL_MODU_DP>: public LowLevelILTwoOperandInstruction {};
+ template <> struct LowLevelILInstructionAccessor<LLIL_MODS_DP>: public LowLevelILTwoOperandInstruction {};
template <> struct LowLevelILInstructionAccessor<LLIL_CMP_E>: public LowLevelILTwoOperandInstruction {};
template <> struct LowLevelILInstructionAccessor<LLIL_CMP_NE>: public LowLevelILTwoOperandInstruction {};
template <> struct LowLevelILInstructionAccessor<LLIL_CMP_SLT>: public LowLevelILTwoOperandInstruction {};
@@ -892,17 +887,23 @@ namespace BinaryNinja
template <> struct LowLevelILInstructionAccessor<LLIL_CMP_UGT>: public LowLevelILTwoOperandInstruction {};
template <> struct LowLevelILInstructionAccessor<LLIL_TEST_BIT>: public LowLevelILTwoOperandInstruction {};
template <> struct LowLevelILInstructionAccessor<LLIL_ADD_OVERFLOW>: public LowLevelILTwoOperandInstruction {};
+ template <> struct LowLevelILInstructionAccessor<LLIL_FADD>: public LowLevelILTwoOperandInstruction {};
+ template <> struct LowLevelILInstructionAccessor<LLIL_FSUB>: public LowLevelILTwoOperandInstruction {};
+ template <> struct LowLevelILInstructionAccessor<LLIL_FMUL>: public LowLevelILTwoOperandInstruction {};
+ template <> struct LowLevelILInstructionAccessor<LLIL_FDIV>: public LowLevelILTwoOperandInstruction {};
+ template <> struct LowLevelILInstructionAccessor<LLIL_FCMP_E>: public LowLevelILTwoOperandInstruction {};
+ template <> struct LowLevelILInstructionAccessor<LLIL_FCMP_NE>: public LowLevelILTwoOperandInstruction {};
+ template <> struct LowLevelILInstructionAccessor<LLIL_FCMP_LT>: public LowLevelILTwoOperandInstruction {};
+ template <> struct LowLevelILInstructionAccessor<LLIL_FCMP_LE>: public LowLevelILTwoOperandInstruction {};
+ template <> struct LowLevelILInstructionAccessor<LLIL_FCMP_GE>: public LowLevelILTwoOperandInstruction {};
+ template <> struct LowLevelILInstructionAccessor<LLIL_FCMP_GT>: public LowLevelILTwoOperandInstruction {};
+ template <> struct LowLevelILInstructionAccessor<LLIL_FCMP_UO>: public LowLevelILTwoOperandInstruction {};
template <> struct LowLevelILInstructionAccessor<LLIL_ADC>: public LowLevelILTwoOperandWithCarryInstruction {};
template <> struct LowLevelILInstructionAccessor<LLIL_SBB>: public LowLevelILTwoOperandWithCarryInstruction {};
template <> struct LowLevelILInstructionAccessor<LLIL_RLC>: public LowLevelILTwoOperandWithCarryInstruction {};
template <> struct LowLevelILInstructionAccessor<LLIL_RRC>: public LowLevelILTwoOperandWithCarryInstruction {};
- template <> struct LowLevelILInstructionAccessor<LLIL_DIVU_DP>: public LowLevelILDoublePrecisionInstruction {};
- template <> struct LowLevelILInstructionAccessor<LLIL_DIVS_DP>: public LowLevelILDoublePrecisionInstruction {};
- template <> struct LowLevelILInstructionAccessor<LLIL_MODU_DP>: public LowLevelILDoublePrecisionInstruction {};
- template <> struct LowLevelILInstructionAccessor<LLIL_MODS_DP>: public LowLevelILDoublePrecisionInstruction {};
-
template <> struct LowLevelILInstructionAccessor<LLIL_PUSH>: public LowLevelILOneOperandInstruction {};
template <> struct LowLevelILInstructionAccessor<LLIL_NEG>: public LowLevelILOneOperandInstruction {};
template <> struct LowLevelILInstructionAccessor<LLIL_NOT>: public LowLevelILOneOperandInstruction {};
@@ -911,4 +912,10 @@ namespace BinaryNinja
template <> struct LowLevelILInstructionAccessor<LLIL_LOW_PART>: public LowLevelILOneOperandInstruction {};
template <> struct LowLevelILInstructionAccessor<LLIL_BOOL_TO_INT>: public LowLevelILOneOperandInstruction {};
template <> struct LowLevelILInstructionAccessor<LLIL_UNIMPL_MEM>: public LowLevelILOneOperandInstruction {};
+ template <> struct LowLevelILInstructionAccessor<LLIL_FSQRT>: public LowLevelILOneOperandInstruction {};
+ template <> struct LowLevelILInstructionAccessor<LLIL_FNEG>: public LowLevelILOneOperandInstruction {};
+ template <> struct LowLevelILInstructionAccessor<LLIL_FABS>: public LowLevelILOneOperandInstruction {};
+ template <> struct LowLevelILInstructionAccessor<LLIL_FLOAT_TO_INT>: public LowLevelILOneOperandInstruction {};
+ template <> struct LowLevelILInstructionAccessor<LLIL_INT_TO_FLOAT>: public LowLevelILOneOperandInstruction {};
+ template <> struct LowLevelILInstructionAccessor<LLIL_FLOAT_CONV>: public LowLevelILOneOperandInstruction {};
}
diff --git a/mediumlevelilinstruction.cpp b/mediumlevelilinstruction.cpp
index ec6aa1c6..b0e607b2 100644
--- a/mediumlevelilinstruction.cpp
+++ b/mediumlevelilinstruction.cpp
@@ -45,8 +45,6 @@ unordered_map<MediumLevelILOperandUsage, MediumLevelILOperandType>
{LeftExprMediumLevelOperandUsage, ExprMediumLevelOperand},
{RightExprMediumLevelOperandUsage, ExprMediumLevelOperand},
{CarryExprMediumLevelOperandUsage, ExprMediumLevelOperand},
- {HighExprMediumLevelOperandUsage, ExprMediumLevelOperand},
- {LowExprMediumLevelOperandUsage, ExprMediumLevelOperand},
{StackExprMediumLevelOperandUsage, ExprMediumLevelOperand},
{ConditionExprMediumLevelOperandUsage, ExprMediumLevelOperand},
{HighVariableMediumLevelOperandUsage, VariableMediumLevelOperand},
@@ -112,10 +110,12 @@ unordered_map<BNMediumLevelILOperation, vector<MediumLevelILOperandUsage>>
SourceExprMediumLevelOperandUsage}},
{MLIL_VAR, {SourceVariableMediumLevelOperandUsage}},
{MLIL_VAR_FIELD, {SourceVariableMediumLevelOperandUsage, OffsetMediumLevelOperandUsage}},
+ {MLIL_VAR_SPLIT, {HighVariableMediumLevelOperandUsage, LowVariableMediumLevelOperandUsage}},
{MLIL_VAR_SSA, {SourceSSAVariableMediumLevelOperandUsage}},
{MLIL_VAR_SSA_FIELD, {SourceSSAVariableMediumLevelOperandUsage, OffsetMediumLevelOperandUsage}},
{MLIL_VAR_ALIASED, {SourceSSAVariableMediumLevelOperandUsage}},
{MLIL_VAR_ALIASED_FIELD, {SourceSSAVariableMediumLevelOperandUsage, OffsetMediumLevelOperandUsage}},
+ {MLIL_VAR_SPLIT_SSA, {HighSSAVariableMediumLevelOperandUsage, LowSSAVariableMediumLevelOperandUsage}},
{MLIL_ADDRESS_OF, {SourceVariableMediumLevelOperandUsage}},
{MLIL_ADDRESS_OF_FIELD, {SourceVariableMediumLevelOperandUsage, OffsetMediumLevelOperandUsage}},
{MLIL_JUMP, {DestExprMediumLevelOperandUsage}},
@@ -187,21 +187,34 @@ unordered_map<BNMediumLevelILOperation, vector<MediumLevelILOperandUsage>>
CarryExprMediumLevelOperandUsage}},
{MLIL_RRC, {LeftExprMediumLevelOperandUsage, RightExprMediumLevelOperandUsage,
CarryExprMediumLevelOperandUsage}},
- {MLIL_DIVU_DP, {HighExprMediumLevelOperandUsage, LowExprMediumLevelOperandUsage,
- RightExprMediumLevelOperandUsage}},
- {MLIL_DIVS_DP, {HighExprMediumLevelOperandUsage, LowExprMediumLevelOperandUsage,
- RightExprMediumLevelOperandUsage}},
- {MLIL_MODU_DP, {HighExprMediumLevelOperandUsage, LowExprMediumLevelOperandUsage,
- RightExprMediumLevelOperandUsage}},
- {MLIL_MODS_DP, {HighExprMediumLevelOperandUsage, LowExprMediumLevelOperandUsage,
- RightExprMediumLevelOperandUsage}},
+ {MLIL_DIVU_DP, {LeftExprMediumLevelOperandUsage, RightExprMediumLevelOperandUsage}},
+ {MLIL_DIVS_DP, {LeftExprMediumLevelOperandUsage, RightExprMediumLevelOperandUsage}},
+ {MLIL_MODU_DP, {LeftExprMediumLevelOperandUsage, RightExprMediumLevelOperandUsage}},
+ {MLIL_MODS_DP, {LeftExprMediumLevelOperandUsage, RightExprMediumLevelOperandUsage}},
{MLIL_NEG, {SourceExprMediumLevelOperandUsage}},
{MLIL_NOT, {SourceExprMediumLevelOperandUsage}},
{MLIL_SX, {SourceExprMediumLevelOperandUsage}},
{MLIL_ZX, {SourceExprMediumLevelOperandUsage}},
{MLIL_LOW_PART, {SourceExprMediumLevelOperandUsage}},
{MLIL_BOOL_TO_INT, {SourceExprMediumLevelOperandUsage}},
- {MLIL_UNIMPL_MEM, {SourceExprMediumLevelOperandUsage}}
+ {MLIL_UNIMPL_MEM, {SourceExprMediumLevelOperandUsage}},
+ {MLIL_FADD, {LeftExprMediumLevelOperandUsage, RightExprMediumLevelOperandUsage}},
+ {MLIL_FSUB, {LeftExprMediumLevelOperandUsage, RightExprMediumLevelOperandUsage}},
+ {MLIL_FMUL, {LeftExprMediumLevelOperandUsage, RightExprMediumLevelOperandUsage}},
+ {MLIL_FDIV, {LeftExprMediumLevelOperandUsage, RightExprMediumLevelOperandUsage}},
+ {MLIL_FSQRT, {SourceExprMediumLevelOperandUsage}},
+ {MLIL_FNEG, {SourceExprMediumLevelOperandUsage}},
+ {MLIL_FABS, {SourceExprMediumLevelOperandUsage}},
+ {MLIL_FLOAT_TO_INT, {SourceExprMediumLevelOperandUsage}},
+ {MLIL_INT_TO_FLOAT, {SourceExprMediumLevelOperandUsage}},
+ {MLIL_FLOAT_CONV, {SourceExprMediumLevelOperandUsage}},
+ {MLIL_FCMP_E, {LeftExprMediumLevelOperandUsage, RightExprMediumLevelOperandUsage}},
+ {MLIL_FCMP_NE, {LeftExprMediumLevelOperandUsage, RightExprMediumLevelOperandUsage}},
+ {MLIL_FCMP_LT, {LeftExprMediumLevelOperandUsage, RightExprMediumLevelOperandUsage}},
+ {MLIL_FCMP_LE, {LeftExprMediumLevelOperandUsage, RightExprMediumLevelOperandUsage}},
+ {MLIL_FCMP_GE, {LeftExprMediumLevelOperandUsage, RightExprMediumLevelOperandUsage}},
+ {MLIL_FCMP_GT, {LeftExprMediumLevelOperandUsage, RightExprMediumLevelOperandUsage}},
+ {MLIL_FCMP_UO, {LeftExprMediumLevelOperandUsage, RightExprMediumLevelOperandUsage}}
};
@@ -1266,6 +1279,12 @@ void MediumLevelILInstruction::VisitExprs(const std::function<bool(const MediumL
case MLIL_LOAD_STRUCT:
case MLIL_LOAD_SSA:
case MLIL_LOAD_STRUCT_SSA:
+ case MLIL_FSQRT:
+ case MLIL_FNEG:
+ case MLIL_FABS:
+ case MLIL_FLOAT_TO_INT:
+ case MLIL_INT_TO_FLOAT:
+ case MLIL_FLOAT_CONV:
AsOneOperand().GetSourceExpr().VisitExprs(func);
break;
case MLIL_ADD:
@@ -1285,6 +1304,10 @@ void MediumLevelILInstruction::VisitExprs(const std::function<bool(const MediumL
case MLIL_DIVS:
case MLIL_MODU:
case MLIL_MODS:
+ case MLIL_DIVU_DP:
+ case MLIL_DIVS_DP:
+ case MLIL_MODU_DP:
+ case MLIL_MODS_DP:
case MLIL_CMP_E:
case MLIL_CMP_NE:
case MLIL_CMP_SLT:
@@ -1297,6 +1320,17 @@ void MediumLevelILInstruction::VisitExprs(const std::function<bool(const MediumL
case MLIL_CMP_UGT:
case MLIL_TEST_BIT:
case MLIL_ADD_OVERFLOW:
+ case MLIL_FADD:
+ case MLIL_FSUB:
+ case MLIL_FMUL:
+ case MLIL_FDIV:
+ case MLIL_FCMP_E:
+ case MLIL_FCMP_NE:
+ case MLIL_FCMP_LT:
+ case MLIL_FCMP_LE:
+ case MLIL_FCMP_GE:
+ case MLIL_FCMP_GT:
+ case MLIL_FCMP_UO:
AsTwoOperand().GetLeftExpr().VisitExprs(func);
AsTwoOperand().GetRightExpr().VisitExprs(func);
break;
@@ -1308,14 +1342,6 @@ void MediumLevelILInstruction::VisitExprs(const std::function<bool(const MediumL
AsTwoOperandWithCarry().GetRightExpr().VisitExprs(func);
AsTwoOperandWithCarry().GetCarryExpr().VisitExprs(func);
break;
- case MLIL_DIVU_DP:
- case MLIL_DIVS_DP:
- case MLIL_MODU_DP:
- case MLIL_MODS_DP:
- AsDoublePrecision().GetHighExpr().VisitExprs(func);
- AsDoublePrecision().GetLowExpr().VisitExprs(func);
- AsDoublePrecision().GetRightExpr().VisitExprs(func);
- break;
default:
break;
}
@@ -1380,6 +1406,9 @@ ExprId MediumLevelILInstruction::CopyTo(MediumLevelILFunction* dest,
case MLIL_VAR_FIELD:
return dest->VarField(size, GetSourceVariable<MLIL_VAR_FIELD>(),
GetOffset<MLIL_VAR_FIELD>(), *this);
+ case MLIL_VAR_SPLIT:
+ return dest->VarSplit(size, GetHighVariable<MLIL_VAR_SPLIT>(),
+ GetLowVariable<MLIL_VAR_SPLIT>(), *this);
case MLIL_VAR_SSA:
return dest->VarSSA(size, GetSourceSSAVariable<MLIL_VAR_SSA>(), *this);
case MLIL_VAR_SSA_FIELD:
@@ -1392,6 +1421,9 @@ ExprId MediumLevelILInstruction::CopyTo(MediumLevelILFunction* dest,
return dest->VarAliasedField(size, GetSourceSSAVariable<MLIL_VAR_ALIASED_FIELD>().var,
GetSourceSSAVariable<MLIL_VAR_ALIASED_FIELD>().version,
GetOffset<MLIL_VAR_ALIASED_FIELD>(), *this);
+ case MLIL_VAR_SPLIT_SSA:
+ return dest->VarSplitSSA(size, GetHighSSAVariable<MLIL_VAR_SPLIT_SSA>(),
+ GetLowSSAVariable<MLIL_VAR_SPLIT_SSA>(), *this);
case MLIL_ADDRESS_OF:
return dest->AddressOf(GetSourceVariable<MLIL_ADDRESS_OF>(), *this);
case MLIL_ADDRESS_OF_FIELD:
@@ -1477,6 +1509,12 @@ ExprId MediumLevelILInstruction::CopyTo(MediumLevelILFunction* dest,
case MLIL_BOOL_TO_INT:
case MLIL_JUMP:
case MLIL_UNIMPL_MEM:
+ case MLIL_FSQRT:
+ case MLIL_FNEG:
+ case MLIL_FABS:
+ case MLIL_FLOAT_TO_INT:
+ case MLIL_INT_TO_FLOAT:
+ case MLIL_FLOAT_CONV:
return dest->AddExprWithLocation(operation, *this, size,
subExprHandler(AsOneOperand().GetSourceExpr()));
case MLIL_ADD:
@@ -1496,6 +1534,10 @@ ExprId MediumLevelILInstruction::CopyTo(MediumLevelILFunction* dest,
case MLIL_DIVS:
case MLIL_MODU:
case MLIL_MODS:
+ case MLIL_DIVU_DP:
+ case MLIL_DIVS_DP:
+ case MLIL_MODU_DP:
+ case MLIL_MODS_DP:
case MLIL_CMP_E:
case MLIL_CMP_NE:
case MLIL_CMP_SLT:
@@ -1508,6 +1550,17 @@ ExprId MediumLevelILInstruction::CopyTo(MediumLevelILFunction* dest,
case MLIL_CMP_UGT:
case MLIL_TEST_BIT:
case MLIL_ADD_OVERFLOW:
+ case MLIL_FADD:
+ case MLIL_FSUB:
+ case MLIL_FMUL:
+ case MLIL_FDIV:
+ case MLIL_FCMP_E:
+ case MLIL_FCMP_NE:
+ case MLIL_FCMP_LT:
+ case MLIL_FCMP_LE:
+ case MLIL_FCMP_GE:
+ case MLIL_FCMP_GT:
+ case MLIL_FCMP_UO:
return dest->AddExprWithLocation(operation, *this, size,
subExprHandler(AsTwoOperand().GetLeftExpr()), subExprHandler(AsTwoOperand().GetRightExpr()));
case MLIL_ADC:
@@ -1518,14 +1571,6 @@ ExprId MediumLevelILInstruction::CopyTo(MediumLevelILFunction* dest,
subExprHandler(AsTwoOperandWithCarry().GetLeftExpr()),
subExprHandler(AsTwoOperandWithCarry().GetRightExpr()),
subExprHandler(AsTwoOperandWithCarry().GetCarryExpr()));
- case MLIL_DIVU_DP:
- case MLIL_DIVS_DP:
- case MLIL_MODU_DP:
- case MLIL_MODS_DP:
- return dest->AddExprWithLocation(operation, *this, size,
- subExprHandler(AsDoublePrecision().GetHighExpr()),
- subExprHandler(AsDoublePrecision().GetLowExpr()),
- subExprHandler(AsDoublePrecision().GetRightExpr()));
case MLIL_JUMP_TO:
for (auto target : GetTargetList<MLIL_JUMP_TO>())
{
@@ -1665,24 +1710,6 @@ MediumLevelILInstruction MediumLevelILInstruction::GetCarryExpr() const
}
-MediumLevelILInstruction MediumLevelILInstruction::GetHighExpr() const
-{
- size_t operandIndex;
- if (GetOperandIndexForUsage(HighExprMediumLevelOperandUsage, operandIndex))
- return GetRawOperandAsExpr(operandIndex);
- throw MediumLevelILInstructionAccessException();
-}
-
-
-MediumLevelILInstruction MediumLevelILInstruction::GetLowExpr() const
-{
- size_t operandIndex;
- if (GetOperandIndexForUsage(LowExprMediumLevelOperandUsage, operandIndex))
- return GetRawOperandAsExpr(operandIndex);
- throw MediumLevelILInstructionAccessException();
-}
-
-
MediumLevelILInstruction MediumLevelILInstruction::GetStackExpr() const
{
size_t operandIndex;
@@ -2036,6 +2063,13 @@ ExprId MediumLevelILFunction::VarField(size_t size, const Variable& src, uint64_
}
+ExprId MediumLevelILFunction::VarSplit(size_t size, const Variable& high, const Variable& low,
+ const ILSourceLocation& loc)
+{
+ return AddExprWithLocation(MLIL_VAR_SPLIT, loc, size, high.ToIdentifier(), low.ToIdentifier());
+}
+
+
ExprId MediumLevelILFunction::VarSSA(size_t size, const SSAVariable& src,
const ILSourceLocation& loc)
{
@@ -2064,6 +2098,14 @@ ExprId MediumLevelILFunction::VarAliasedField(size_t size, const Variable& src,
}
+ExprId MediumLevelILFunction::VarSplitSSA(size_t size, const SSAVariable& high, const SSAVariable& low,
+ const ILSourceLocation& loc)
+{
+ return AddExprWithLocation(MLIL_VAR_SPLIT_SSA, loc, size, high.var.ToIdentifier(), high.version,
+ low.var.ToIdentifier(), low.version);
+}
+
+
ExprId MediumLevelILFunction::AddressOf(const Variable& var, const ILSourceLocation& loc)
{
return AddExprWithLocation(MLIL_ADDRESS_OF, loc, 0, var.ToIdentifier());
@@ -2223,17 +2265,17 @@ ExprId MediumLevelILFunction::DivUnsigned(size_t size, ExprId left, ExprId right
}
-ExprId MediumLevelILFunction::DivDoublePrecSigned(size_t size, ExprId high, ExprId low, ExprId right,
+ExprId MediumLevelILFunction::DivDoublePrecSigned(size_t size, ExprId left, ExprId right,
const ILSourceLocation& loc)
{
- return AddExprWithLocation(MLIL_DIVS_DP, loc, size, high, low, right);
+ return AddExprWithLocation(MLIL_DIVS_DP, loc, size, left, right);
}
-ExprId MediumLevelILFunction::DivDoublePrecUnsigned(size_t size, ExprId high, ExprId low, ExprId right,
+ExprId MediumLevelILFunction::DivDoublePrecUnsigned(size_t size, ExprId left, ExprId right,
const ILSourceLocation& loc)
{
- return AddExprWithLocation(MLIL_DIVU_DP, loc, size, high, low, right);
+ return AddExprWithLocation(MLIL_DIVU_DP, loc, size, left, right);
}
@@ -2251,17 +2293,17 @@ ExprId MediumLevelILFunction::ModUnsigned(size_t size, ExprId left, ExprId right
}
-ExprId MediumLevelILFunction::ModDoublePrecSigned(size_t size, ExprId high, ExprId low, ExprId right,
+ExprId MediumLevelILFunction::ModDoublePrecSigned(size_t size, ExprId left, ExprId right,
const ILSourceLocation& loc)
{
- return AddExprWithLocation(MLIL_MODS_DP, loc, size, high, low, right);
+ return AddExprWithLocation(MLIL_MODS_DP, loc, size, left, right);
}
-ExprId MediumLevelILFunction::ModDoublePrecUnsigned(size_t size, ExprId high, ExprId low, ExprId right,
+ExprId MediumLevelILFunction::ModDoublePrecUnsigned(size_t size, ExprId left, ExprId right,
const ILSourceLocation& loc)
{
- return AddExprWithLocation(MLIL_MODU_DP, loc, size, high, low, right);
+ return AddExprWithLocation(MLIL_MODU_DP, loc, size, left, right);
}
@@ -2533,3 +2575,105 @@ ExprId MediumLevelILFunction::MemoryPhi(size_t destMemVersion, const vector<size
return AddExprWithLocation(MLIL_MEM_PHI, loc, 0, destMemVersion,
sourceMemVersions.size(), AddIndexList(sourceMemVersions));
}
+
+
+ExprId MediumLevelILFunction::FloatAdd(size_t size, ExprId a, ExprId b, const ILSourceLocation& loc)
+{
+ return AddExprWithLocation(MLIL_FADD, loc, size, a, b);
+}
+
+
+ExprId MediumLevelILFunction::FloatSub(size_t size, ExprId a, ExprId b, const ILSourceLocation& loc)
+{
+ return AddExprWithLocation(MLIL_FSUB, loc, size, a, b);
+}
+
+
+ExprId MediumLevelILFunction::FloatMult(size_t size, ExprId a, ExprId b, const ILSourceLocation& loc)
+{
+ return AddExprWithLocation(MLIL_FMUL, loc, size, a, b);
+}
+
+
+ExprId MediumLevelILFunction::FloatDiv(size_t size, ExprId a, ExprId b, const ILSourceLocation& loc)
+{
+ return AddExprWithLocation(MLIL_FDIV, loc, size, a, b);
+}
+
+
+ExprId MediumLevelILFunction::FloatSqrt(size_t size, ExprId a, const ILSourceLocation& loc)
+{
+ return AddExprWithLocation(MLIL_FSQRT, loc, size, a);
+}
+
+
+ExprId MediumLevelILFunction::FloatNeg(size_t size, ExprId a, const ILSourceLocation& loc)
+{
+ return AddExprWithLocation(MLIL_FNEG, loc, size, a);
+}
+
+
+ExprId MediumLevelILFunction::FloatAbs(size_t size, ExprId a, const ILSourceLocation& loc)
+{
+ return AddExprWithLocation(MLIL_FABS, loc, size, a);
+}
+
+
+ExprId MediumLevelILFunction::FloatToInt(size_t size, ExprId a, const ILSourceLocation& loc)
+{
+ return AddExprWithLocation(MLIL_FLOAT_TO_INT, loc, size, a);
+}
+
+
+ExprId MediumLevelILFunction::IntToFloat(size_t size, ExprId a, const ILSourceLocation& loc)
+{
+ return AddExprWithLocation(MLIL_INT_TO_FLOAT, loc, size, a);
+}
+
+
+ExprId MediumLevelILFunction::FloatConvert(size_t size, ExprId a, const ILSourceLocation& loc)
+{
+ return AddExprWithLocation(MLIL_FLOAT_CONV, loc, size, a);
+}
+
+
+ExprId MediumLevelILFunction::FloatCompareEqual(size_t size, ExprId a, ExprId b, const ILSourceLocation& loc)
+{
+ return AddExprWithLocation(MLIL_FCMP_E, loc, size, a, b);
+}
+
+
+ExprId MediumLevelILFunction::FloatCompareNotEqual(size_t size, ExprId a, ExprId b, const ILSourceLocation& loc)
+{
+ return AddExprWithLocation(MLIL_FCMP_NE, loc, size, a, b);
+}
+
+
+ExprId MediumLevelILFunction::FloatCompareLessThan(size_t size, ExprId a, ExprId b, const ILSourceLocation& loc)
+{
+ return AddExprWithLocation(MLIL_FCMP_LT, loc, size, a, b);
+}
+
+
+ExprId MediumLevelILFunction::FloatCompareLessEqual(size_t size, ExprId a, ExprId b, const ILSourceLocation& loc)
+{
+ return AddExprWithLocation(MLIL_FCMP_LE, loc, size, a, b);
+}
+
+
+ExprId MediumLevelILFunction::FloatCompareGreaterEqual(size_t size, ExprId a, ExprId b, const ILSourceLocation& loc)
+{
+ return AddExprWithLocation(MLIL_FCMP_GE, loc, size, a, b);
+}
+
+
+ExprId MediumLevelILFunction::FloatCompareGreaterThan(size_t size, ExprId a, ExprId b, const ILSourceLocation& loc)
+{
+ return AddExprWithLocation(MLIL_FCMP_GT, loc, size, a, b);
+}
+
+
+ExprId MediumLevelILFunction::FloatCompareUnordered(size_t size, ExprId a, ExprId b, const ILSourceLocation& loc)
+{
+ return AddExprWithLocation(MLIL_FCMP_UO, loc, size, a, b);
+}
diff --git a/mediumlevelilinstruction.h b/mediumlevelilinstruction.h
index 9a76cb6c..aa4600df 100644
--- a/mediumlevelilinstruction.h
+++ b/mediumlevelilinstruction.h
@@ -91,8 +91,6 @@ namespace BinaryNinja
LeftExprMediumLevelOperandUsage,
RightExprMediumLevelOperandUsage,
CarryExprMediumLevelOperandUsage,
- HighExprMediumLevelOperandUsage,
- LowExprMediumLevelOperandUsage,
StackExprMediumLevelOperandUsage,
ConditionExprMediumLevelOperandUsage,
HighVariableMediumLevelOperandUsage,
@@ -428,10 +426,6 @@ namespace BinaryNinja
{
return *(MediumLevelILTwoOperandWithCarryInstruction*)this;
}
- MediumLevelILDoublePrecisionInstruction& AsDoublePrecision()
- {
- return *(MediumLevelILDoublePrecisionInstruction*)this;
- }
template <BNMediumLevelILOperation N>
const MediumLevelILInstructionAccessor<N>& As() const
@@ -456,10 +450,6 @@ namespace BinaryNinja
{
return *(const MediumLevelILTwoOperandWithCarryInstruction*)this;
}
- const MediumLevelILDoublePrecisionInstruction& AsDoublePrecision() const
- {
- return *(const MediumLevelILDoublePrecisionInstruction*)this;
- }
};
struct MediumLevelILInstruction: public MediumLevelILInstructionBase
@@ -485,8 +475,6 @@ namespace BinaryNinja
template <BNMediumLevelILOperation N> MediumLevelILInstruction GetLeftExpr() const { return As<N>().GetLeftExpr(); }
template <BNMediumLevelILOperation N> MediumLevelILInstruction GetRightExpr() const { return As<N>().GetRightExpr(); }
template <BNMediumLevelILOperation N> MediumLevelILInstruction GetCarryExpr() const { return As<N>().GetCarryExpr(); }
- template <BNMediumLevelILOperation N> MediumLevelILInstruction GetHighExpr() const { return As<N>().GetHighExpr(); }
- template <BNMediumLevelILOperation N> MediumLevelILInstruction GetLowExpr() const { return As<N>().GetLowExpr(); }
template <BNMediumLevelILOperation N> MediumLevelILInstruction GetStackExpr() const { return As<N>().GetStackExpr(); }
template <BNMediumLevelILOperation N> MediumLevelILInstruction GetConditionExpr() const { return As<N>().GetConditionExpr(); }
template <BNMediumLevelILOperation N> Variable GetHighVariable() const { return As<N>().GetHighVariable(); }
@@ -537,8 +525,6 @@ namespace BinaryNinja
MediumLevelILInstruction GetLeftExpr() const;
MediumLevelILInstruction GetRightExpr() const;
MediumLevelILInstruction GetCarryExpr() const;
- MediumLevelILInstruction GetHighExpr() const;
- MediumLevelILInstruction GetLowExpr() const;
MediumLevelILInstruction GetStackExpr() const;
MediumLevelILInstruction GetConditionExpr() const;
Variable GetHighVariable() const;
@@ -644,13 +630,6 @@ namespace BinaryNinja
MediumLevelILInstruction GetCarryExpr() const { return GetRawOperandAsExpr(2); }
};
- struct MediumLevelILDoublePrecisionInstruction: public MediumLevelILInstructionBase
- {
- MediumLevelILInstruction GetHighExpr() const { return GetRawOperandAsExpr(0); }
- MediumLevelILInstruction GetLowExpr() const { return GetRawOperandAsExpr(1); }
- MediumLevelILInstruction GetRightExpr() const { return GetRawOperandAsExpr(2); }
- };
-
// Implementations of each instruction to fetch the correct operand value for the valid operands, these
// are derived from MediumLevelILInstructionBase so that invalid operand accessor functions will generate
// a compiler error.
@@ -773,6 +752,11 @@ namespace BinaryNinja
Variable GetSourceVariable() const { return GetRawOperandAsVariable(0); }
uint64_t GetOffset() const { return GetRawOperandAsInteger(1); }
};
+ template <> struct MediumLevelILInstructionAccessor<MLIL_VAR_SPLIT>: public MediumLevelILInstructionBase
+ {
+ Variable GetHighVariable() const { return GetRawOperandAsVariable(0); }
+ Variable GetLowVariable() const { return GetRawOperandAsVariable(1); }
+ };
template <> struct MediumLevelILInstructionAccessor<MLIL_VAR_SSA>: public MediumLevelILInstructionBase
{
@@ -796,6 +780,13 @@ namespace BinaryNinja
uint64_t GetOffset() const { return GetRawOperandAsInteger(2); }
void SetSourceMemoryVersion(size_t version) { UpdateRawOperand(1, version); }
};
+ template <> struct MediumLevelILInstructionAccessor<MLIL_VAR_SPLIT_SSA>: public MediumLevelILInstructionBase
+ {
+ SSAVariable GetHighSSAVariable() const { return GetRawOperandAsSSAVariable(0); }
+ SSAVariable GetLowSSAVariable() const { return GetRawOperandAsSSAVariable(2); }
+ void SetHighSSAVersion(size_t version) { UpdateRawOperand(1, version); }
+ void SetLowSSAVersion(size_t version) { UpdateRawOperand(3, version); }
+ };
template <> struct MediumLevelILInstructionAccessor<MLIL_ADDRESS_OF>: public MediumLevelILInstructionBase
{
@@ -953,6 +944,10 @@ namespace BinaryNinja
template <> struct MediumLevelILInstructionAccessor<MLIL_DIVS>: public MediumLevelILTwoOperandInstruction {};
template <> struct MediumLevelILInstructionAccessor<MLIL_MODU>: public MediumLevelILTwoOperandInstruction {};
template <> struct MediumLevelILInstructionAccessor<MLIL_MODS>: public MediumLevelILTwoOperandInstruction {};
+ template <> struct MediumLevelILInstructionAccessor<MLIL_DIVU_DP>: public MediumLevelILTwoOperandInstruction {};
+ template <> struct MediumLevelILInstructionAccessor<MLIL_DIVS_DP>: public MediumLevelILTwoOperandInstruction {};
+ template <> struct MediumLevelILInstructionAccessor<MLIL_MODU_DP>: public MediumLevelILTwoOperandInstruction {};
+ template <> struct MediumLevelILInstructionAccessor<MLIL_MODS_DP>: public MediumLevelILTwoOperandInstruction {};
template <> struct MediumLevelILInstructionAccessor<MLIL_CMP_E>: public MediumLevelILTwoOperandInstruction {};
template <> struct MediumLevelILInstructionAccessor<MLIL_CMP_NE>: public MediumLevelILTwoOperandInstruction {};
template <> struct MediumLevelILInstructionAccessor<MLIL_CMP_SLT>: public MediumLevelILTwoOperandInstruction {};
@@ -965,17 +960,23 @@ namespace BinaryNinja
template <> struct MediumLevelILInstructionAccessor<MLIL_CMP_UGT>: public MediumLevelILTwoOperandInstruction {};
template <> struct MediumLevelILInstructionAccessor<MLIL_TEST_BIT>: public MediumLevelILTwoOperandInstruction {};
template <> struct MediumLevelILInstructionAccessor<MLIL_ADD_OVERFLOW>: public MediumLevelILTwoOperandInstruction {};
+ template <> struct MediumLevelILInstructionAccessor<MLIL_FADD>: public MediumLevelILTwoOperandInstruction {};
+ template <> struct MediumLevelILInstructionAccessor<MLIL_FSUB>: public MediumLevelILTwoOperandInstruction {};
+ template <> struct MediumLevelILInstructionAccessor<MLIL_FMUL>: public MediumLevelILTwoOperandInstruction {};
+ template <> struct MediumLevelILInstructionAccessor<MLIL_FDIV>: public MediumLevelILTwoOperandInstruction {};
+ template <> struct MediumLevelILInstructionAccessor<MLIL_FCMP_E>: public MediumLevelILTwoOperandInstruction {};
+ template <> struct MediumLevelILInstructionAccessor<MLIL_FCMP_NE>: public MediumLevelILTwoOperandInstruction {};
+ template <> struct MediumLevelILInstructionAccessor<MLIL_FCMP_LT>: public MediumLevelILTwoOperandInstruction {};
+ template <> struct MediumLevelILInstructionAccessor<MLIL_FCMP_LE>: public MediumLevelILTwoOperandInstruction {};
+ template <> struct MediumLevelILInstructionAccessor<MLIL_FCMP_GE>: public MediumLevelILTwoOperandInstruction {};
+ template <> struct MediumLevelILInstructionAccessor<MLIL_FCMP_GT>: public MediumLevelILTwoOperandInstruction {};
+ template <> struct MediumLevelILInstructionAccessor<MLIL_FCMP_UO>: public MediumLevelILTwoOperandInstruction {};
template <> struct MediumLevelILInstructionAccessor<MLIL_ADC>: public MediumLevelILTwoOperandWithCarryInstruction {};
template <> struct MediumLevelILInstructionAccessor<MLIL_SBB>: public MediumLevelILTwoOperandWithCarryInstruction {};
template <> struct MediumLevelILInstructionAccessor<MLIL_RLC>: public MediumLevelILTwoOperandWithCarryInstruction {};
template <> struct MediumLevelILInstructionAccessor<MLIL_RRC>: public MediumLevelILTwoOperandWithCarryInstruction {};
- template <> struct MediumLevelILInstructionAccessor<MLIL_DIVU_DP>: public MediumLevelILDoublePrecisionInstruction {};
- template <> struct MediumLevelILInstructionAccessor<MLIL_DIVS_DP>: public MediumLevelILDoublePrecisionInstruction {};
- template <> struct MediumLevelILInstructionAccessor<MLIL_MODU_DP>: public MediumLevelILDoublePrecisionInstruction {};
- template <> struct MediumLevelILInstructionAccessor<MLIL_MODS_DP>: public MediumLevelILDoublePrecisionInstruction {};
-
template <> struct MediumLevelILInstructionAccessor<MLIL_NEG>: public MediumLevelILOneOperandInstruction {};
template <> struct MediumLevelILInstructionAccessor<MLIL_NOT>: public MediumLevelILOneOperandInstruction {};
template <> struct MediumLevelILInstructionAccessor<MLIL_SX>: public MediumLevelILOneOperandInstruction {};
@@ -983,4 +984,10 @@ namespace BinaryNinja
template <> struct MediumLevelILInstructionAccessor<MLIL_LOW_PART>: public MediumLevelILOneOperandInstruction {};
template <> struct MediumLevelILInstructionAccessor<MLIL_BOOL_TO_INT>: public MediumLevelILOneOperandInstruction {};
template <> struct MediumLevelILInstructionAccessor<MLIL_UNIMPL_MEM>: public MediumLevelILOneOperandInstruction {};
+ template <> struct MediumLevelILInstructionAccessor<MLIL_FSQRT>: public MediumLevelILOneOperandInstruction {};
+ template <> struct MediumLevelILInstructionAccessor<MLIL_FNEG>: public MediumLevelILOneOperandInstruction {};
+ template <> struct MediumLevelILInstructionAccessor<MLIL_FABS>: public MediumLevelILOneOperandInstruction {};
+ template <> struct MediumLevelILInstructionAccessor<MLIL_FLOAT_TO_INT>: public MediumLevelILOneOperandInstruction {};
+ template <> struct MediumLevelILInstructionAccessor<MLIL_INT_TO_FLOAT>: public MediumLevelILOneOperandInstruction {};
+ template <> struct MediumLevelILInstructionAccessor<MLIL_FLOAT_CONV>: public MediumLevelILOneOperandInstruction {};
}
diff --git a/python/lowlevelil.py b/python/lowlevelil.py
index 75a3f1ad..a3b1fcb6 100644
--- a/python/lowlevelil.py
+++ b/python/lowlevelil.py
@@ -124,6 +124,7 @@ class LowLevelILInstruction(object):
LowLevelILOperation.LLIL_PUSH: [("src", "expr")],
LowLevelILOperation.LLIL_POP: [],
LowLevelILOperation.LLIL_REG: [("src", "reg")],
+ LowLevelILOperation.LLIL_REG_SPLIT: [("hi", "reg", "lo", "reg")],
LowLevelILOperation.LLIL_CONST: [("constant", "int")],
LowLevelILOperation.LLIL_CONST_PTR: [("constant", "int")],
LowLevelILOperation.LLIL_FLAG: [("src", "flag")],
@@ -146,13 +147,13 @@ class LowLevelILInstruction(object):
LowLevelILOperation.LLIL_MULU_DP: [("left", "expr"), ("right", "expr")],
LowLevelILOperation.LLIL_MULS_DP: [("left", "expr"), ("right", "expr")],
LowLevelILOperation.LLIL_DIVU: [("left", "expr"), ("right", "expr")],
- LowLevelILOperation.LLIL_DIVU_DP: [("hi", "expr"), ("lo", "expr"), ("right", "expr")],
+ LowLevelILOperation.LLIL_DIVU_DP: [("left", "expr"), ("right", "expr")],
LowLevelILOperation.LLIL_DIVS: [("left", "expr"), ("right", "expr")],
- LowLevelILOperation.LLIL_DIVS_DP: [("hi", "expr"), ("lo", "expr"), ("right", "expr")],
+ LowLevelILOperation.LLIL_DIVS_DP: [("left", "expr"), ("right", "expr")],
LowLevelILOperation.LLIL_MODU: [("left", "expr"), ("right", "expr")],
- LowLevelILOperation.LLIL_MODU_DP: [("hi", "expr"), ("lo", "expr"), ("right", "expr")],
+ LowLevelILOperation.LLIL_MODU_DP: [("left", "expr"), ("right", "expr")],
LowLevelILOperation.LLIL_MODS: [("left", "expr"), ("right", "expr")],
- LowLevelILOperation.LLIL_MODS_DP: [("hi", "expr"), ("lo", "expr"), ("right", "expr")],
+ LowLevelILOperation.LLIL_MODS_DP: [("left", "expr"), ("right", "expr")],
LowLevelILOperation.LLIL_NEG: [("src", "expr")],
LowLevelILOperation.LLIL_NOT: [("src", "expr")],
LowLevelILOperation.LLIL_SX: [("src", "expr")],
@@ -186,12 +187,30 @@ class LowLevelILInstruction(object):
LowLevelILOperation.LLIL_UNDEF: [],
LowLevelILOperation.LLIL_UNIMPL: [],
LowLevelILOperation.LLIL_UNIMPL_MEM: [("src", "expr")],
+ LowLevelILOperation.LLIL_FADD: [("left", "expr"), ("right", "expr")],
+ LowLevelILOperation.LLIL_FSUB: [("left", "expr"), ("right", "expr")],
+ LowLevelILOperation.LLIL_FMUL: [("left", "expr"), ("right", "expr")],
+ LowLevelILOperation.LLIL_FDIV: [("left", "expr"), ("right", "expr")],
+ LowLevelILOperation.LLIL_FSQRT: [("src", "expr")],
+ LowLevelILOperation.LLIL_FNEG: [("src", "expr")],
+ LowLevelILOperation.LLIL_FABS: [("src", "expr")],
+ LowLevelILOperation.LLIL_FLOAT_TO_INT: [("src", "expr")],
+ LowLevelILOperation.LLIL_INT_TO_FLOAT: [("src", "expr")],
+ LowLevelILOperation.LLIL_FLOAT_CONV: [("src", "expr")],
+ LowLevelILOperation.LLIL_FCMP_E: [("left", "expr"), ("right", "expr")],
+ LowLevelILOperation.LLIL_FCMP_NE: [("left", "expr"), ("right", "expr")],
+ LowLevelILOperation.LLIL_FCMP_LT: [("left", "expr"), ("right", "expr")],
+ LowLevelILOperation.LLIL_FCMP_LE: [("left", "expr"), ("right", "expr")],
+ LowLevelILOperation.LLIL_FCMP_GE: [("left", "expr"), ("right", "expr")],
+ LowLevelILOperation.LLIL_FCMP_GT: [("left", "expr"), ("right", "expr")],
+ LowLevelILOperation.LLIL_FCMP_UO: [("left", "expr"), ("right", "expr")],
LowLevelILOperation.LLIL_SET_REG_SSA: [("dest", "reg_ssa"), ("src", "expr")],
LowLevelILOperation.LLIL_SET_REG_SSA_PARTIAL: [("full_reg", "reg_ssa"), ("dest", "reg"), ("src", "expr")],
LowLevelILOperation.LLIL_SET_REG_SPLIT_SSA: [("hi", "expr"), ("lo", "expr"), ("src", "expr")],
LowLevelILOperation.LLIL_REG_SPLIT_DEST_SSA: [("dest", "reg_ssa")],
LowLevelILOperation.LLIL_REG_SSA: [("src", "reg_ssa")],
LowLevelILOperation.LLIL_REG_SSA_PARTIAL: [("full_reg", "reg_ssa"), ("src", "reg")],
+ LowLevelILOperation.LLIL_REG_SPLIT_SSA: [("hi", "reg_ssa"), ("lo", "reg_ssa")],
LowLevelILOperation.LLIL_SET_FLAG_SSA: [("dest", "flag_ssa"), ("src", "expr")],
LowLevelILOperation.LLIL_FLAG_SSA: [("src", "flag_ssa")],
LowLevelILOperation.LLIL_FLAG_BIT_SSA: [("src", "flag_ssa"), ("bit", "int")],
@@ -768,7 +787,7 @@ class LowLevelILFunction(object):
def reg(self, size, reg):
"""
- ``reg`` returns a register of size ``size`` with name ``name``
+ ``reg`` returns a register of size ``size`` with name ``reg``
:param int size: the size of the register in bytes
:param str reg: the name of the register
@@ -778,6 +797,20 @@ class LowLevelILFunction(object):
reg = self.arch.get_reg_index(reg)
return self.expr(LowLevelILOperation.LLIL_REG, reg, size=size)
+ def reg_split(self, size, hi, lo):
+ """
+ ``reg_split`` combines registers of size ``size`` with names ``hi`` and ``lo``
+
+ :param int size: the size of the register in bytes
+ :param str hi: register holding high part of value
+ :param str lo: register holding low part of value
+ :return: The expression ``hi:lo``
+ :rtype: LowLevelILExpr
+ """
+ hi = self.arch.get_reg_index(hi)
+ lo = self.arch.get_reg_index(lo)
+ return self.expr(LowLevelILOperation.LLIL_REG_SPLIT, hi, lo, size=size)
+
def const(self, size, value):
"""
``const`` returns an expression for the constant integer ``value`` with size ``size``
@@ -1078,21 +1111,20 @@ class LowLevelILFunction(object):
"""
return self.expr(LowLevelILOperation.LLIL_DIVS, a.index, b.index, size=size, flags=flags)
- def div_double_prec_signed(self, size, hi, lo, b, flags=None):
+ def div_double_prec_signed(self, size, a, b, flags=None):
"""
- ``div_double_prec_signed`` signed double precision divide using expression ``hi`` and expression ``lo`` as a
+ ``div_double_prec_signed`` signed double precision divide using expression ``a`` as a
single double precision register by expression ``b`` potentially setting flags ``flags`` and returning an
expression of ``size`` bytes.
:param int size: the size of the result in bytes
- :param LowLevelILExpr hi: high LHS expression
- :param LowLevelILExpr lo: low LHS expression
+ :param LowLevelILExpr a: LHS expression
:param LowLevelILExpr b: RHS expression
:param str flags: optional, flags to set
- :return: The expression ``divs.dp.<size>{<flags>}(hi:lo, b)``
+ :return: The expression ``divs.dp.<size>{<flags>}(a, b)``
:rtype: LowLevelILExpr
"""
- return self.expr(LowLevelILOperation.LLIL_DIVS_DP, hi.index, lo.index, b.index, size=size, flags=flags)
+ return self.expr(LowLevelILOperation.LLIL_DIVS_DP, a.index, b.index, size=size, flags=flags)
def div_unsigned(self, size, a, b, flags=None):
"""
@@ -1108,21 +1140,20 @@ class LowLevelILFunction(object):
"""
return self.expr(LowLevelILOperation.LLIL_DIVS, a.index, b.index, size=size, flags=flags)
- def div_double_prec_unsigned(self, size, hi, lo, b, flags=None):
+ def div_double_prec_unsigned(self, size, a, b, flags=None):
"""
- ``div_double_prec_unsigned`` unsigned double precision divide using expression ``hi`` and expression ``lo`` as
+ ``div_double_prec_unsigned`` unsigned double precision divide using expression ``a`` as
a single double precision register by expression ``b`` potentially setting flags ``flags`` and returning an
expression of ``size`` bytes.
:param int size: the size of the result in bytes
- :param LowLevelILExpr hi: high LHS expression
- :param LowLevelILExpr lo: low LHS expression
+ :param LowLevelILExpr a: LHS expression
:param LowLevelILExpr b: RHS expression
:param str flags: optional, flags to set
- :return: The expression ``divs.dp.<size>{<flags>}(hi:lo, b)``
+ :return: The expression ``divs.dp.<size>{<flags>}(a, b)``
:rtype: LowLevelILExpr
"""
- return self.expr(LowLevelILOperation.LLIL_DIVS_DP, hi.index, lo.index, b.index, size=size, flags=flags)
+ return self.expr(LowLevelILOperation.LLIL_DIVS_DP, a.index, b.index, size=size, flags=flags)
def mod_signed(self, size, a, b, flags=None):
"""
@@ -1138,21 +1169,20 @@ class LowLevelILFunction(object):
"""
return self.expr(LowLevelILOperation.LLIL_MODS, a.index, b.index, size=size, flags=flags)
- def mod_double_prec_signed(self, size, hi, lo, b, flags=None):
+ def mod_double_prec_signed(self, size, a, b, flags=None):
"""
- ``mod_double_prec_signed`` signed double precision modulus using expression ``hi`` and expression ``lo`` as a single
+ ``mod_double_prec_signed`` signed double precision modulus using expression ``a`` as a single
double precision register by expression ``b`` potentially setting flags ``flags`` and returning an expression
of ``size`` bytes.
:param int size: the size of the result in bytes
- :param LowLevelILExpr hi: high LHS expression
- :param LowLevelILExpr lo: low LHS expression
+ :param LowLevelILExpr a: LHS expression
:param LowLevelILExpr b: RHS expression
:param str flags: optional, flags to set
- :return: The expression ``mods.dp.<size>{<flags>}(hi:lo, b)``
+ :return: The expression ``mods.dp.<size>{<flags>}(a, b)``
:rtype: LowLevelILExpr
"""
- return self.expr(LowLevelILOperation.LLIL_MODS_DP, hi.index, lo.index, b.index, size=size, flags=flags)
+ return self.expr(LowLevelILOperation.LLIL_MODS_DP, a.index, b.index, size=size, flags=flags)
def mod_unsigned(self, size, a, b, flags=None):
"""
@@ -1168,21 +1198,20 @@ class LowLevelILFunction(object):
"""
return self.expr(LowLevelILOperation.LLIL_MODS, a.index, b.index, size=size, flags=flags)
- def mod_double_prec_unsigned(self, size, hi, lo, b, flags=None):
+ def mod_double_prec_unsigned(self, size, a, b, flags=None):
"""
- ``mod_double_prec_unsigned`` unsigned double precision modulus using expression ``hi`` and expression ``lo`` as
+ ``mod_double_prec_unsigned`` unsigned double precision modulus using expression ``a`` as
a single double precision register by expression ``b`` potentially setting flags ``flags`` and returning an
expression of ``size`` bytes.
:param int size: the size of the result in bytes
- :param LowLevelILExpr hi: high LHS expression
- :param LowLevelILExpr lo: low LHS expression
+ :param LowLevelILExpr a: LHS expression
:param LowLevelILExpr b: RHS expression
:param str flags: optional, flags to set
- :return: The expression ``modu.dp.<size>{<flags>}(hi:lo, b)``
+ :return: The expression ``modu.dp.<size>{<flags>}(a, b)``
:rtype: LowLevelILExpr
"""
- return self.expr(LowLevelILOperation.LLIL_MODS_DP, hi.index, lo.index, b.index, size=size, flags=flags)
+ return self.expr(LowLevelILOperation.LLIL_MODS_DP, a.index, b.index, size=size, flags=flags)
def neg_expr(self, size, value, flags=None):
"""
@@ -1501,6 +1530,232 @@ class LowLevelILFunction(object):
"""
return self.expr(LowLevelILOperation.LLIL_UNIMPL_MEM, addr.index, size = size)
+ def float_add(self, size, a, b, flags=None):
+ """
+ ``float_add`` adds floating point expression ``a`` to expression ``b`` potentially setting flags ``flags``
+ and returning an expression of ``size`` bytes.
+
+ :param int size: the size of the result in bytes
+ :param LowLevelILExpr a: LHS expression
+ :param LowLevelILExpr b: RHS expression
+ :param str flags: flags to set
+ :return: The expression ``fadd.<size>{<flags>}(a, b)``
+ :rtype: LowLevelILExpr
+ """
+ return self.expr(LowLevelILOperation.LLIL_FADD, a.index, b.index, size=size, flags=flags)
+
+ def float_sub(self, size, a, b, flags=None):
+ """
+ ``float_sub`` subtracts floating point expression ``b`` from expression ``a`` potentially setting flags ``flags``
+ and returning an expression of ``size`` bytes.
+
+ :param int size: the size of the result in bytes
+ :param LowLevelILExpr a: LHS expression
+ :param LowLevelILExpr b: RHS expression
+ :param str flags: flags to set
+ :return: The expression ``fsub.<size>{<flags>}(a, b)``
+ :rtype: LowLevelILExpr
+ """
+ return self.expr(LowLevelILOperation.LLIL_FSUB, a.index, b.index, size=size, flags=flags)
+
+ def float_mult(self, size, a, b, flags=None):
+ """
+ ``float_mult`` multiplies floating point expression ``a`` by expression ``b`` potentially setting flags ``flags``
+ and returning an expression of ``size`` bytes.
+
+ :param int size: the size of the result in bytes
+ :param LowLevelILExpr a: LHS expression
+ :param LowLevelILExpr b: RHS expression
+ :param str flags: flags to set
+ :return: The expression ``fmul.<size>{<flags>}(a, b)``
+ :rtype: LowLevelILExpr
+ """
+ return self.expr(LowLevelILOperation.LLIL_FMUL, a.index, b.index, size=size, flags=flags)
+
+ def float_div(self, size, a, b, flags=None):
+ """
+ ``float_div`` divides floating point expression ``a`` by expression ``b`` potentially setting flags ``flags``
+ and returning an expression of ``size`` bytes.
+
+ :param int size: the size of the result in bytes
+ :param LowLevelILExpr a: LHS expression
+ :param LowLevelILExpr b: RHS expression
+ :param str flags: flags to set
+ :return: The expression ``fdiv.<size>{<flags>}(a, b)``
+ :rtype: LowLevelILExpr
+ """
+ return self.expr(LowLevelILOperation.LLIL_FDIV, a.index, b.index, size=size, flags=flags)
+
+ def float_sqrt(self, size, value, flags=None):
+ """
+ ``float_sqrt`` returns square root of floating point expression ``value`` of size ``size`` potentially setting flags
+
+ :param int size: the size of the result in bytes
+ :param LowLevelILExpr value: the expression to negate
+ :param str flags: optional, flags to set
+ :return: The expression ``sqrt.<size>{<flags>}(value)``
+ :rtype: LowLevelILExpr
+ """
+ return self.expr(LowLevelILOperation.LLIL_FSQRT, value.index, size=size, flags=flags)
+
+ def float_neg(self, size, value, flags=None):
+ """
+ ``float_neg`` returns sign negation of floating point expression ``value`` of size ``size`` potentially setting flags
+
+ :param int size: the size of the result in bytes
+ :param LowLevelILExpr value: the expression to negate
+ :param str flags: optional, flags to set
+ :return: The expression ``fneg.<size>{<flags>}(value)``
+ :rtype: LowLevelILExpr
+ """
+ return self.expr(LowLevelILOperation.LLIL_FNEG, value.index, size=size, flags=flags)
+
+ def float_abs(self, size, value, flags=None):
+ """
+ ``float_abs`` returns absolute value of floating point expression ``value`` of size ``size`` potentially setting flags
+
+ :param int size: the size of the result in bytes
+ :param LowLevelILExpr value: the expression to negate
+ :param str flags: optional, flags to set
+ :return: The expression ``fabs.<size>{<flags>}(value)``
+ :rtype: LowLevelILExpr
+ """
+ return self.expr(LowLevelILOperation.LLIL_FABS, value.index, size=size, flags=flags)
+
+ def float_to_int(self, size, value, flags=None):
+ """
+ ``float_to_int`` returns integer value of floating point expression ``value`` of size ``size`` potentially setting flags
+
+ :param int size: the size of the result in bytes
+ :param LowLevelILExpr value: the expression to negate
+ :param str flags: optional, flags to set
+ :return: The expression ``int.<size>{<flags>}(value)``
+ :rtype: LowLevelILExpr
+ """
+ return self.expr(LowLevelILOperation.LLIL_FLOAT_TO_INT, value.index, size=size, flags=flags)
+
+ def int_to_float(self, size, value, flags=None):
+ """
+ ``int_to_float`` returns floating point value of integer expression ``value`` of size ``size`` potentially setting flags
+
+ :param int size: the size of the result in bytes
+ :param LowLevelILExpr value: the expression to negate
+ :param str flags: optional, flags to set
+ :return: The expression ``float.<size>{<flags>}(value)``
+ :rtype: LowLevelILExpr
+ """
+ return self.expr(LowLevelILOperation.LLIL_INT_TO_FLOAT, value.index, size=size, flags=flags)
+
+ def float_convert(self, size, value, flags=None):
+ """
+ ``int_to_float`` converts floating point value of expression ``value`` to size ``size`` potentially setting flags
+
+ :param int size: the size of the result in bytes
+ :param LowLevelILExpr value: the expression to negate
+ :param str flags: optional, flags to set
+ :return: The expression ``fconvert.<size>{<flags>}(value)``
+ :rtype: LowLevelILExpr
+ """
+ return self.expr(LowLevelILOperation.LLIL_FLOAT_CONV, value.index, size=size, flags=flags)
+
+ def float_compare_equal(self, size, a, b):
+ """
+ ``float_compare_equal`` returns floating point comparison expression of size ``size`` checking if
+ expression ``a`` is equal to expression ``b``
+
+ :param int size: the size of the operands in bytes
+ :param LowLevelILExpr a: LHS expression
+ :param LowLevelILExpr b: RHS expression
+ :param str flags: flags to set
+ :return: The expression ``a f== b``
+ :rtype: LowLevelILExpr
+ """
+ return self.expr(LowLevelILOperation.LLIL_FCMP_E, a.index, b.index)
+
+ def float_compare_not_equal(self, size, a, b):
+ """
+ ``float_compare_not_equal`` returns floating point comparison expression of size ``size`` checking if
+ expression ``a`` is not equal to expression ``b``
+
+ :param int size: the size of the operands in bytes
+ :param LowLevelILExpr a: LHS expression
+ :param LowLevelILExpr b: RHS expression
+ :param str flags: flags to set
+ :return: The expression ``a f!= b``
+ :rtype: LowLevelILExpr
+ """
+ return self.expr(LowLevelILOperation.LLIL_FCMP_NE, a.index, b.index)
+
+ def float_compare_less_than(self, size, a, b):
+ """
+ ``float_compare_less_than`` returns floating point comparison expression of size ``size`` checking if
+ expression ``a`` is less than to expression ``b``
+
+ :param int size: the size of the operands in bytes
+ :param LowLevelILExpr a: LHS expression
+ :param LowLevelILExpr b: RHS expression
+ :param str flags: flags to set
+ :return: The expression ``a f< b``
+ :rtype: LowLevelILExpr
+ """
+ return self.expr(LowLevelILOperation.LLIL_FCMP_LT, a.index, b.index)
+
+ def float_compare_less_equal(self, size, a, b):
+ """
+ ``float_compare_less_equal`` returns floating point comparison expression of size ``size`` checking if
+ expression ``a`` is less than or equal to expression ``b``
+
+ :param int size: the size of the operands in bytes
+ :param LowLevelILExpr a: LHS expression
+ :param LowLevelILExpr b: RHS expression
+ :param str flags: flags to set
+ :return: The expression ``a f<= b``
+ :rtype: LowLevelILExpr
+ """
+ return self.expr(LowLevelILOperation.LLIL_FCMP_LE, a.index, b.index)
+
+ def float_compare_greater_equal(self, size, a, b):
+ """
+ ``float_compare_greater_equal`` returns floating point comparison expression of size ``size`` checking if
+ expression ``a`` is greater than or equal to expression ``b``
+
+ :param int size: the size of the operands in bytes
+ :param LowLevelILExpr a: LHS expression
+ :param LowLevelILExpr b: RHS expression
+ :param str flags: flags to set
+ :return: The expression ``a f>= b``
+ :rtype: LowLevelILExpr
+ """
+ return self.expr(LowLevelILOperation.LLIL_FCMP_GE, a.index, b.index)
+
+ def float_compare_greater_than(self, size, a, b):
+ """
+ ``float_compare_greater_than`` returns floating point comparison expression of size ``size`` checking if
+ expression ``a`` is greater than or equal to expression ``b``
+
+ :param int size: the size of the operands in bytes
+ :param LowLevelILExpr a: LHS expression
+ :param LowLevelILExpr b: RHS expression
+ :param str flags: flags to set
+ :return: The expression ``a f> b``
+ :rtype: LowLevelILExpr
+ """
+ return self.expr(LowLevelILOperation.LLIL_FCMP_GT, a.index, b.index)
+
+ def float_compare_unordered(self, size, a, b):
+ """
+ ``float_compare_unordered`` returns floating point comparison expression of size ``size`` checking if
+ expression ``a`` is unordered relative to expression ``b``
+
+ :param int size: the size of the operands in bytes
+ :param LowLevelILExpr a: LHS expression
+ :param LowLevelILExpr b: RHS expression
+ :param str flags: flags to set
+ :return: The expression ``is_unordered(a, b)``
+ :rtype: LowLevelILExpr
+ """
+ return self.expr(LowLevelILOperation.LLIL_FCMP_UO, a.index, b.index)
+
def goto(self, label):
"""
``goto`` returns a goto expression which jumps to the provided LowLevelILLabel.
diff --git a/python/mediumlevelil.py b/python/mediumlevelil.py
index 07759a47..05b558d2 100644
--- a/python/mediumlevelil.py
+++ b/python/mediumlevelil.py
@@ -85,6 +85,7 @@ class MediumLevelILInstruction(object):
MediumLevelILOperation.MLIL_STORE_STRUCT: [("dest", "expr"), ("offset", "int"), ("src", "expr")],
MediumLevelILOperation.MLIL_VAR: [("src", "var")],
MediumLevelILOperation.MLIL_VAR_FIELD: [("src", "var"), ("offset", "int")],
+ MediumLevelILOperation.MLIL_VAR_SPLIT: [("high", "var"), ("low", "var")],
MediumLevelILOperation.MLIL_ADDRESS_OF: [("src", "var")],
MediumLevelILOperation.MLIL_ADDRESS_OF_FIELD: [("src", "var"), ("offset", "int")],
MediumLevelILOperation.MLIL_CONST: [("constant", "int")],
@@ -108,13 +109,13 @@ class MediumLevelILInstruction(object):
MediumLevelILOperation.MLIL_MULU_DP: [("left", "expr"), ("right", "expr")],
MediumLevelILOperation.MLIL_MULS_DP: [("left", "expr"), ("right", "expr")],
MediumLevelILOperation.MLIL_DIVU: [("left", "expr"), ("right", "expr")],
- MediumLevelILOperation.MLIL_DIVU_DP: [("hi", "expr"), ("lo", "expr"), ("right", "expr")],
+ MediumLevelILOperation.MLIL_DIVU_DP: [("left", "expr"), ("right", "expr")],
MediumLevelILOperation.MLIL_DIVS: [("left", "expr"), ("right", "expr")],
- MediumLevelILOperation.MLIL_DIVS_DP: [("hi", "expr"), ("lo", "expr"), ("right", "expr")],
+ MediumLevelILOperation.MLIL_DIVS_DP: [("left", "expr"), ("right", "expr")],
MediumLevelILOperation.MLIL_MODU: [("left", "expr"), ("right", "expr")],
- MediumLevelILOperation.MLIL_MODU_DP: [("hi", "expr"), ("lo", "expr"), ("right", "expr")],
+ MediumLevelILOperation.MLIL_MODU_DP: [("left", "expr"), ("right", "expr")],
MediumLevelILOperation.MLIL_MODS: [("left", "expr"), ("right", "expr")],
- MediumLevelILOperation.MLIL_MODS_DP: [("hi", "expr"), ("lo", "expr"), ("right", "expr")],
+ MediumLevelILOperation.MLIL_MODS_DP: [("left", "expr"), ("right", "expr")],
MediumLevelILOperation.MLIL_NEG: [("src", "expr")],
MediumLevelILOperation.MLIL_NOT: [("src", "expr")],
MediumLevelILOperation.MLIL_SX: [("src", "expr")],
@@ -150,6 +151,23 @@ class MediumLevelILInstruction(object):
MediumLevelILOperation.MLIL_UNDEF: [],
MediumLevelILOperation.MLIL_UNIMPL: [],
MediumLevelILOperation.MLIL_UNIMPL_MEM: [("src", "expr")],
+ MediumLevelILOperation.MLIL_FADD: [("left", "expr"), ("right", "expr")],
+ MediumLevelILOperation.MLIL_FSUB: [("left", "expr"), ("right", "expr")],
+ MediumLevelILOperation.MLIL_FMUL: [("left", "expr"), ("right", "expr")],
+ MediumLevelILOperation.MLIL_FDIV: [("left", "expr"), ("right", "expr")],
+ MediumLevelILOperation.MLIL_FSQRT: [("src", "expr")],
+ MediumLevelILOperation.MLIL_FNEG: [("src", "expr")],
+ MediumLevelILOperation.MLIL_FABS: [("src", "expr")],
+ MediumLevelILOperation.MLIL_FLOAT_TO_INT: [("src", "expr")],
+ MediumLevelILOperation.MLIL_INT_TO_FLOAT: [("src", "expr")],
+ MediumLevelILOperation.MLIL_FLOAT_CONV: [("src", "expr")],
+ MediumLevelILOperation.MLIL_FCMP_E: [("left", "expr"), ("right", "expr")],
+ MediumLevelILOperation.MLIL_FCMP_NE: [("left", "expr"), ("right", "expr")],
+ MediumLevelILOperation.MLIL_FCMP_LT: [("left", "expr"), ("right", "expr")],
+ MediumLevelILOperation.MLIL_FCMP_LE: [("left", "expr"), ("right", "expr")],
+ MediumLevelILOperation.MLIL_FCMP_GE: [("left", "expr"), ("right", "expr")],
+ MediumLevelILOperation.MLIL_FCMP_GT: [("left", "expr"), ("right", "expr")],
+ MediumLevelILOperation.MLIL_FCMP_UO: [("left", "expr"), ("right", "expr")],
MediumLevelILOperation.MLIL_SET_VAR_SSA: [("dest", "var_ssa"), ("src", "expr")],
MediumLevelILOperation.MLIL_SET_VAR_SSA_FIELD: [("prev", "var_ssa_dest_and_src"), ("offset", "int"), ("src", "expr")],
MediumLevelILOperation.MLIL_SET_VAR_SPLIT_SSA: [("high", "var_ssa"), ("low", "var_ssa"), ("src", "expr")],
@@ -159,6 +177,7 @@ class MediumLevelILInstruction(object):
MediumLevelILOperation.MLIL_VAR_SSA_FIELD: [("src", "var_ssa"), ("offset", "int")],
MediumLevelILOperation.MLIL_VAR_ALIASED: [("src", "var_ssa")],
MediumLevelILOperation.MLIL_VAR_ALIASED_FIELD: [("src", "var_ssa"), ("offset", "int")],
+ MediumLevelILOperation.MLIL_VAR_SPLIT_SSA: [("high", "var_ssa"), ("low", "var_ssa")],
MediumLevelILOperation.MLIL_CALL_SSA: [("output", "expr"), ("dest", "expr"), ("params", "expr_list"), ("src_memory", "int")],
MediumLevelILOperation.MLIL_CALL_UNTYPED_SSA: [("output", "expr"), ("dest", "expr"), ("params", "expr"), ("stack", "expr")],
MediumLevelILOperation.MLIL_SYSCALL_SSA: [("output", "expr"), ("params", "expr_list"), ("src_memory", "int")],