summaryrefslogtreecommitdiff
path: root/python/highlevelil.py
diff options
context:
space:
mode:
authorMark Rowe <mark@vector35.com>2026-06-07 16:04:21 -0700
committerMark Rowe <mark@vector35.com>2026-06-07 16:12:52 -0700
commite1ebfcd751ee5933da99bb21606b779edfe440b2 (patch)
treec119d4e2c533321a9107f1be5a55933c9c590dc3 /python/highlevelil.py
parent61b068347672bf2dbea4ee31d7080d32a3b919fe (diff)
[Python] Fix copy_expr_to and add builder methods for recently-added instructions
Diffstat (limited to 'python/highlevelil.py')
-rw-r--r--python/highlevelil.py147
1 files changed, 147 insertions, 0 deletions
diff --git a/python/highlevelil.py b/python/highlevelil.py
index f990467c..d664232c 100644
--- a/python/highlevelil.py
+++ b/python/highlevelil.py
@@ -3862,6 +3862,66 @@ class HighLevelILFunction:
"""
return self.expr(HighLevelILOperation.HLIL_MULU_DP, a, b, size=size, source_location=loc)
+ def min_signed(
+ self, size: int, a: ExpressionIndex, b: ExpressionIndex, loc: Optional['ILSourceLocation'] = None
+ ) -> ExpressionIndex:
+ """
+ ``min_signed`` signed minimum of expressions ``a`` and ``b`` returning an expression of ``size`` bytes
+
+ :param int size: the size of the result in bytes
+ :param ExpressionIndex a: LHS expression
+ :param ExpressionIndex b: RHS expression
+ :param ILSourceLocation loc: location of returned expression
+ :return: The expression ``mins.<size>(a, b)``
+ :rtype: ExpressionIndex
+ """
+ return self.expr(HighLevelILOperation.HLIL_MINS, a, b, size=size, source_location=loc)
+
+ def max_signed(
+ self, size: int, a: ExpressionIndex, b: ExpressionIndex, loc: Optional['ILSourceLocation'] = None
+ ) -> ExpressionIndex:
+ """
+ ``max_signed`` signed maximum of expressions ``a`` and ``b`` returning an expression of ``size`` bytes
+
+ :param int size: the size of the result in bytes
+ :param ExpressionIndex a: LHS expression
+ :param ExpressionIndex b: RHS expression
+ :param ILSourceLocation loc: location of returned expression
+ :return: The expression ``maxs.<size>(a, b)``
+ :rtype: ExpressionIndex
+ """
+ return self.expr(HighLevelILOperation.HLIL_MAXS, a, b, size=size, source_location=loc)
+
+ def min_unsigned(
+ self, size: int, a: ExpressionIndex, b: ExpressionIndex, loc: Optional['ILSourceLocation'] = None
+ ) -> ExpressionIndex:
+ """
+ ``min_unsigned`` unsigned minimum of expressions ``a`` and ``b`` returning an expression of ``size`` bytes
+
+ :param int size: the size of the result in bytes
+ :param ExpressionIndex a: LHS expression
+ :param ExpressionIndex b: RHS expression
+ :param ILSourceLocation loc: location of returned expression
+ :return: The expression ``minu.<size>(a, b)``
+ :rtype: ExpressionIndex
+ """
+ return self.expr(HighLevelILOperation.HLIL_MINU, a, b, size=size, source_location=loc)
+
+ def max_unsigned(
+ self, size: int, a: ExpressionIndex, b: ExpressionIndex, loc: Optional['ILSourceLocation'] = None
+ ) -> ExpressionIndex:
+ """
+ ``max_unsigned`` unsigned maximum of expressions ``a`` and ``b`` returning an expression of ``size`` bytes
+
+ :param int size: the size of the result in bytes
+ :param ExpressionIndex a: LHS expression
+ :param ExpressionIndex b: RHS expression
+ :param ILSourceLocation loc: location of returned expression
+ :return: The expression ``maxu.<size>(a, b)``
+ :rtype: ExpressionIndex
+ """
+ return self.expr(HighLevelILOperation.HLIL_MAXU, a, b, size=size, source_location=loc)
+
def div_signed(
self, size: int, a: ExpressionIndex, b: ExpressionIndex, loc: Optional['ILSourceLocation'] = None
) -> ExpressionIndex:
@@ -4014,6 +4074,93 @@ class HighLevelILFunction:
"""
return self.expr(HighLevelILOperation.HLIL_NOT, value, size=size, source_location=loc)
+ def byte_swap(self, size: int, value: ExpressionIndex, loc: Optional['ILSourceLocation'] = None) -> ExpressionIndex:
+ """
+ ``byte_swap`` reverses the byte order of expression ``value`` of size ``size``
+
+ :param int size: the size of the result in bytes
+ :param ExpressionIndex value: the expression to byte swap
+ :param ILSourceLocation loc: location of returned expression
+ :return: The expression ``bswap.<size>(value)``
+ :rtype: ExpressionIndex
+ """
+ return self.expr(HighLevelILOperation.HLIL_BSWAP, value, size=size, source_location=loc)
+
+ def population_count(self, size: int, value: ExpressionIndex, loc: Optional['ILSourceLocation'] = None) -> ExpressionIndex:
+ """
+ ``population_count`` counts the number of set bits in expression ``value`` of size ``size``
+
+ :param int size: the size of the result in bytes
+ :param ExpressionIndex value: the expression to count set bits in
+ :param ILSourceLocation loc: location of returned expression
+ :return: The expression ``popcnt.<size>(value)``
+ :rtype: ExpressionIndex
+ """
+ return self.expr(HighLevelILOperation.HLIL_POPCNT, value, size=size, source_location=loc)
+
+ def count_leading_zeros(self, size: int, value: ExpressionIndex, loc: Optional['ILSourceLocation'] = None) -> ExpressionIndex:
+ """
+ ``count_leading_zeros`` counts the leading zero bits in expression ``value`` of size ``size``. The result is
+ ``8 * size`` when ``value`` is zero.
+
+ :param int size: the size of the result in bytes
+ :param ExpressionIndex value: the expression to count leading zero bits in
+ :param ILSourceLocation loc: location of returned expression
+ :return: The expression ``clz.<size>(value)``
+ :rtype: ExpressionIndex
+ """
+ return self.expr(HighLevelILOperation.HLIL_CLZ, value, size=size, source_location=loc)
+
+ def count_trailing_zeros(self, size: int, value: ExpressionIndex, loc: Optional['ILSourceLocation'] = None) -> ExpressionIndex:
+ """
+ ``count_trailing_zeros`` counts the trailing zero bits in expression ``value`` of size ``size``. The result is
+ ``8 * size`` when ``value`` is zero.
+
+ :param int size: the size of the result in bytes
+ :param ExpressionIndex value: the expression to count trailing zero bits in
+ :param ILSourceLocation loc: location of returned expression
+ :return: The expression ``ctz.<size>(value)``
+ :rtype: ExpressionIndex
+ """
+ return self.expr(HighLevelILOperation.HLIL_CTZ, value, size=size, source_location=loc)
+
+ def reverse_bits(self, size: int, value: ExpressionIndex, loc: Optional['ILSourceLocation'] = None) -> ExpressionIndex:
+ """
+ ``reverse_bits`` reverses the bit order of expression ``value`` of size ``size``
+
+ :param int size: the size of the result in bytes
+ :param ExpressionIndex value: the expression to reverse the bits of
+ :param ILSourceLocation loc: location of returned expression
+ :return: The expression ``rbit.<size>(value)``
+ :rtype: ExpressionIndex
+ """
+ return self.expr(HighLevelILOperation.HLIL_RBIT, value, size=size, source_location=loc)
+
+ def count_leading_signs(self, size: int, value: ExpressionIndex, loc: Optional['ILSourceLocation'] = None) -> ExpressionIndex:
+ """
+ ``count_leading_signs`` counts the leading sign bits in expression ``value`` of size ``size`` (the number of bits
+ below the sign bit that match it)
+
+ :param int size: the size of the result in bytes
+ :param ExpressionIndex value: the expression to count leading sign bits in
+ :param ILSourceLocation loc: location of returned expression
+ :return: The expression ``cls.<size>(value)``
+ :rtype: ExpressionIndex
+ """
+ return self.expr(HighLevelILOperation.HLIL_CLS, value, size=size, source_location=loc)
+
+ def absolute_value(self, size: int, value: ExpressionIndex, loc: Optional['ILSourceLocation'] = None) -> ExpressionIndex:
+ """
+ ``absolute_value`` signed absolute value of expression ``value`` of size ``size``
+
+ :param int size: the size of the result in bytes
+ :param ExpressionIndex value: the expression to take the absolute value of
+ :param ILSourceLocation loc: location of returned expression
+ :return: The expression ``abs.<size>(value)``
+ :rtype: ExpressionIndex
+ """
+ return self.expr(HighLevelILOperation.HLIL_ABS, value, size=size, source_location=loc)
+
def sign_extend(self, size: int, value: ExpressionIndex, loc: Optional['ILSourceLocation'] = None) -> ExpressionIndex:
"""
``sign_extend`` two's complement sign-extends the expression in ``value`` to ``size`` bytes