diff options
Diffstat (limited to 'lowlevelilinstruction.cpp')
| -rw-r--r-- | lowlevelilinstruction.cpp | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/lowlevelilinstruction.cpp b/lowlevelilinstruction.cpp index 6325f0a6..842d2925 100644 --- a/lowlevelilinstruction.cpp +++ b/lowlevelilinstruction.cpp @@ -1348,6 +1348,7 @@ LowLevelILOperandList::operator vector<LowLevelILOperand>() const LowLevelILInstruction::LowLevelILInstruction() { operation = LLIL_UNDEF; + attributes = 0; sourceOperand = BN_INVALID_OPERAND; size = 0; flags = 0; @@ -1362,6 +1363,7 @@ LowLevelILInstruction::LowLevelILInstruction( LowLevelILFunction* func, const BNLowLevelILInstruction& instr, size_t expr, size_t instrIdx) { operation = instr.operation; + attributes = instr.attributes; sourceOperand = instr.sourceOperand; size = instr.size; flags = instr.flags; @@ -1379,6 +1381,7 @@ LowLevelILInstruction::LowLevelILInstruction( LowLevelILInstruction::LowLevelILInstruction(const LowLevelILInstructionBase& instr) { operation = instr.operation; + attributes = instr.attributes; sourceOperand = instr.sourceOperand; size = instr.size; flags = instr.flags; @@ -1783,6 +1786,44 @@ void LowLevelILInstructionBase::Replace(ExprId expr) } +void LowLevelILInstructionBase::SetAttributes(uint32_t attributes) +{ + function->SetExprAttributes(exprIndex, attributes); +} + + +void LowLevelILInstructionBase::SetAttribute(BNILInstructionAttribute attribute, bool state) +{ + uint32_t newAttributes = attributes; + if (state) + { + newAttributes |= attribute; + switch (attribute) + { + case ILAllowDeadStoreElimination: + newAttributes &= ~ILPreventDeadStoreElimination; + break; + case ILPreventDeadStoreElimination: + newAttributes &= ~ILAllowDeadStoreElimination; + break; + default: + break; + } + } + else + { + newAttributes &= ~attribute; + } + SetAttributes(newAttributes); +} + + +void LowLevelILInstructionBase::ClearAttribute(BNILInstructionAttribute attribute) +{ + SetAttribute(attribute, false); +} + + void LowLevelILInstruction::VisitExprs(const std::function<bool(const LowLevelILInstruction& expr)>& func) const { if (!func(*this)) |
