diff options
Diffstat (limited to 'rust/src/medium_level_il')
| -rw-r--r-- | rust/src/medium_level_il/instruction.rs | 29 | ||||
| -rw-r--r-- | rust/src/medium_level_il/lift.rs | 15 |
2 files changed, 42 insertions, 2 deletions
diff --git a/rust/src/medium_level_il/instruction.rs b/rust/src/medium_level_il/instruction.rs index 77a0be27..69936e60 100644 --- a/rust/src/medium_level_il/instruction.rs +++ b/rust/src/medium_level_il/instruction.rs @@ -334,6 +334,22 @@ impl MediumLevelILInstruction { left: MediumLevelExpressionIndex::from(op.operands[0]), right: MediumLevelExpressionIndex::from(op.operands[1]), }), + MLIL_MINS => Op::MinSigned(BinaryOp { + left: MediumLevelExpressionIndex::from(op.operands[0]), + right: MediumLevelExpressionIndex::from(op.operands[1]), + }), + MLIL_MAXS => Op::MaxSigned(BinaryOp { + left: MediumLevelExpressionIndex::from(op.operands[0]), + right: MediumLevelExpressionIndex::from(op.operands[1]), + }), + MLIL_MINU => Op::MinUnsigned(BinaryOp { + left: MediumLevelExpressionIndex::from(op.operands[0]), + right: MediumLevelExpressionIndex::from(op.operands[1]), + }), + MLIL_MAXU => Op::MaxUnsigned(BinaryOp { + left: MediumLevelExpressionIndex::from(op.operands[0]), + right: MediumLevelExpressionIndex::from(op.operands[1]), + }), MLIL_CMP_E => Op::CmpE(BinaryOp { left: MediumLevelExpressionIndex::from(op.operands[0]), right: MediumLevelExpressionIndex::from(op.operands[1]), @@ -593,6 +609,9 @@ impl MediumLevelILInstruction { MLIL_CLS => Op::Cls(UnaryOp { src: MediumLevelExpressionIndex::from(op.operands[0] as usize), }), + MLIL_ABS => Op::Abs(UnaryOp { + src: MediumLevelExpressionIndex::from(op.operands[0] as usize), + }), MLIL_SX => Op::Sx(UnaryOp { src: MediumLevelExpressionIndex::from(op.operands[0] as usize), }), @@ -941,6 +960,10 @@ impl MediumLevelILInstruction { ModuDp(op) => Lifted::ModuDp(self.lift_binary_op(op)), Mods(op) => Lifted::Mods(self.lift_binary_op(op)), ModsDp(op) => Lifted::ModsDp(self.lift_binary_op(op)), + MinSigned(op) => Lifted::MinSigned(self.lift_binary_op(op)), + MaxSigned(op) => Lifted::MaxSigned(self.lift_binary_op(op)), + MinUnsigned(op) => Lifted::MinUnsigned(self.lift_binary_op(op)), + MaxUnsigned(op) => Lifted::MaxUnsigned(self.lift_binary_op(op)), CmpE(op) => Lifted::CmpE(self.lift_binary_op(op)), CmpNe(op) => Lifted::CmpNe(self.lift_binary_op(op)), CmpSlt(op) => Lifted::CmpSlt(self.lift_binary_op(op)), @@ -1123,6 +1146,7 @@ impl MediumLevelILInstruction { Ctz(op) => Lifted::Ctz(self.lift_unary_op(op)), Rbit(op) => Lifted::Rbit(self.lift_unary_op(op)), Cls(op) => Lifted::Cls(self.lift_unary_op(op)), + Abs(op) => Lifted::Abs(self.lift_unary_op(op)), Sx(op) => Lifted::Sx(self.lift_unary_op(op)), Zx(op) => Lifted::Zx(self.lift_unary_op(op)), LowPart(op) => Lifted::LowPart(self.lift_unary_op(op)), @@ -1843,6 +1867,10 @@ pub enum MediumLevelILInstructionKind { ModuDp(BinaryOp), Mods(BinaryOp), ModsDp(BinaryOp), + MinSigned(BinaryOp), + MaxSigned(BinaryOp), + MinUnsigned(BinaryOp), + MaxUnsigned(BinaryOp), CmpE(BinaryOp), CmpNe(BinaryOp), CmpSlt(BinaryOp), @@ -1904,6 +1932,7 @@ pub enum MediumLevelILInstructionKind { Ctz(UnaryOp), Rbit(UnaryOp), Cls(UnaryOp), + Abs(UnaryOp), Sx(UnaryOp), Zx(UnaryOp), LowPart(UnaryOp), diff --git a/rust/src/medium_level_il/lift.rs b/rust/src/medium_level_il/lift.rs index 2f0d6653..f886d93a 100644 --- a/rust/src/medium_level_il/lift.rs +++ b/rust/src/medium_level_il/lift.rs @@ -102,6 +102,10 @@ pub enum MediumLevelILLiftedInstructionKind { ModuDp(LiftedBinaryOp), Mods(LiftedBinaryOp), ModsDp(LiftedBinaryOp), + MinSigned(LiftedBinaryOp), + MaxSigned(LiftedBinaryOp), + MinUnsigned(LiftedBinaryOp), + MaxUnsigned(LiftedBinaryOp), CmpE(LiftedBinaryOp), CmpNe(LiftedBinaryOp), CmpSlt(LiftedBinaryOp), @@ -160,6 +164,7 @@ pub enum MediumLevelILLiftedInstructionKind { Ctz(LiftedUnaryOp), Rbit(LiftedUnaryOp), Cls(LiftedUnaryOp), + Abs(LiftedUnaryOp), Sx(LiftedUnaryOp), Zx(LiftedUnaryOp), LowPart(LiftedUnaryOp), @@ -264,6 +269,10 @@ impl MediumLevelILLiftedInstruction { ModuDp(_) => "ModuDp", Mods(_) => "Mods", ModsDp(_) => "ModsDp", + MinSigned(_) => "MinSigned", + MaxSigned(_) => "MaxSigned", + MinUnsigned(_) => "MinUnsigned", + MaxUnsigned(_) => "MaxUnsigned", CmpE(_) => "CmpE", CmpNe(_) => "CmpNe", CmpSlt(_) => "CmpSlt", @@ -325,6 +334,7 @@ impl MediumLevelILLiftedInstruction { Ctz(_) => "Ctz", Rbit(_) => "Rbit", Cls(_) => "Cls", + Abs(_) => "Abs", Sx(_) => "Sx", Zx(_) => "Zx", LowPart(_) => "LowPart", @@ -469,7 +479,8 @@ impl MediumLevelILLiftedInstruction { ], Add(op) | Sub(op) | And(op) | Or(op) | Xor(op) | Lsl(op) | Lsr(op) | Asr(op) | Rol(op) | Ror(op) | Mul(op) | MuluDp(op) | MulsDp(op) | Divu(op) | DivuDp(op) - | Divs(op) | DivsDp(op) | Modu(op) | ModuDp(op) | Mods(op) | ModsDp(op) | CmpE(op) + | Divs(op) | DivsDp(op) | Modu(op) | ModuDp(op) | Mods(op) | ModsDp(op) + | MinSigned(op) | MaxSigned(op) | MinUnsigned(op) | MaxUnsigned(op) | CmpE(op) | CmpNe(op) | CmpSlt(op) | CmpUlt(op) | CmpSle(op) | CmpUle(op) | CmpSge(op) | CmpUge(op) | CmpSgt(op) | CmpUgt(op) | TestBit(op) | AddOverflow(op) | FcmpE(op) | FcmpNe(op) | FcmpLt(op) | FcmpLe(op) | FcmpGe(op) | FcmpGt(op) | FcmpO(op) @@ -555,7 +566,7 @@ impl MediumLevelILLiftedInstruction { ("stack", Operand::Expr(*op.stack.clone())), ], Neg(op) | Not(op) | Bswap(op) | Popcnt(op) | Clz(op) | Ctz(op) | Rbit(op) | Cls(op) - | Sx(op) | Zx(op) | LowPart(op) | BoolToInt(op) | UnimplMem(op) + | Abs(op) | Sx(op) | Zx(op) | LowPart(op) | BoolToInt(op) | UnimplMem(op) | Fsqrt(op) | Fneg(op) | Fabs(op) | FloatToInt(op) | IntToFloat(op) | FloatConv(op) | RoundToInt(op) | Floor(op) | Ceil(op) | Ftrunc(op) | Load(op) => { vec![("src", Operand::Expr(*op.src.clone()))] |
