From 8d621c51b2797fda7b1dc22243dde611cfc04f68 Mon Sep 17 00:00:00 2001 From: Rusty Wagner Date: Tue, 23 Dec 2025 13:12:02 -0700 Subject: Refactor calling conventions to support correct representation of structures --- highlevelilinstruction.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'highlevelilinstruction.cpp') diff --git a/highlevelilinstruction.cpp b/highlevelilinstruction.cpp index f155ce03..0ce32c27 100644 --- a/highlevelilinstruction.cpp +++ b/highlevelilinstruction.cpp @@ -159,6 +159,8 @@ static constexpr std::array s_instructionOperandUsage = { OperandUsage{HLIL_DEREF, {SourceExprHighLevelOperandUsage}}, OperandUsage{HLIL_DEREF_FIELD, {SourceExprHighLevelOperandUsage, OffsetHighLevelOperandUsage, MemberIndexHighLevelOperandUsage}}, OperandUsage{HLIL_ADDRESS_OF, {SourceExprHighLevelOperandUsage}}, + OperandUsage{HLIL_PASS_BY_REF, {SourceExprHighLevelOperandUsage}}, + OperandUsage{HLIL_RETURN_BY_REF, {SourceExprHighLevelOperandUsage}}, OperandUsage{HLIL_CONST, {ConstantHighLevelOperandUsage}}, OperandUsage{HLIL_CONST_DATA, {ConstantDataHighLevelOperandUsage}}, OperandUsage{HLIL_CONST_PTR, {ConstantHighLevelOperandUsage}}, @@ -1275,6 +1277,8 @@ void HighLevelILInstruction::CollectSubExprs(stack& toProcess) const case HLIL_FLOOR: case HLIL_CEIL: case HLIL_FTRUNC: + case HLIL_PASS_BY_REF: + case HLIL_RETURN_BY_REF: toProcess.push(AsOneOperand().GetSourceExpr().exprIndex); break; case HLIL_ADD: @@ -1581,6 +1585,8 @@ ExprId HighLevelILInstruction::CopyTo( case HLIL_FLOOR: case HLIL_CEIL: case HLIL_FTRUNC: + case HLIL_PASS_BY_REF: + case HLIL_RETURN_BY_REF: return dest->AddExprWithLocation(operation, loc, size, subExprHandler(AsOneOperand().GetSourceExpr())); case HLIL_ADD: case HLIL_SUB: @@ -2139,6 +2145,8 @@ bool HighLevelILInstruction::operator<(const HighLevelILInstruction& other) cons case HLIL_FLOOR: case HLIL_CEIL: case HLIL_FTRUNC: + case HLIL_PASS_BY_REF: + case HLIL_RETURN_BY_REF: if (size < other.size) return true; if (size > other.size) @@ -2851,6 +2859,18 @@ ExprId HighLevelILFunction::AddressOf(ExprId src, const ILSourceLocation& loc) } +ExprId HighLevelILFunction::PassByRef(size_t size, ExprId src, const ILSourceLocation& loc) +{ + return AddExprWithLocation(HLIL_PASS_BY_REF, loc, size, src); +} + + +ExprId HighLevelILFunction::ReturnByRef(size_t size, ExprId src, const ILSourceLocation& loc) +{ + return AddExprWithLocation(HLIL_RETURN_BY_REF, loc, size, src); +} + + ExprId HighLevelILFunction::Const(size_t size, uint64_t val, const ILSourceLocation& loc) { return AddExprWithLocation(HLIL_CONST, loc, size, val); -- cgit v1.3.1