@@ -218,7 +218,9 @@ class MediumLevelILInstruction(BaseILInstruction):
218218 MediumLevelILOperation .MLIL_VAR : [("src" , "var" )], MediumLevelILOperation .MLIL_VAR_FIELD : [
219219 ("src" , "var" ), ("offset" , "int" )
220220 ], MediumLevelILOperation .MLIL_VAR_SPLIT : [("high" , "var" ), ("low" , "var" )],
221- MediumLevelILOperation .MLIL_ADDRESS_OF : [("src" , "var" )], MediumLevelILOperation .MLIL_ADDRESS_OF_FIELD : [
221+ MediumLevelILOperation .MLIL_ADDRESS_OF : [("src" , "var" )], MediumLevelILOperation .MLIL_PASS_BY_REF : [
222+ ("src" , "expr" )
223+ ], MediumLevelILOperation .MLIL_ADDRESS_OF_FIELD : [
222224 ("src" , "var" ), ("offset" , "int" )
223225 ], MediumLevelILOperation .MLIL_CONST : [("constant" , "int" )], MediumLevelILOperation .MLIL_CONST_PTR : [
224226 ("constant" , "int" )
@@ -1310,6 +1312,11 @@ def vars_address_taken(self) -> List[variable.Variable]:
13101312 return [self .src ]
13111313
13121314
1315+ @dataclass (frozen = True , repr = False , eq = False )
1316+ class MediumLevelILPassByRef (MediumLevelILUnaryBase ):
1317+ pass
1318+
1319+
13131320@dataclass (frozen = True , repr = False , eq = False )
13141321class MediumLevelILConst (MediumLevelILConstBase ):
13151322 @property
@@ -3118,6 +3125,7 @@ def detailed_operands(self) -> List[Tuple[str, MediumLevelILOperandType, str]]:
31183125 MediumLevelILOperation .MLIL_LOAD : MediumLevelILLoad , # [("src", "expr")],
31193126 MediumLevelILOperation .MLIL_VAR : MediumLevelILVar , # [("src", "var")],
31203127 MediumLevelILOperation .MLIL_ADDRESS_OF : MediumLevelILAddressOf , # [("src", "var")],
3128+ MediumLevelILOperation .MLIL_PASS_BY_REF : MediumLevelILPassByRef , # [("src", "expr")],
31213129 MediumLevelILOperation .MLIL_CONST : MediumLevelILConst , # [("constant", "int")],
31223130 MediumLevelILOperation .MLIL_CONST_PTR : MediumLevelILConstPtr , # [("constant", "int")],
31233131 MediumLevelILOperation .MLIL_FLOAT_CONST : MediumLevelILFloatConst , # [("constant", "float")],
@@ -3740,6 +3748,9 @@ def do_copy(
37403748 if expr .operation == MediumLevelILOperation .MLIL_ADDRESS_OF :
37413749 expr : MediumLevelILAddressOf
37423750 return dest .address_of (expr .src , loc )
3751+ if expr .operation == MediumLevelILOperation .MLIL_PASS_BY_REF :
3752+ expr : MediumLevelILPassByRef
3753+ return dest .pass_by_ref (expr .size , expr .src , loc )
37433754 if expr .operation == MediumLevelILOperation .MLIL_ADDRESS_OF_FIELD :
37443755 expr : MediumLevelILAddressOfField
37453756 return dest .address_of_field (expr .src , expr .offset , loc )
@@ -4367,6 +4378,18 @@ def address_of(self, var: 'variable.Variable', loc: Optional['ILSourceLocation']
43674378 """
43684379 return self .expr (MediumLevelILOperation .MLIL_ADDRESS_OF , var .identifier , size = 0 , source_location = loc )
43694380
4381+ def pass_by_ref (self , size : int , value : ExpressionIndex , loc : Optional ['ILSourceLocation' ] = None ) -> ExpressionIndex :
4382+ """
4383+ ``pass_by_ref`` indicates that ``value`` is being passed by reference to a call with a pointer size of ``size``
4384+
4385+ :param int size: the size of the pointer in bytes
4386+ :param ExpressionIndex value: the expression containing the reference being passed
4387+ :param ILSourceLocation loc: location of returned expression
4388+ :return: The expression ``ref *value``
4389+ :rtype: ExpressionIndex
4390+ """
4391+ return self .expr (MediumLevelILOperation .MLIL_PASS_BY_REF , value , size = size , source_location = loc )
4392+
43704393 def address_of_field (self , var : 'variable.Variable' , offset : int , loc : Optional ['ILSourceLocation' ] = None ) -> ExpressionIndex :
43714394 """
43724395 ``address_of_field`` takes the address of ``var`` at the offset ``offset``
0 commit comments