From bcdc0d9b89605936a1cb6cf3ffaaece60d3c5777 Mon Sep 17 00:00:00 2001 From: Ryan Snyder Date: Fri, 24 Jan 2025 17:57:26 -0500 Subject: uidf refactor --- lowlevelilinstruction.cpp | 45 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-) (limited to 'lowlevelilinstruction.cpp') diff --git a/lowlevelilinstruction.cpp b/lowlevelilinstruction.cpp index 17368662..6b93dd0c 100644 --- a/lowlevelilinstruction.cpp +++ b/lowlevelilinstruction.cpp @@ -81,7 +81,8 @@ unordered_map LowLevelILInstructi {OutputMemoryIntrinsicLowLevelOperandUsage, SSARegisterOrFlagListLowLevelOperand}, {SourceMemoryVersionsLowLevelOperandUsage, IndexListLowLevelOperand}, {TargetsLowLevelOperandUsage, IndexMapLowLevelOperand}, - {RegisterStackAdjustmentsLowLevelOperandUsage, RegisterStackAdjustmentsLowLevelOperand}}; + {RegisterStackAdjustmentsLowLevelOperandUsage, RegisterStackAdjustmentsLowLevelOperand}, + {ConstraintLowLevelOperandUsage, ConstraintLowLevelOperand}}; unordered_map> LowLevelILInstructionBase::operationOperandUsage = @@ -105,6 +106,10 @@ unordered_map> LowLevelILI DestRegisterLowLevelOperandUsage, SourceExprLowLevelOperandUsage}}, {LLIL_SET_FLAG, {DestFlagLowLevelOperandUsage, SourceExprLowLevelOperandUsage}}, {LLIL_SET_FLAG_SSA, {DestSSAFlagLowLevelOperandUsage, SourceExprLowLevelOperandUsage}}, + {LLIL_FORCE_VER, {DestRegisterLowLevelOperandUsage}}, + {LLIL_FORCE_VER_SSA, {DestSSARegisterLowLevelOperandUsage, SourceSSARegisterLowLevelOperandUsage}}, + {LLIL_ASSERT, {SourceRegisterLowLevelOperandUsage, ConstraintLowLevelOperandUsage}}, + {LLIL_ASSERT_SSA, {SourceSSARegisterLowLevelOperandUsage, ConstraintLowLevelOperandUsage}}, {LLIL_LOAD, {SourceExprLowLevelOperandUsage}}, {LLIL_LOAD_SSA, {SourceExprLowLevelOperandUsage, SourceMemoryVersionLowLevelOperandUsage}}, {LLIL_STORE, {DestExprLowLevelOperandUsage, SourceExprLowLevelOperandUsage}}, @@ -1546,6 +1551,12 @@ map LowLevelILInstructionBase::GetRawOperandAsRegisterStackAd } +PossibleValueSet LowLevelILInstructionBase::GetRawOperandAsPossibleValueSet(size_t operand) const +{ + return function->GetCachedPossibleValueSet(operands[operand]); +} + + void LowLevelILInstructionBase::UpdateRawOperand(size_t operandIndex, ExprId value) { operands[operandIndex] = value; @@ -2102,6 +2113,14 @@ ExprId LowLevelILInstruction::CopyTo( case LLIL_SET_FLAG_SSA: return dest->SetFlagSSA( GetDestSSAFlag(), subExprHandler(GetSourceExpr()), *this); + case LLIL_FORCE_VER: + return dest->ForceVer(size, GetDestRegister(), *this); + case LLIL_FORCE_VER_SSA: + return dest->ForceVerSSA(size, GetDestSSARegister(), GetSourceSSARegister(), *this); + case LLIL_ASSERT: + return dest->Assert(size, GetSourceRegister(), GetConstraint(), *this); + case LLIL_ASSERT_SSA: + return dest->AssertSSA(size, GetSourceSSARegister(), GetConstraint(), *this); case LLIL_LOAD: return dest->Load(size, subExprHandler(GetSourceExpr()), flags, *this); case LLIL_LOAD_SSA: @@ -2902,6 +2921,30 @@ ExprId LowLevelILFunction::SetFlagSSA(const SSAFlag& flag, ExprId val, const ILS } +ExprId LowLevelILFunction::ForceVer(size_t size, uint32_t reg, const ILSourceLocation& loc) +{ + return AddExprWithLocation(LLIL_FORCE_VER, loc, size, 0, reg); +} + + +ExprId LowLevelILFunction::ForceVerSSA(size_t size, SSARegister dst, SSARegister src, const ILSourceLocation& loc) +{ + return AddExprWithLocation(LLIL_FORCE_VER_SSA, loc, size, 0, dst.reg, dst.version, src.reg, src.version); +} + + +ExprId LowLevelILFunction::Assert(size_t size, uint32_t reg, const PossibleValueSet& pvs, const ILSourceLocation& loc) +{ + return AddExprWithLocation(LLIL_ASSERT, loc, size, 0, reg, CachePossibleValueSet(pvs)); +} + + +ExprId LowLevelILFunction::AssertSSA(size_t size, SSARegister src, const PossibleValueSet& pvs, const ILSourceLocation& loc) +{ + return AddExprWithLocation(LLIL_ASSERT_SSA, loc, size, 0, src.reg, src.version, CachePossibleValueSet(pvs)); +} + + ExprId LowLevelILFunction::Load(size_t size, ExprId addr, uint32_t flags, const ILSourceLocation& loc) { return AddExprWithLocation(LLIL_LOAD, loc, size, flags, addr); -- cgit v1.3.1