summaryrefslogtreecommitdiff
path: root/highlevelilinstruction.cpp
diff options
context:
space:
mode:
authorRusty Wagner <rusty.wagner@gmail.com>2025-12-23 13:12:02 -0700
committerRusty Wagner <rusty.wagner@gmail.com>2026-05-22 16:30:56 -0400
commit8d621c51b2797fda7b1dc22243dde611cfc04f68 (patch)
treeba5e6a90e644d21d13e75dabcbd0cc747444443a /highlevelilinstruction.cpp
parent08e34ac325743085911f96b62c81d9a1f2127806 (diff)
Refactor calling conventions to support correct representation of structures
Diffstat (limited to 'highlevelilinstruction.cpp')
-rw-r--r--highlevelilinstruction.cpp20
1 files changed, 20 insertions, 0 deletions
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<size_t>& 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);