summaryrefslogtreecommitdiff
path: root/lowlevelilinstruction.cpp
diff options
context:
space:
mode:
authorRusty Wagner <rusty@vector35.com>2018-02-02 18:02:57 -0500
committerRusty Wagner <rusty@vector35.com>2018-02-02 18:02:57 -0500
commit331bfd4e4a648de8aba4fefd8301703a6a3440c9 (patch)
tree6a2287c7d4731c787918e47161eb944fc225051c /lowlevelilinstruction.cpp
parentfd51307c7fa5baff29860b1e3be09aafca13c2f0 (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 1a834435..c38d742f 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}},
@@ -1816,6 +1820,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:
@@ -2078,6 +2086,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:
@@ -3349,6 +3361,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);