@@ -3784,6 +3784,47 @@ def var_split(
37843784 """
37853785 return self .expr (MediumLevelILOperation .MLIL_VAR_SPLIT , hi .identifier , lo .identifier , size = size , source_location = loc )
37863786
3787+ def assert_expr (
3788+ self ,
3789+ size : int ,
3790+ src : 'variable.Variable' ,
3791+ constraint : 'variable.PossibleValueSet' ,
3792+ loc : Optional ['ILSourceLocation' ] = None
3793+ ) -> ExpressionIndex :
3794+ """
3795+ ``assert_expr`` assert ``constraint`` is the value of the given variable ``src``.
3796+ Used when setting user variable values.
3797+
3798+ :param int size: size of value in the constraint
3799+ :param Variable src: variable to constrain
3800+ :param variable.PossibleValueSet constraint: asserted value of variable
3801+ :param ILSourceLocation loc: location of returned expression
3802+ :return: The expression ``ASSERT(src, constraint)``
3803+ :rtype: ExpressionIndex
3804+ """
3805+ return self .expr (MediumLevelILOperation .MLIL_ASSERT , src .identifier , ExpressionIndex (self .cache_possible_value_set (constraint )), size = size , source_location = loc )
3806+
3807+ def force_ver (
3808+ self ,
3809+ size : int ,
3810+ dest : 'variable.Variable' ,
3811+ src : 'variable.Variable' ,
3812+ loc : Optional ['ILSourceLocation' ] = None
3813+ ) -> ExpressionIndex :
3814+ """
3815+ ``force_ver`` creates a new version of the variable ``dest`` in ``src``
3816+ Effectively, this is like saying src = dest, which analysis can then use as a new
3817+ variable definition site.
3818+
3819+ :param int size: size of the variable
3820+ :param Variable dest: the variable to force a new version of
3821+ :param Variable src: the variable created with the new version
3822+ :param ILSourceLocation loc: location of returned expression
3823+ :return: The expression ``FORCE_VER(reg)``
3824+ :rtype: ExpressionIndex
3825+ """
3826+ return self .expr (MediumLevelILOperation .MLIL_FORCE_VER , dest .identifier , src .identifier , size = size , source_location = loc )
3827+
37873828 def address_of (self , var : 'variable.Variable' , loc : Optional ['ILSourceLocation' ] = None ) -> ExpressionIndex :
37883829 """
37893830 ``address_of`` takes the address of ``var``
@@ -5287,6 +5328,14 @@ def add_variable_list(self, vars: List['variable.Variable']) -> ExpressionIndex:
52875328 operand_list [i ] = vars [i ].identifier
52885329 return ExpressionIndex (core .BNMediumLevelILAddOperandList (self .handle , operand_list , len (vars )))
52895330
5331+ def cache_possible_value_set (self , pvs : 'variable.PossibleValueSet' ) -> int :
5332+ """
5333+ Cache a PossibleValueSet in the IL function, returning its index for use in an expression operand
5334+ :param pvs: PossibleValueSet to cache
5335+ :return: Index of the PossibleValueSet in the cache
5336+ """
5337+ return core .BNCacheMediumLevelILPossibleValueSet (self .handle , pvs ._to_core_struct ())
5338+
52905339 def finalize (self ) -> None :
52915340 """
52925341 ``finalize`` ends the function and computes the list of basic blocks.
0 commit comments