summaryrefslogtreecommitdiff
path: root/lowlevelilinstruction.cpp
diff options
context:
space:
mode:
authorRusty Wagner <rusty@vector35.com>2018-02-02 18:02:57 -0500
committerPeter LaFosse <peter@vector35.com>2018-03-23 17:10:06 -0400
commit2f6d0dbc9fa98f44468791d81d72ffe300879775 (patch)
treeb9b5964d41f753dc6af564dc12e3c173dc6eafce /lowlevelilinstruction.cpp
parent736bd9358ec8c1cdd1c77025b10e576983c4001c (diff)
Add rounding instructions
Diffstat (limited to 'lowlevelilinstruction.cpp')
-rw-r--r--lowlevelilinstruction.cpp36
1 files changed, 36 insertions, 0 deletions
diff --git a/lowlevelilinstruction.cpp b/lowlevelilinstruction.cpp
index e0602a13..71a645e6 100644
--- a/lowlevelilinstruction.cpp
+++ b/lowlevelilinstruction.cpp
@@ -220,6 +220,10 @@ unordered_map<BNLowLevelILOperation, vector<LowLevelILOperandUsage>>
{LLIL_FLOAT_TO_INT, {SourceExprLowLevelOperandUsage}},
{LLIL_INT_TO_FLOAT, {SourceExprLowLevelOperandUsage}},
{LLIL_FLOAT_CONV, {SourceExprLowLevelOperandUsage}},
+ {LLIL_ROUND_TO_INT, {SourceExprLowLevelOperandUsage}},
+ {LLIL_FLOOR, {SourceExprLowLevelOperandUsage}},
+ {LLIL_CEIL, {SourceExprLowLevelOperandUsage}},
+ {LLIL_FTRUNC, {SourceExprLowLevelOperandUsage}},
{LLIL_FCMP_E, {LeftExprLowLevelOperandUsage, RightExprLowLevelOperandUsage}},
{LLIL_FCMP_NE, {LeftExprLowLevelOperandUsage, RightExprLowLevelOperandUsage}},
{LLIL_FCMP_LT, {LeftExprLowLevelOperandUsage, RightExprLowLevelOperandUsage}},
@@ -1817,6 +1821,10 @@ void LowLevelILInstruction::VisitExprs(const std::function<bool(const LowLevelIL
case LLIL_FLOAT_TO_INT:
case LLIL_INT_TO_FLOAT:
case LLIL_FLOAT_CONV:
+ case LLIL_ROUND_TO_INT:
+ case LLIL_FLOOR:
+ case LLIL_CEIL:
+ case LLIL_FTRUNC:
AsOneOperand().GetSourceExpr().VisitExprs(func);
break;
case LLIL_ADD:
@@ -2079,6 +2087,10 @@ ExprId LowLevelILInstruction::CopyTo(LowLevelILFunction* dest,
case LLIL_FLOAT_TO_INT:
case LLIL_INT_TO_FLOAT:
case LLIL_FLOAT_CONV:
+ case LLIL_ROUND_TO_INT:
+ case LLIL_FLOOR:
+ case LLIL_CEIL:
+ case LLIL_FTRUNC:
return dest->AddExprWithLocation(operation, *this, size, flags,
subExprHandler(AsOneOperand().GetSourceExpr()));
case LLIL_ADD:
@@ -3350,6 +3362,30 @@ ExprId LowLevelILFunction::FloatConvert(size_t size, ExprId a, uint32_t flags, c
}
+ExprId LowLevelILFunction::RoundToInt(size_t size, ExprId a, uint32_t flags, const ILSourceLocation& loc)
+{
+ return AddExprWithLocation(LLIL_ROUND_TO_INT, loc, size, flags, a);
+}
+
+
+ExprId LowLevelILFunction::Floor(size_t size, ExprId a, uint32_t flags, const ILSourceLocation& loc)
+{
+ return AddExprWithLocation(LLIL_FLOOR, loc, size, flags, a);
+}
+
+
+ExprId LowLevelILFunction::Ceil(size_t size, ExprId a, uint32_t flags, const ILSourceLocation& loc)
+{
+ return AddExprWithLocation(LLIL_CEIL, loc, size, flags, a);
+}
+
+
+ExprId LowLevelILFunction::FloatTrunc(size_t size, ExprId a, uint32_t flags, const ILSourceLocation& loc)
+{
+ return AddExprWithLocation(LLIL_FTRUNC, 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);