From 6812c973c9fa9b4ad642ab81856c05f87bd6fcc4 Mon Sep 17 00:00:00 2001 From: KyleMiles Date: Thu, 27 Jan 2022 22:43:28 -0500 Subject: Format All Files --- lowlevelilinstruction.h | 1169 ++++++++++++++++++++++++++++++++++------------- 1 file changed, 859 insertions(+), 310 deletions(-) (limited to 'lowlevelilinstruction.h') diff --git a/lowlevelilinstruction.h b/lowlevelilinstruction.h index e11efa51..033b98b7 100644 --- a/lowlevelilinstruction.h +++ b/lowlevelilinstruction.h @@ -24,9 +24,9 @@ #include #include #ifdef BINARYNINJACORE_LIBRARY -#include "type.h" + #include "type.h" #else -#include "binaryninjaapi.h" + #include "binaryninjaapi.h" #endif #ifdef BINARYNINJACORE_LIBRARY @@ -42,7 +42,8 @@ namespace BinaryNinja class LowLevelILFunction; template - struct LowLevelILInstructionAccessor {}; + struct LowLevelILInstructionAccessor + {}; struct LowLevelILInstruction; struct LowLevelILConstantInstruction; @@ -223,14 +224,15 @@ namespace BinaryNinja RegisterStackAdjustmentsLowLevelOperandUsage, OffsetLowLevelOperandUsage }; -} +} // namespace BinaryNinjaCore -namespace std -{ +namespace std { #ifdef BINARYNINJACORE_LIBRARY - template<> struct hash + template <> + struct hash #else - template<> struct hash + template <> + struct hash #endif { #ifdef BINARYNINJACORE_LIBRARY @@ -246,9 +248,11 @@ namespace std }; #ifdef BINARYNINJACORE_LIBRARY - template<> struct hash + template <> + struct hash #else - template<> struct hash + template <> + struct hash #endif { #ifdef BINARYNINJACORE_LIBRARY @@ -264,9 +268,11 @@ namespace std }; #ifdef BINARYNINJACORE_LIBRARY - template<> struct hash + template <> + struct hash #else - template<> struct hash + template <> + struct hash #endif { #ifdef BINARYNINJACORE_LIBRARY @@ -281,20 +287,20 @@ namespace std } }; - template<> struct hash + template <> + struct hash { typedef BNLowLevelILOperation argument_type; typedef int result_type; - result_type operator()(argument_type const& value) const - { - return (result_type)value; - } + result_type operator()(argument_type const& value) const { return (result_type)value; } }; #ifdef BINARYNINJACORE_LIBRARY - template<> struct hash + template <> + struct hash #else - template<> struct hash + template <> + struct hash #endif { #ifdef BINARYNINJACORE_LIBRARY @@ -303,12 +309,9 @@ namespace std typedef BinaryNinja::LowLevelILOperandUsage argument_type; #endif typedef int result_type; - result_type operator()(argument_type const& value) const - { - return (result_type)value; - } + result_type operator()(argument_type const& value) const { return (result_type)value; } }; -} +} // namespace std #ifdef BINARYNINJACORE_LIBRARY namespace BinaryNinjaCore @@ -317,21 +320,21 @@ namespace BinaryNinja #endif { #ifdef BINARYNINJACORE_LIBRARY -#define _STD_VECTOR vector -#define _STD_SET set -#define _STD_UNORDERED_MAP unordered_map -#define _STD_MAP map + #define _STD_VECTOR vector + #define _STD_SET set + #define _STD_UNORDERED_MAP unordered_map + #define _STD_MAP map #else -#define _STD_VECTOR std::vector -#define _STD_SET std::set -#define _STD_UNORDERED_MAP std::unordered_map -#define _STD_MAP std::map + #define _STD_VECTOR std::vector + #define _STD_SET std::set + #define _STD_UNORDERED_MAP std::unordered_map + #define _STD_MAP std::map #endif - class LowLevelILInstructionAccessException: public std::exception + class LowLevelILInstructionAccessException : public std::exception { - public: - LowLevelILInstructionAccessException(): std::exception() {} + public: + LowLevelILInstructionAccessException() : std::exception() {} virtual const char* what() const NOEXCEPT { return "invalid access to LLIL instruction"; } }; @@ -358,7 +361,7 @@ namespace BinaryNinja ListIterator m_start; - public: + public: typedef ListIterator const_iterator; LowLevelILIntegerList(LowLevelILFunction* func, const BNLowLevelILInstruction& instr, size_t count); @@ -379,13 +382,17 @@ namespace BinaryNinja bool operator==(const ListIterator& a) const { return pos == a.pos; } bool operator!=(const ListIterator& a) const { return pos != a.pos; } bool operator<(const ListIterator& a) const { return pos < a.pos; } - ListIterator& operator++() { ++pos; return *this; } + ListIterator& operator++() + { + ++pos; + return *this; + } size_t operator*(); }; LowLevelILIntegerList m_list; - public: + public: typedef ListIterator const_iterator; LowLevelILIndexList(LowLevelILFunction* func, const BNLowLevelILInstruction& instr, size_t count); @@ -406,13 +413,18 @@ namespace BinaryNinja bool operator==(const ListIterator& a) const { return pos == a.pos; } bool operator!=(const ListIterator& a) const { return pos != a.pos; } bool operator<(const ListIterator& a) const { return pos < a.pos; } - ListIterator& operator++() { ++pos; ++pos; return *this; } + ListIterator& operator++() + { + ++pos; + ++pos; + return *this; + } const std::pair operator*(); }; LowLevelILIntegerList m_list; - public: + public: typedef ListIterator const_iterator; LowLevelILIndexMap(LowLevelILFunction* func, const BNLowLevelILInstruction& instr, size_t count); @@ -434,18 +446,22 @@ namespace BinaryNinja bool operator==(const ListIterator& a) const { return pos == a.pos; } bool operator!=(const ListIterator& a) const { return pos != a.pos; } bool operator<(const ListIterator& a) const { return pos < a.pos; } - ListIterator& operator++() { ++pos; return *this; } + ListIterator& operator++() + { + ++pos; + return *this; + } const LowLevelILInstruction operator*(); }; LowLevelILIntegerList m_list; size_t m_instructionIndex; - public: + public: typedef ListIterator const_iterator; - LowLevelILInstructionList(LowLevelILFunction* func, const BNLowLevelILInstruction& instr, - size_t count, size_t instrIndex); + LowLevelILInstructionList( + LowLevelILFunction* func, const BNLowLevelILInstruction& instr, size_t count, size_t instrIndex); const_iterator begin() const; const_iterator end() const; @@ -463,13 +479,17 @@ namespace BinaryNinja bool operator==(const ListIterator& a) const { return pos == a.pos; } bool operator!=(const ListIterator& a) const { return pos != a.pos; } bool operator<(const ListIterator& a) const { return pos < a.pos; } - ListIterator& operator++() { ++pos; return *this; } + ListIterator& operator++() + { + ++pos; + return *this; + } const RegisterOrFlag operator*(); }; LowLevelILIntegerList m_list; - public: + public: typedef ListIterator const_iterator; LowLevelILRegisterOrFlagList(LowLevelILFunction* func, const BNLowLevelILInstruction& instr, size_t count); @@ -490,13 +510,18 @@ namespace BinaryNinja bool operator==(const ListIterator& a) const { return pos == a.pos; } bool operator!=(const ListIterator& a) const { return pos != a.pos; } bool operator<(const ListIterator& a) const { return pos < a.pos; } - ListIterator& operator++() { ++pos; ++pos; return *this; } + ListIterator& operator++() + { + ++pos; + ++pos; + return *this; + } const SSARegister operator*(); }; LowLevelILIntegerList m_list; - public: + public: typedef ListIterator const_iterator; LowLevelILSSARegisterList(LowLevelILFunction* func, const BNLowLevelILInstruction& instr, size_t count); @@ -517,13 +542,18 @@ namespace BinaryNinja bool operator==(const ListIterator& a) const { return pos == a.pos; } bool operator!=(const ListIterator& a) const { return pos != a.pos; } bool operator<(const ListIterator& a) const { return pos < a.pos; } - ListIterator& operator++() { ++pos; ++pos; return *this; } + ListIterator& operator++() + { + ++pos; + ++pos; + return *this; + } const SSARegisterStack operator*(); }; LowLevelILIntegerList m_list; - public: + public: typedef ListIterator const_iterator; LowLevelILSSARegisterStackList(LowLevelILFunction* func, const BNLowLevelILInstruction& instr, size_t count); @@ -544,13 +574,18 @@ namespace BinaryNinja bool operator==(const ListIterator& a) const { return pos == a.pos; } bool operator!=(const ListIterator& a) const { return pos != a.pos; } bool operator<(const ListIterator& a) const { return pos < a.pos; } - ListIterator& operator++() { ++pos; ++pos; return *this; } + ListIterator& operator++() + { + ++pos; + ++pos; + return *this; + } const SSAFlag operator*(); }; LowLevelILIntegerList m_list; - public: + public: typedef ListIterator const_iterator; LowLevelILSSAFlagList(LowLevelILFunction* func, const BNLowLevelILInstruction& instr, size_t count); @@ -571,13 +606,18 @@ namespace BinaryNinja bool operator==(const ListIterator& a) const { return pos == a.pos; } bool operator!=(const ListIterator& a) const { return pos != a.pos; } bool operator<(const ListIterator& a) const { return pos < a.pos; } - ListIterator& operator++() { ++pos; ++pos; return *this; } + ListIterator& operator++() + { + ++pos; + ++pos; + return *this; + } const SSARegisterOrFlag operator*(); }; LowLevelILIntegerList m_list; - public: + public: typedef ListIterator const_iterator; LowLevelILSSARegisterOrFlagList(LowLevelILFunction* func, const BNLowLevelILInstruction& instr, size_t count); @@ -590,7 +630,7 @@ namespace BinaryNinja operator _STD_VECTOR() const; }; - struct LowLevelILInstructionBase: public BNLowLevelILInstruction + struct LowLevelILInstructionBase : public BNLowLevelILInstruction { #ifdef BINARYNINJACORE_LIBRARY LowLevelILFunction* function; @@ -600,10 +640,9 @@ namespace BinaryNinja size_t exprIndex, instructionIndex; static _STD_UNORDERED_MAP operandTypeForUsage; - static _STD_UNORDERED_MAP> operationOperandUsage; - static _STD_UNORDERED_MAP> operationOperandIndex; + static _STD_UNORDERED_MAP> operationOperandUsage; + static _STD_UNORDERED_MAP> + operationOperandIndex; LowLevelILOperandList GetOperands() const; @@ -628,11 +667,12 @@ namespace BinaryNinja void UpdateRawOperand(size_t operandIndex, ExprId value); void UpdateRawOperandAsSSARegisterList(size_t operandIndex, const _STD_VECTOR& regs); - void UpdateRawOperandAsSSARegisterOrFlagList(size_t operandIndex, const _STD_VECTOR& outputs); + void UpdateRawOperandAsSSARegisterOrFlagList( + size_t operandIndex, const _STD_VECTOR& outputs); RegisterValue GetValue() const; - PossibleValueSet GetPossibleValues(const _STD_SET& options = - _STD_SET()) const; + PossibleValueSet GetPossibleValues( + const _STD_SET& options = _STD_SET()) const; RegisterValue GetRegisterValue(uint32_t reg); RegisterValue GetRegisterValueAfter(uint32_t reg); @@ -674,14 +714,8 @@ namespace BinaryNinja throw LowLevelILInstructionAccessException(); return *(LowLevelILInstructionAccessor*)this; } - LowLevelILOneOperandInstruction& AsOneOperand() - { - return *(LowLevelILOneOperandInstruction*)this; - } - LowLevelILTwoOperandInstruction& AsTwoOperand() - { - return *(LowLevelILTwoOperandInstruction*)this; - } + LowLevelILOneOperandInstruction& AsOneOperand() { return *(LowLevelILOneOperandInstruction*)this; } + LowLevelILTwoOperandInstruction& AsTwoOperand() { return *(LowLevelILTwoOperandInstruction*)this; } LowLevelILTwoOperandWithCarryInstruction& AsTwoOperandWithCarry() { return *(LowLevelILTwoOperandWithCarryInstruction*)this; @@ -694,10 +728,7 @@ namespace BinaryNinja throw LowLevelILInstructionAccessException(); return *(const LowLevelILInstructionAccessor*)this; } - const LowLevelILConstantInstruction& AsConstant() const - { - return *(const LowLevelILConstantInstruction*)this; - } + const LowLevelILConstantInstruction& AsConstant() const { return *(const LowLevelILConstantInstruction*)this; } const LowLevelILOneOperandInstruction& AsOneOperand() const { return *(const LowLevelILOneOperandInstruction*)this; @@ -712,80 +743,316 @@ namespace BinaryNinja } }; - struct LowLevelILInstruction: public LowLevelILInstructionBase + struct LowLevelILInstruction : public LowLevelILInstructionBase { LowLevelILInstruction(); - LowLevelILInstruction(LowLevelILFunction* func, const BNLowLevelILInstruction& instr, - size_t expr, size_t instrIdx); + LowLevelILInstruction( + LowLevelILFunction* func, const BNLowLevelILInstruction& instr, size_t expr, size_t instrIdx); LowLevelILInstruction(const LowLevelILInstructionBase& instr); void VisitExprs(const std::function& func) const; ExprId CopyTo(LowLevelILFunction* dest) const; ExprId CopyTo(LowLevelILFunction* dest, - const std::function& subExprHandler) const; + const std::function& subExprHandler) const; // Templated accessors for instruction operands, use these for efficient access to a known instruction - template LowLevelILInstruction GetSourceExpr() const { return As().GetSourceExpr(); } - template uint32_t GetSourceRegister() const { return As().GetSourceRegister(); } - template uint32_t GetSourceRegisterStack() const { return As().GetSourceRegisterStack(); } - template uint32_t GetSourceFlag() const { return As().GetSourceFlag(); } - template SSARegister GetSourceSSARegister() const { return As().GetSourceSSARegister(); } - template SSARegisterStack GetSourceSSARegisterStack() const { return As().GetSourceSSARegisterStack(); } - template SSAFlag GetSourceSSAFlag() const { return As().GetSourceSSAFlag(); } - template LowLevelILInstruction GetDestExpr() const { return As().GetDestExpr(); } - template uint32_t GetDestRegister() const { return As().GetDestRegister(); } - template uint32_t GetDestRegisterStack() const { return As().GetDestRegisterStack(); } - template uint32_t GetDestFlag() const { return As().GetDestFlag(); } - template SSARegister GetDestSSARegister() const { return As().GetDestSSARegister(); } - template SSARegisterStack GetDestSSARegisterStack() const { return As().GetDestSSARegisterStack(); } - template SSAFlag GetDestSSAFlag() const { return As().GetDestSSAFlag(); } - template uint32_t GetSemanticFlagClass() const { return As().GetSemanticFlagClass(); } - template uint32_t GetSemanticFlagGroup() const { return As().GetSemanticFlagGroup(); } - template uint32_t GetPartialRegister() const { return As().GetPartialRegister(); } - template SSARegister GetStackSSARegister() const { return As().GetStackSSARegister(); } - template SSARegister GetTopSSARegister() const { return As().GetTopSSARegister(); } - template LowLevelILInstruction GetLeftExpr() const { return As().GetLeftExpr(); } - template LowLevelILInstruction GetRightExpr() const { return As().GetRightExpr(); } - template LowLevelILInstruction GetCarryExpr() const { return As().GetCarryExpr(); } - template LowLevelILInstruction GetConditionExpr() const { return As().GetConditionExpr(); } - template uint32_t GetHighRegister() const { return As().GetHighRegister(); } - template SSARegister GetHighSSARegister() const { return As().GetHighSSARegister(); } - template uint32_t GetLowRegister() const { return As().GetLowRegister(); } - template SSARegister GetLowSSARegister() const { return As().GetLowSSARegister(); } - template uint32_t GetIntrinsic() const { return As().GetIntrinsic(); } - template int64_t GetConstant() const { return As().GetConstant(); } - template uint64_t GetOffset() const { return As().GetOffset(); } - template int64_t GetVector() const { return As().GetVector(); } - template int64_t GetStackAdjustment() const { return As().GetStackAdjustment(); } - template size_t GetTarget() const { return As().GetTarget(); } - template size_t GetTrueTarget() const { return As().GetTrueTarget(); } - template size_t GetFalseTarget() const { return As().GetFalseTarget(); } - template size_t GetBitIndex() const { return As().GetBitIndex(); } - template size_t GetSourceMemoryVersion() const { return As().GetSourceMemoryVersion(); } - template size_t GetDestMemoryVersion() const { return As().GetDestMemoryVersion(); } - template BNLowLevelILFlagCondition GetFlagCondition() const { return As().GetFlagCondition(); } - template LowLevelILSSARegisterList GetOutputSSARegisters() const { return As().GetOutputSSARegisters(); } - template LowLevelILInstructionList GetParameterExprs() const { return As().GetParameterExprs(); } - template LowLevelILSSARegisterList GetSourceSSARegisters() const { return As().GetSourceSSARegisters(); } - template LowLevelILSSARegisterStackList GetSourceSSARegisterStacks() const { return As().GetSourceSSARegisterStacks(); } - template LowLevelILSSAFlagList GetSourceSSAFlags() const { return As().GetSourceSSAFlags(); } - template LowLevelILRegisterOrFlagList GetOutputRegisterOrFlagList() const { return As().GetOutputRegisterOrFlagList(); } - template LowLevelILSSARegisterOrFlagList GetOutputSSARegisterOrFlagList() const { return As().GetOutputSSARegisterOrFlagList(); } - template LowLevelILIndexList GetSourceMemoryVersions() const { return As().GetSourceMemoryVersions(); } - template LowLevelILIndexMap GetTargets() const { return As().GetTargets(); } - template _STD_MAP GetRegisterStackAdjustments() const { return As().GetRegisterStackAdjustments(); } - - template void SetDestSSAVersion(size_t version) { As().SetDestSSAVersion(version); } - template void SetSourceSSAVersion(size_t version) { As().SetSourceSSAVersion(version); } - template void SetHighSSAVersion(size_t version) { As().SetHighSSAVersion(version); } - template void SetLowSSAVersion(size_t version) { As().SetLowSSAVersion(version); } - template void SetStackSSAVersion(size_t version) { As().SetStackSSAVersion(version); } - template void SetTopSSAVersion(size_t version) { As().SetTopSSAVersion(version); } - template void SetDestMemoryVersion(size_t version) { As().SetDestMemoryVersion(version); } - template void SetSourceMemoryVersion(size_t version) { As().SetSourceMemoryVersion(version); } - template void SetOutputSSARegisters(const _STD_VECTOR& regs) { As().SetOutputSSARegisters(regs); } - template void SetOutputSSARegisterOrFlagList(const _STD_VECTOR& outputs) { As().SetOutputSSARegisterOrFlagList(outputs); } + template + LowLevelILInstruction GetSourceExpr() const + { + return As().GetSourceExpr(); + } + template + uint32_t GetSourceRegister() const + { + return As().GetSourceRegister(); + } + template + uint32_t GetSourceRegisterStack() const + { + return As().GetSourceRegisterStack(); + } + template + uint32_t GetSourceFlag() const + { + return As().GetSourceFlag(); + } + template + SSARegister GetSourceSSARegister() const + { + return As().GetSourceSSARegister(); + } + template + SSARegisterStack GetSourceSSARegisterStack() const + { + return As().GetSourceSSARegisterStack(); + } + template + SSAFlag GetSourceSSAFlag() const + { + return As().GetSourceSSAFlag(); + } + template + LowLevelILInstruction GetDestExpr() const + { + return As().GetDestExpr(); + } + template + uint32_t GetDestRegister() const + { + return As().GetDestRegister(); + } + template + uint32_t GetDestRegisterStack() const + { + return As().GetDestRegisterStack(); + } + template + uint32_t GetDestFlag() const + { + return As().GetDestFlag(); + } + template + SSARegister GetDestSSARegister() const + { + return As().GetDestSSARegister(); + } + template + SSARegisterStack GetDestSSARegisterStack() const + { + return As().GetDestSSARegisterStack(); + } + template + SSAFlag GetDestSSAFlag() const + { + return As().GetDestSSAFlag(); + } + template + uint32_t GetSemanticFlagClass() const + { + return As().GetSemanticFlagClass(); + } + template + uint32_t GetSemanticFlagGroup() const + { + return As().GetSemanticFlagGroup(); + } + template + uint32_t GetPartialRegister() const + { + return As().GetPartialRegister(); + } + template + SSARegister GetStackSSARegister() const + { + return As().GetStackSSARegister(); + } + template + SSARegister GetTopSSARegister() const + { + return As().GetTopSSARegister(); + } + template + LowLevelILInstruction GetLeftExpr() const + { + return As().GetLeftExpr(); + } + template + LowLevelILInstruction GetRightExpr() const + { + return As().GetRightExpr(); + } + template + LowLevelILInstruction GetCarryExpr() const + { + return As().GetCarryExpr(); + } + template + LowLevelILInstruction GetConditionExpr() const + { + return As().GetConditionExpr(); + } + template + uint32_t GetHighRegister() const + { + return As().GetHighRegister(); + } + template + SSARegister GetHighSSARegister() const + { + return As().GetHighSSARegister(); + } + template + uint32_t GetLowRegister() const + { + return As().GetLowRegister(); + } + template + SSARegister GetLowSSARegister() const + { + return As().GetLowSSARegister(); + } + template + uint32_t GetIntrinsic() const + { + return As().GetIntrinsic(); + } + template + int64_t GetConstant() const + { + return As().GetConstant(); + } + template + uint64_t GetOffset() const + { + return As().GetOffset(); + } + template + int64_t GetVector() const + { + return As().GetVector(); + } + template + int64_t GetStackAdjustment() const + { + return As().GetStackAdjustment(); + } + template + size_t GetTarget() const + { + return As().GetTarget(); + } + template + size_t GetTrueTarget() const + { + return As().GetTrueTarget(); + } + template + size_t GetFalseTarget() const + { + return As().GetFalseTarget(); + } + template + size_t GetBitIndex() const + { + return As().GetBitIndex(); + } + template + size_t GetSourceMemoryVersion() const + { + return As().GetSourceMemoryVersion(); + } + template + size_t GetDestMemoryVersion() const + { + return As().GetDestMemoryVersion(); + } + template + BNLowLevelILFlagCondition GetFlagCondition() const + { + return As().GetFlagCondition(); + } + template + LowLevelILSSARegisterList GetOutputSSARegisters() const + { + return As().GetOutputSSARegisters(); + } + template + LowLevelILInstructionList GetParameterExprs() const + { + return As().GetParameterExprs(); + } + template + LowLevelILSSARegisterList GetSourceSSARegisters() const + { + return As().GetSourceSSARegisters(); + } + template + LowLevelILSSARegisterStackList GetSourceSSARegisterStacks() const + { + return As().GetSourceSSARegisterStacks(); + } + template + LowLevelILSSAFlagList GetSourceSSAFlags() const + { + return As().GetSourceSSAFlags(); + } + template + LowLevelILRegisterOrFlagList GetOutputRegisterOrFlagList() const + { + return As().GetOutputRegisterOrFlagList(); + } + template + LowLevelILSSARegisterOrFlagList GetOutputSSARegisterOrFlagList() const + { + return As().GetOutputSSARegisterOrFlagList(); + } + template + LowLevelILIndexList GetSourceMemoryVersions() const + { + return As().GetSourceMemoryVersions(); + } + template + LowLevelILIndexMap GetTargets() const + { + return As().GetTargets(); + } + template + _STD_MAP GetRegisterStackAdjustments() const + { + return As().GetRegisterStackAdjustments(); + } + + template + void SetDestSSAVersion(size_t version) + { + As().SetDestSSAVersion(version); + } + template + void SetSourceSSAVersion(size_t version) + { + As().SetSourceSSAVersion(version); + } + template + void SetHighSSAVersion(size_t version) + { + As().SetHighSSAVersion(version); + } + template + void SetLowSSAVersion(size_t version) + { + As().SetLowSSAVersion(version); + } + template + void SetStackSSAVersion(size_t version) + { + As().SetStackSSAVersion(version); + } + template + void SetTopSSAVersion(size_t version) + { + As().SetTopSSAVersion(version); + } + template + void SetDestMemoryVersion(size_t version) + { + As().SetDestMemoryVersion(version); + } + template + void SetSourceMemoryVersion(size_t version) + { + As().SetSourceMemoryVersion(version); + } + template + void SetOutputSSARegisters(const _STD_VECTOR& regs) + { + As().SetOutputSSARegisters(regs); + } + template + void SetOutputSSARegisterOrFlagList(const _STD_VECTOR& outputs) + { + As().SetOutputSSARegisterOrFlagList(outputs); + } bool GetOperandIndexForUsage(LowLevelILOperandUsage usage, size_t& operandIndex) const; @@ -849,9 +1116,8 @@ namespace BinaryNinja LowLevelILOperandType m_type; size_t m_operandIndex; - public: - LowLevelILOperand(const LowLevelILInstruction& instr, LowLevelILOperandUsage usage, - size_t operandIndex); + public: + LowLevelILOperand(const LowLevelILInstruction& instr, LowLevelILOperandUsage usage, size_t operandIndex); LowLevelILOperandType GetType() const { return m_type; } LowLevelILOperandUsage GetUsage() const { return m_usage; } @@ -889,7 +1155,11 @@ namespace BinaryNinja bool operator==(const ListIterator& a) const { return pos == a.pos; } bool operator!=(const ListIterator& a) const { return pos != a.pos; } bool operator<(const ListIterator& a) const { return pos < a.pos; } - ListIterator& operator++() { ++pos; return *this; } + ListIterator& operator++() + { + ++pos; + return *this; + } const LowLevelILOperand operator*(); }; @@ -897,12 +1167,11 @@ namespace BinaryNinja const _STD_VECTOR& m_usageList; const _STD_UNORDERED_MAP& m_operandIndexMap; - public: + public: typedef ListIterator const_iterator; - LowLevelILOperandList(const LowLevelILInstruction& instr, - const _STD_VECTOR& usageList, - const _STD_UNORDERED_MAP& operandIndexMap); + LowLevelILOperandList(const LowLevelILInstruction& instr, const _STD_VECTOR& usageList, + const _STD_UNORDERED_MAP& operandIndexMap); const_iterator begin() const; const_iterator end() const; @@ -912,28 +1181,28 @@ namespace BinaryNinja operator _STD_VECTOR() const; }; - struct LowLevelILConstantInstruction: public LowLevelILInstructionBase + struct LowLevelILConstantInstruction : public LowLevelILInstructionBase { int64_t GetConstant() const { return GetRawOperandAsInteger(0); } }; - struct LowLevelILOffsetInstruction: public LowLevelILInstructionBase + struct LowLevelILOffsetInstruction : public LowLevelILInstructionBase { int64_t GetOffset() const { return GetRawOperandAsInteger(1); } }; - struct LowLevelILOneOperandInstruction: public LowLevelILInstructionBase + struct LowLevelILOneOperandInstruction : public LowLevelILInstructionBase { LowLevelILInstruction GetSourceExpr() const { return GetRawOperandAsExpr(0); } }; - struct LowLevelILTwoOperandInstruction: public LowLevelILInstructionBase + struct LowLevelILTwoOperandInstruction : public LowLevelILInstructionBase { LowLevelILInstruction GetLeftExpr() const { return GetRawOperandAsExpr(0); } LowLevelILInstruction GetRightExpr() const { return GetRawOperandAsExpr(1); } }; - struct LowLevelILTwoOperandWithCarryInstruction: public LowLevelILInstructionBase + struct LowLevelILTwoOperandWithCarryInstruction : public LowLevelILInstructionBase { LowLevelILInstruction GetLeftExpr() const { return GetRawOperandAsExpr(0); } LowLevelILInstruction GetRightExpr() const { return GetRawOperandAsExpr(1); } @@ -943,31 +1212,36 @@ namespace BinaryNinja // Implementations of each instruction to fetch the correct operand value for the valid operands, these // are derived from LowLevelILInstructionBase so that invalid operand accessor functions will generate // a compiler error. - template <> struct LowLevelILInstructionAccessor: public LowLevelILInstructionBase + template <> + struct LowLevelILInstructionAccessor : public LowLevelILInstructionBase { uint32_t GetDestRegister() const { return GetRawOperandAsRegister(0); } LowLevelILInstruction GetSourceExpr() const { return GetRawOperandAsExpr(1); } }; - template <> struct LowLevelILInstructionAccessor: public LowLevelILInstructionBase + template <> + struct LowLevelILInstructionAccessor : public LowLevelILInstructionBase { uint32_t GetHighRegister() const { return GetRawOperandAsRegister(0); } uint32_t GetLowRegister() const { return GetRawOperandAsRegister(1); } LowLevelILInstruction GetSourceExpr() const { return GetRawOperandAsExpr(2); } }; - template <> struct LowLevelILInstructionAccessor: public LowLevelILInstructionBase + template <> + struct LowLevelILInstructionAccessor : public LowLevelILInstructionBase { SSARegister GetDestSSARegister() const { return GetRawOperandAsSSARegister(0); } LowLevelILInstruction GetSourceExpr() const { return GetRawOperandAsExpr(2); } void SetDestSSAVersion(size_t version) { UpdateRawOperand(1, version); } }; - template <> struct LowLevelILInstructionAccessor: public LowLevelILInstructionBase + template <> + struct LowLevelILInstructionAccessor : public LowLevelILInstructionBase { SSARegister GetDestSSARegister() const { return GetRawOperandAsSSARegister(0); } uint32_t GetPartialRegister() const { return GetRawOperandAsRegister(2); } LowLevelILInstruction GetSourceExpr() const { return GetRawOperandAsExpr(3); } void SetDestSSAVersion(size_t version) { UpdateRawOperand(1, version); } }; - template <> struct LowLevelILInstructionAccessor: public LowLevelILInstructionBase + template <> + struct LowLevelILInstructionAccessor : public LowLevelILInstructionBase { SSARegister GetHighSSARegister() const { return GetRawOperandAsExpr(0).GetRawOperandAsSSARegister(0); } SSARegister GetLowSSARegister() const { return GetRawOperandAsExpr(1).GetRawOperandAsSSARegister(0); } @@ -975,21 +1249,30 @@ namespace BinaryNinja void SetHighSSAVersion(size_t version) { GetRawOperandAsExpr(0).UpdateRawOperand(1, version); } void SetLowSSAVersion(size_t version) { GetRawOperandAsExpr(1).UpdateRawOperand(1, version); } }; - template <> struct LowLevelILInstructionAccessor: public LowLevelILInstructionBase + template <> + struct LowLevelILInstructionAccessor : public LowLevelILInstructionBase { uint32_t GetDestRegisterStack() const { return GetRawOperandAsRegister(0); } LowLevelILInstruction GetDestExpr() const { return GetRawOperandAsExpr(1); } LowLevelILInstruction GetSourceExpr() const { return GetRawOperandAsExpr(2); } }; - template <> struct LowLevelILInstructionAccessor: public LowLevelILInstructionBase + template <> + struct LowLevelILInstructionAccessor : public LowLevelILInstructionBase { uint32_t GetDestRegisterStack() const { return GetRawOperandAsRegister(0); } LowLevelILInstruction GetSourceExpr() const { return GetRawOperandAsExpr(1); } }; - template <> struct LowLevelILInstructionAccessor: public LowLevelILInstructionBase + template <> + struct LowLevelILInstructionAccessor : public LowLevelILInstructionBase { - SSARegisterStack GetDestSSARegisterStack() const { return GetRawOperandAsExpr(0).GetRawOperandAsSSARegisterStack(0); } - SSARegisterStack GetSourceSSARegisterStack() const { return GetRawOperandAsExpr(0).GetRawOperandAsPartialSSARegisterStackSource(0); } + SSARegisterStack GetDestSSARegisterStack() const + { + return GetRawOperandAsExpr(0).GetRawOperandAsSSARegisterStack(0); + } + SSARegisterStack GetSourceSSARegisterStack() const + { + return GetRawOperandAsExpr(0).GetRawOperandAsPartialSSARegisterStackSource(0); + } LowLevelILInstruction GetDestExpr() const { return GetRawOperandAsExpr(1); } SSARegister GetTopSSARegister() const { return GetRawOperandAsExpr(2).GetRawOperandAsSSARegister(0); } LowLevelILInstruction GetSourceExpr() const { return GetRawOperandAsExpr(3); } @@ -997,41 +1280,55 @@ namespace BinaryNinja void SetSourceSSAVersion(size_t version) { GetRawOperandAsExpr(0).UpdateRawOperand(2, version); } void SetTopSSAVersion(size_t version) { GetRawOperandAsExpr(2).UpdateRawOperand(1, version); } }; - template <> struct LowLevelILInstructionAccessor: public LowLevelILInstructionBase + template <> + struct LowLevelILInstructionAccessor : public LowLevelILInstructionBase { - SSARegisterStack GetDestSSARegisterStack() const { return GetRawOperandAsExpr(0).GetRawOperandAsSSARegisterStack(0); } - SSARegisterStack GetSourceSSARegisterStack() const { return GetRawOperandAsExpr(0).GetRawOperandAsPartialSSARegisterStackSource(0); } + SSARegisterStack GetDestSSARegisterStack() const + { + return GetRawOperandAsExpr(0).GetRawOperandAsSSARegisterStack(0); + } + SSARegisterStack GetSourceSSARegisterStack() const + { + return GetRawOperandAsExpr(0).GetRawOperandAsPartialSSARegisterStackSource(0); + } uint32_t GetDestRegister() const { return GetRawOperandAsRegister(1); } LowLevelILInstruction GetSourceExpr() const { return GetRawOperandAsExpr(2); } void SetDestSSAVersion(size_t version) { GetRawOperandAsExpr(0).UpdateRawOperand(1, version); } void SetSourceSSAVersion(size_t version) { GetRawOperandAsExpr(0).UpdateRawOperand(2, version); } }; - template <> struct LowLevelILInstructionAccessor: public LowLevelILInstructionBase + template <> + struct LowLevelILInstructionAccessor : public LowLevelILInstructionBase { uint32_t GetDestFlag() const { return GetRawOperandAsRegister(0); } LowLevelILInstruction GetSourceExpr() const { return GetRawOperandAsExpr(1); } }; - template <> struct LowLevelILInstructionAccessor: public LowLevelILInstructionBase + template <> + struct LowLevelILInstructionAccessor : public LowLevelILInstructionBase { SSAFlag GetDestSSAFlag() const { return GetRawOperandAsSSAFlag(0); } LowLevelILInstruction GetSourceExpr() const { return GetRawOperandAsExpr(2); } void SetDestSSAVersion(size_t version) { UpdateRawOperand(1, version); } }; - template <> struct LowLevelILInstructionAccessor: public LowLevelILOneOperandInstruction {}; - template <> struct LowLevelILInstructionAccessor: public LowLevelILInstructionBase + template <> + struct LowLevelILInstructionAccessor : public LowLevelILOneOperandInstruction + {}; + template <> + struct LowLevelILInstructionAccessor : public LowLevelILInstructionBase { LowLevelILInstruction GetSourceExpr() const { return GetRawOperandAsExpr(0); } size_t GetSourceMemoryVersion() const { return GetRawOperandAsIndex(1); } void SetSourceMemoryVersion(size_t version) { UpdateRawOperand(1, version); } }; - template <> struct LowLevelILInstructionAccessor: public LowLevelILInstructionBase + template <> + struct LowLevelILInstructionAccessor : public LowLevelILInstructionBase { LowLevelILInstruction GetDestExpr() const { return GetRawOperandAsExpr(0); } LowLevelILInstruction GetSourceExpr() const { return GetRawOperandAsExpr(1); } }; - template <> struct LowLevelILInstructionAccessor: public LowLevelILInstructionBase + template <> + struct LowLevelILInstructionAccessor : public LowLevelILInstructionBase { LowLevelILInstruction GetDestExpr() const { return GetRawOperandAsExpr(0); } size_t GetDestMemoryVersion() const { return GetRawOperandAsIndex(1); } @@ -1041,40 +1338,48 @@ namespace BinaryNinja void SetSourceMemoryVersion(size_t version) { UpdateRawOperand(2, version); } }; - template <> struct LowLevelILInstructionAccessor: public LowLevelILInstructionBase + template <> + struct LowLevelILInstructionAccessor : public LowLevelILInstructionBase { uint32_t GetSourceRegister() const { return GetRawOperandAsRegister(0); } }; - template <> struct LowLevelILInstructionAccessor: public LowLevelILInstructionBase + template <> + struct LowLevelILInstructionAccessor : public LowLevelILInstructionBase { SSARegister GetSourceSSARegister() const { return GetRawOperandAsSSARegister(0); } void SetSourceSSAVersion(size_t version) { UpdateRawOperand(1, version); } }; - template <> struct LowLevelILInstructionAccessor: public LowLevelILInstructionBase + template <> + struct LowLevelILInstructionAccessor : public LowLevelILInstructionBase { SSARegister GetSourceSSARegister() const { return GetRawOperandAsSSARegister(0); } uint32_t GetPartialRegister() const { return GetRawOperandAsRegister(2); } void SetSourceSSAVersion(size_t version) { UpdateRawOperand(1, version); } }; - template <> struct LowLevelILInstructionAccessor: public LowLevelILInstructionBase + template <> + struct LowLevelILInstructionAccessor : public LowLevelILInstructionBase { uint32_t GetSourceRegisterStack() const { return GetRawOperandAsRegister(0); } LowLevelILInstruction GetSourceExpr() const { return GetRawOperandAsExpr(1); } }; - template <> struct LowLevelILInstructionAccessor: public LowLevelILInstructionBase + template <> + struct LowLevelILInstructionAccessor : public LowLevelILInstructionBase { uint32_t GetSourceRegisterStack() const { return GetRawOperandAsRegister(0); } }; - template <> struct LowLevelILInstructionAccessor: public LowLevelILInstructionBase + template <> + struct LowLevelILInstructionAccessor : public LowLevelILInstructionBase { uint32_t GetDestRegister() const { return GetRawOperandAsRegister(0); } }; - template <> struct LowLevelILInstructionAccessor: public LowLevelILInstructionBase + template <> + struct LowLevelILInstructionAccessor : public LowLevelILInstructionBase { uint32_t GetDestRegisterStack() const { return GetRawOperandAsRegister(0); } LowLevelILInstruction GetDestExpr() const { return GetRawOperandAsExpr(1); } }; - template <> struct LowLevelILInstructionAccessor: public LowLevelILInstructionBase + template <> + struct LowLevelILInstructionAccessor : public LowLevelILInstructionBase { SSARegisterStack GetSourceSSARegisterStack() const { return GetRawOperandAsSSARegisterStack(0); } LowLevelILInstruction GetSourceExpr() const { return GetRawOperandAsExpr(2); } @@ -1082,57 +1387,78 @@ namespace BinaryNinja void SetSourceSSAVersion(size_t version) { UpdateRawOperand(1, version); } void SetTopSSAVersion(size_t version) { GetRawOperandAsExpr(3).UpdateRawOperand(1, version); } }; - template <> struct LowLevelILInstructionAccessor: public LowLevelILInstructionBase + template <> + struct LowLevelILInstructionAccessor : public LowLevelILInstructionBase { SSARegisterStack GetSourceSSARegisterStack() const { return GetRawOperandAsSSARegisterStack(0); } uint32_t GetSourceRegister() const { return GetRawOperandAsRegister(2); } void SetSourceSSAVersion(size_t version) { UpdateRawOperand(1, version); } }; - template <> struct LowLevelILInstructionAccessor: public LowLevelILInstructionBase + template <> + struct LowLevelILInstructionAccessor : public LowLevelILInstructionBase { - SSARegisterStack GetDestSSARegisterStack() const { return GetRawOperandAsExpr(0).GetRawOperandAsSSARegisterStack(0); } - SSARegisterStack GetSourceSSARegisterStack() const { return GetRawOperandAsExpr(0).GetRawOperandAsPartialSSARegisterStackSource(0); } + SSARegisterStack GetDestSSARegisterStack() const + { + return GetRawOperandAsExpr(0).GetRawOperandAsSSARegisterStack(0); + } + SSARegisterStack GetSourceSSARegisterStack() const + { + return GetRawOperandAsExpr(0).GetRawOperandAsPartialSSARegisterStackSource(0); + } LowLevelILInstruction GetDestExpr() const { return GetRawOperandAsExpr(1); } SSARegister GetTopSSARegister() const { return GetRawOperandAsExpr(2).GetRawOperandAsSSARegister(0); } void SetDestSSAVersion(size_t version) { GetRawOperandAsExpr(0).UpdateRawOperand(1, version); } void SetSourceSSAVersion(size_t version) { GetRawOperandAsExpr(0).UpdateRawOperand(2, version); } void SetTopSSAVersion(size_t version) { GetRawOperandAsExpr(2).UpdateRawOperand(1, version); } }; - template <> struct LowLevelILInstructionAccessor: public LowLevelILInstructionBase + template <> + struct LowLevelILInstructionAccessor : public LowLevelILInstructionBase { - SSARegisterStack GetDestSSARegisterStack() const { return GetRawOperandAsExpr(0).GetRawOperandAsSSARegisterStack(0); } - SSARegisterStack GetSourceSSARegisterStack() const { return GetRawOperandAsExpr(0).GetRawOperandAsPartialSSARegisterStackSource(0); } + SSARegisterStack GetDestSSARegisterStack() const + { + return GetRawOperandAsExpr(0).GetRawOperandAsSSARegisterStack(0); + } + SSARegisterStack GetSourceSSARegisterStack() const + { + return GetRawOperandAsExpr(0).GetRawOperandAsPartialSSARegisterStackSource(0); + } uint32_t GetDestRegister() const { return GetRawOperandAsRegister(1); } void SetDestSSAVersion(size_t version) { GetRawOperandAsExpr(0).UpdateRawOperand(1, version); } void SetSourceSSAVersion(size_t version) { GetRawOperandAsExpr(0).UpdateRawOperand(2, version); } }; - template <> struct LowLevelILInstructionAccessor: public LowLevelILInstructionBase + template <> + struct LowLevelILInstructionAccessor : public LowLevelILInstructionBase { uint32_t GetSourceFlag() const { return GetRawOperandAsRegister(0); } }; - template <> struct LowLevelILInstructionAccessor: public LowLevelILInstructionBase + template <> + struct LowLevelILInstructionAccessor : public LowLevelILInstructionBase { uint32_t GetSourceFlag() const { return GetRawOperandAsRegister(0); } size_t GetBitIndex() const { return GetRawOperandAsIndex(1); } }; - template <> struct LowLevelILInstructionAccessor: public LowLevelILInstructionBase + template <> + struct LowLevelILInstructionAccessor : public LowLevelILInstructionBase { SSAFlag GetSourceSSAFlag() const { return GetRawOperandAsSSAFlag(0); } void SetSourceSSAVersion(size_t version) { UpdateRawOperand(1, version); } }; - template <> struct LowLevelILInstructionAccessor: public LowLevelILInstructionBase + template <> + struct LowLevelILInstructionAccessor : public LowLevelILInstructionBase { SSAFlag GetSourceSSAFlag() const { return GetRawOperandAsSSAFlag(0); } size_t GetBitIndex() const { return GetRawOperandAsIndex(2); } void SetSourceSSAVersion(size_t version) { UpdateRawOperand(1, version); } }; - template <> struct LowLevelILInstructionAccessor: public LowLevelILInstructionBase + template <> + struct LowLevelILInstructionAccessor : public LowLevelILInstructionBase { uint32_t GetHighRegister() const { return GetRawOperandAsRegister(0); } uint32_t GetLowRegister() const { return GetRawOperandAsRegister(1); } }; - template <> struct LowLevelILInstructionAccessor: public LowLevelILInstructionBase + template <> + struct LowLevelILInstructionAccessor : public LowLevelILInstructionBase { SSARegister GetHighSSARegister() const { return GetRawOperandAsSSARegister(0); } SSARegister GetLowSSARegister() const { return GetRawOperandAsSSARegister(2); } @@ -1140,224 +1466,447 @@ namespace BinaryNinja void SetLowSSAVersion(size_t version) { UpdateRawOperand(3, version); } }; - template <> struct LowLevelILInstructionAccessor: public LowLevelILInstructionBase + template <> + struct LowLevelILInstructionAccessor : public LowLevelILInstructionBase { LowLevelILInstruction GetDestExpr() const { return GetRawOperandAsExpr(0); } }; - template <> struct LowLevelILInstructionAccessor: public LowLevelILInstructionBase + template <> + struct LowLevelILInstructionAccessor : public LowLevelILInstructionBase { LowLevelILInstruction GetDestExpr() const { return GetRawOperandAsExpr(0); } LowLevelILIndexMap GetTargets() const { return GetRawOperandAsIndexMap(1); } }; - template <> struct LowLevelILInstructionAccessor: public LowLevelILInstructionBase + template <> + struct LowLevelILInstructionAccessor : public LowLevelILInstructionBase { LowLevelILInstruction GetDestExpr() const { return GetRawOperandAsExpr(0); } }; - template <> struct LowLevelILInstructionAccessor: public LowLevelILInstructionBase + template <> + struct LowLevelILInstructionAccessor : public LowLevelILInstructionBase { LowLevelILInstruction GetDestExpr() const { return GetRawOperandAsExpr(0); } int64_t GetStackAdjustment() const { return GetRawOperandAsInteger(1); } - _STD_MAP GetRegisterStackAdjustments() const { return GetRawOperandAsRegisterStackAdjustments(2); } + _STD_MAP GetRegisterStackAdjustments() const + { + return GetRawOperandAsRegisterStackAdjustments(2); + } }; - template <> struct LowLevelILInstructionAccessor: public LowLevelILInstructionBase + template <> + struct LowLevelILInstructionAccessor : public LowLevelILInstructionBase { LowLevelILInstruction GetDestExpr() const { return GetRawOperandAsExpr(0); } }; - template <> struct LowLevelILInstructionAccessor: public LowLevelILInstructionBase + template <> + struct LowLevelILInstructionAccessor : public LowLevelILInstructionBase { LowLevelILInstruction GetDestExpr() const { return GetRawOperandAsExpr(0); } }; - template <> struct LowLevelILInstructionAccessor: public LowLevelILInstructionBase + template <> + struct LowLevelILInstructionAccessor : public LowLevelILInstructionBase { LowLevelILInstruction GetConditionExpr() const { return GetRawOperandAsExpr(0); } size_t GetTrueTarget() const { return GetRawOperandAsIndex(1); } size_t GetFalseTarget() const { return GetRawOperandAsIndex(2); } }; - template <> struct LowLevelILInstructionAccessor: public LowLevelILInstructionBase + template <> + struct LowLevelILInstructionAccessor : public LowLevelILInstructionBase { size_t GetTarget() const { return GetRawOperandAsIndex(0); } }; - template <> struct LowLevelILInstructionAccessor: public LowLevelILInstructionBase + template <> + struct LowLevelILInstructionAccessor : public LowLevelILInstructionBase { BNLowLevelILFlagCondition GetFlagCondition() const { return GetRawOperandAsFlagCondition(0); } uint32_t GetSemanticFlagClass() const { return GetRawOperandAsRegister(1); } }; - template <> struct LowLevelILInstructionAccessor: public LowLevelILInstructionBase + template <> + struct LowLevelILInstructionAccessor : public LowLevelILInstructionBase { uint32_t GetSemanticFlagGroup() const { return GetRawOperandAsRegister(0); } }; - template <> struct LowLevelILInstructionAccessor: public LowLevelILInstructionBase + template <> + struct LowLevelILInstructionAccessor : public LowLevelILInstructionBase { int64_t GetVector() const { return GetRawOperandAsInteger(0); } }; - template <> struct LowLevelILInstructionAccessor: public LowLevelILInstructionBase + template <> + struct LowLevelILInstructionAccessor : public LowLevelILInstructionBase { - LowLevelILSSARegisterList GetOutputSSARegisters() const { return GetRawOperandAsExpr(0).GetRawOperandAsSSARegisterList(1); } + LowLevelILSSARegisterList GetOutputSSARegisters() const + { + return GetRawOperandAsExpr(0).GetRawOperandAsSSARegisterList(1); + } size_t GetDestMemoryVersion() const { return GetRawOperandAsExpr(0).GetRawOperandAsIndex(0); } LowLevelILInstruction GetDestExpr() const { return GetRawOperandAsExpr(1); } SSARegister GetStackSSARegister() const { return GetRawOperandAsExpr(2).GetRawOperandAsSSARegister(0); } size_t GetSourceMemoryVersion() const { return GetRawOperandAsExpr(2).GetRawOperandAsIndex(2); } - LowLevelILInstructionList GetParameterExprs() const { return GetRawOperandAsExpr(3).GetRawOperandAsExprList(0); } + LowLevelILInstructionList GetParameterExprs() const + { + return GetRawOperandAsExpr(3).GetRawOperandAsExprList(0); + } void SetDestMemoryVersion(size_t version) { GetRawOperandAsExpr(0).UpdateRawOperand(0, version); } void SetSourceMemoryVersion(size_t version) { GetRawOperandAsExpr(2).UpdateRawOperand(2, version); } void SetStackSSAVersion(size_t version) { GetRawOperandAsExpr(2).UpdateRawOperand(1, version); } - void SetOutputSSARegisters(const _STD_VECTOR& regs) { GetRawOperandAsExpr(0).UpdateRawOperandAsSSARegisterList(1, regs); } + void SetOutputSSARegisters(const _STD_VECTOR& regs) + { + GetRawOperandAsExpr(0).UpdateRawOperandAsSSARegisterList(1, regs); + } }; - template <> struct LowLevelILInstructionAccessor: public LowLevelILInstructionBase + template <> + struct LowLevelILInstructionAccessor : public LowLevelILInstructionBase { - LowLevelILSSARegisterList GetOutputSSARegisters() const { return GetRawOperandAsExpr(0).GetRawOperandAsSSARegisterList(1); } + LowLevelILSSARegisterList GetOutputSSARegisters() const + { + return GetRawOperandAsExpr(0).GetRawOperandAsSSARegisterList(1); + } size_t GetDestMemoryVersion() const { return GetRawOperandAsExpr(0).GetRawOperandAsIndex(0); } SSARegister GetStackSSARegister() const { return GetRawOperandAsExpr(1).GetRawOperandAsSSARegister(0); } size_t GetSourceMemoryVersion() const { return GetRawOperandAsExpr(1).GetRawOperandAsIndex(2); } - LowLevelILInstructionList GetParameterExprs() const { return GetRawOperandAsExpr(2).GetRawOperandAsExprList(0); } + LowLevelILInstructionList GetParameterExprs() const + { + return GetRawOperandAsExpr(2).GetRawOperandAsExprList(0); + } void SetDestMemoryVersion(size_t version) { GetRawOperandAsExpr(0).UpdateRawOperand(0, version); } void SetSourceMemoryVersion(size_t version) { GetRawOperandAsExpr(1).UpdateRawOperand(2, version); } void SetStackSSAVersion(size_t version) { GetRawOperandAsExpr(1).UpdateRawOperand(1, version); } - void SetOutputSSARegisters(const _STD_VECTOR& regs) { GetRawOperandAsExpr(0).UpdateRawOperandAsSSARegisterList(1, regs); } + void SetOutputSSARegisters(const _STD_VECTOR& regs) + { + GetRawOperandAsExpr(0).UpdateRawOperandAsSSARegisterList(1, regs); + } }; - template <> struct LowLevelILInstructionAccessor: public LowLevelILInstructionBase + template <> + struct LowLevelILInstructionAccessor : public LowLevelILInstructionBase { - LowLevelILSSARegisterList GetOutputSSARegisters() const { return GetRawOperandAsExpr(0).GetRawOperandAsSSARegisterList(1); } + LowLevelILSSARegisterList GetOutputSSARegisters() const + { + return GetRawOperandAsExpr(0).GetRawOperandAsSSARegisterList(1); + } size_t GetDestMemoryVersion() const { return GetRawOperandAsExpr(0).GetRawOperandAsIndex(0); } LowLevelILInstruction GetDestExpr() const { return GetRawOperandAsExpr(1); } SSARegister GetStackSSARegister() const { return GetRawOperandAsExpr(2).GetRawOperandAsSSARegister(0); } size_t GetSourceMemoryVersion() const { return GetRawOperandAsExpr(2).GetRawOperandAsIndex(2); } - LowLevelILInstructionList GetParameterExprs() const { return GetRawOperandAsExpr(3).GetRawOperandAsExprList(0); } + LowLevelILInstructionList GetParameterExprs() const + { + return GetRawOperandAsExpr(3).GetRawOperandAsExprList(0); + } void SetDestMemoryVersion(size_t version) { GetRawOperandAsExpr(0).UpdateRawOperand(0, version); } void SetSourceMemoryVersion(size_t version) { GetRawOperandAsExpr(2).UpdateRawOperand(2, version); } void SetStackSSAVersion(size_t version) { GetRawOperandAsExpr(2).UpdateRawOperand(1, version); } - void SetOutputSSARegisters(const _STD_VECTOR& regs) { GetRawOperandAsExpr(0).UpdateRawOperandAsSSARegisterList(1, regs); } + void SetOutputSSARegisters(const _STD_VECTOR& regs) + { + GetRawOperandAsExpr(0).UpdateRawOperandAsSSARegisterList(1, regs); + } }; - template <> struct LowLevelILInstructionAccessor: public LowLevelILInstructionBase + template <> + struct LowLevelILInstructionAccessor : public LowLevelILInstructionBase { - LowLevelILRegisterOrFlagList GetOutputRegisterOrFlagList() const { return GetRawOperandAsRegisterOrFlagList(0); } + LowLevelILRegisterOrFlagList GetOutputRegisterOrFlagList() const + { + return GetRawOperandAsRegisterOrFlagList(0); + } uint32_t GetIntrinsic() const { return GetRawOperandAsRegister(2); } - LowLevelILInstructionList GetParameterExprs() const { return GetRawOperandAsExpr(3).GetRawOperandAsExprList(0); } + LowLevelILInstructionList GetParameterExprs() const + { + return GetRawOperandAsExpr(3).GetRawOperandAsExprList(0); + } }; - template <> struct LowLevelILInstructionAccessor: public LowLevelILInstructionBase + template <> + struct LowLevelILInstructionAccessor : public LowLevelILInstructionBase { - LowLevelILSSARegisterOrFlagList GetOutputSSARegisterOrFlagList() const { return GetRawOperandAsSSARegisterOrFlagList(0); } + LowLevelILSSARegisterOrFlagList GetOutputSSARegisterOrFlagList() const + { + return GetRawOperandAsSSARegisterOrFlagList(0); + } uint32_t GetIntrinsic() const { return GetRawOperandAsRegister(2); } - LowLevelILInstructionList GetParameterExprs() const { return GetRawOperandAsExpr(3).GetRawOperandAsExprList(0); } - void SetOutputSSARegisterOrFlagList(const _STD_VECTOR& outputs) { UpdateRawOperandAsSSARegisterOrFlagList(0, outputs); } + LowLevelILInstructionList GetParameterExprs() const + { + return GetRawOperandAsExpr(3).GetRawOperandAsExprList(0); + } + void SetOutputSSARegisterOrFlagList(const _STD_VECTOR& outputs) + { + UpdateRawOperandAsSSARegisterOrFlagList(0, outputs); + } }; - template <> struct LowLevelILInstructionAccessor: public LowLevelILInstructionBase + template <> + struct LowLevelILInstructionAccessor : public LowLevelILInstructionBase { SSARegister GetDestSSARegister() const { return GetRawOperandAsSSARegister(0); } LowLevelILSSARegisterList GetSourceSSARegisters() const { return GetRawOperandAsSSARegisterList(2); } }; - template <> struct LowLevelILInstructionAccessor: public LowLevelILInstructionBase + template <> + struct LowLevelILInstructionAccessor : public LowLevelILInstructionBase { SSARegisterStack GetDestSSARegisterStack() const { return GetRawOperandAsSSARegisterStack(0); } - LowLevelILSSARegisterStackList GetSourceSSARegisterStacks() const { return GetRawOperandAsSSARegisterStackList(2); } + LowLevelILSSARegisterStackList GetSourceSSARegisterStacks() const + { + return GetRawOperandAsSSARegisterStackList(2); + } }; - template <> struct LowLevelILInstructionAccessor: public LowLevelILInstructionBase + template <> + struct LowLevelILInstructionAccessor : public LowLevelILInstructionBase { SSAFlag GetDestSSAFlag() const { return GetRawOperandAsSSAFlag(0); } LowLevelILSSAFlagList GetSourceSSAFlags() const { return GetRawOperandAsSSAFlagList(2); } }; - template <> struct LowLevelILInstructionAccessor: public LowLevelILInstructionBase + template <> + struct LowLevelILInstructionAccessor : public LowLevelILInstructionBase { size_t GetDestMemoryVersion() const { return GetRawOperandAsIndex(0); } LowLevelILIndexList GetSourceMemoryVersions() const { return GetRawOperandAsIndexList(1); } }; - template <> struct LowLevelILInstructionAccessor: public LowLevelILConstantInstruction + template <> + struct LowLevelILInstructionAccessor : public LowLevelILConstantInstruction { size_t GetConstant() const { return GetRawOperandAsIndex(0); } size_t GetOffset() const { return GetRawOperandAsIndex(1); } }; - template <> struct LowLevelILInstructionAccessor: public LowLevelILInstructionBase {}; - template <> struct LowLevelILInstructionAccessor: public LowLevelILInstructionBase {}; - template <> struct LowLevelILInstructionAccessor: public LowLevelILInstructionBase {}; - template <> struct LowLevelILInstructionAccessor: public LowLevelILInstructionBase {}; - template <> struct LowLevelILInstructionAccessor: public LowLevelILInstructionBase {}; - template <> struct LowLevelILInstructionAccessor: public LowLevelILInstructionBase {}; - template <> struct LowLevelILInstructionAccessor: public LowLevelILInstructionBase {}; - - template <> struct LowLevelILInstructionAccessor: public LowLevelILConstantInstruction {}; - template <> struct LowLevelILInstructionAccessor: public LowLevelILConstantInstruction {}; - template <> struct LowLevelILInstructionAccessor: public LowLevelILConstantInstruction {}; - - template <> struct LowLevelILInstructionAccessor: public LowLevelILTwoOperandInstruction {}; - template <> struct LowLevelILInstructionAccessor: public LowLevelILTwoOperandInstruction {}; - template <> struct LowLevelILInstructionAccessor: public LowLevelILTwoOperandInstruction {}; - template <> struct LowLevelILInstructionAccessor: public LowLevelILTwoOperandInstruction {}; - template <> struct LowLevelILInstructionAccessor: public LowLevelILTwoOperandInstruction {}; - template <> struct LowLevelILInstructionAccessor: public LowLevelILTwoOperandInstruction {}; - template <> struct LowLevelILInstructionAccessor: public LowLevelILTwoOperandInstruction {}; - template <> struct LowLevelILInstructionAccessor: public LowLevelILTwoOperandInstruction {}; - template <> struct LowLevelILInstructionAccessor: public LowLevelILTwoOperandInstruction {}; - template <> struct LowLevelILInstructionAccessor: public LowLevelILTwoOperandInstruction {}; - template <> struct LowLevelILInstructionAccessor: public LowLevelILTwoOperandInstruction {}; - template <> struct LowLevelILInstructionAccessor: public LowLevelILTwoOperandInstruction {}; - template <> struct LowLevelILInstructionAccessor: public LowLevelILTwoOperandInstruction {}; - template <> struct LowLevelILInstructionAccessor: public LowLevelILTwoOperandInstruction {}; - template <> struct LowLevelILInstructionAccessor: public LowLevelILTwoOperandInstruction {}; - template <> struct LowLevelILInstructionAccessor: public LowLevelILTwoOperandInstruction {}; - template <> struct LowLevelILInstructionAccessor: public LowLevelILTwoOperandInstruction {}; - template <> struct LowLevelILInstructionAccessor: public LowLevelILTwoOperandInstruction {}; - template <> struct LowLevelILInstructionAccessor: public LowLevelILTwoOperandInstruction {}; - template <> struct LowLevelILInstructionAccessor: public LowLevelILTwoOperandInstruction {}; - template <> struct LowLevelILInstructionAccessor: public LowLevelILTwoOperandInstruction {}; - template <> struct LowLevelILInstructionAccessor: public LowLevelILTwoOperandInstruction {}; - template <> struct LowLevelILInstructionAccessor: public LowLevelILTwoOperandInstruction {}; - template <> struct LowLevelILInstructionAccessor: public LowLevelILTwoOperandInstruction {}; - template <> struct LowLevelILInstructionAccessor: public LowLevelILTwoOperandInstruction {}; - template <> struct LowLevelILInstructionAccessor: public LowLevelILTwoOperandInstruction {}; - template <> struct LowLevelILInstructionAccessor: public LowLevelILTwoOperandInstruction {}; - template <> struct LowLevelILInstructionAccessor: public LowLevelILTwoOperandInstruction {}; - template <> struct LowLevelILInstructionAccessor: public LowLevelILTwoOperandInstruction {}; - template <> struct LowLevelILInstructionAccessor: public LowLevelILTwoOperandInstruction {}; - template <> struct LowLevelILInstructionAccessor: public LowLevelILTwoOperandInstruction {}; - template <> struct LowLevelILInstructionAccessor: public LowLevelILTwoOperandInstruction {}; - template <> struct LowLevelILInstructionAccessor: public LowLevelILTwoOperandInstruction {}; - template <> struct LowLevelILInstructionAccessor: public LowLevelILTwoOperandInstruction {}; - template <> struct LowLevelILInstructionAccessor: public LowLevelILTwoOperandInstruction {}; - template <> struct LowLevelILInstructionAccessor: public LowLevelILTwoOperandInstruction {}; - template <> struct LowLevelILInstructionAccessor: public LowLevelILTwoOperandInstruction {}; - template <> struct LowLevelILInstructionAccessor: public LowLevelILTwoOperandInstruction {}; - template <> struct LowLevelILInstructionAccessor: public LowLevelILTwoOperandInstruction {}; - template <> struct LowLevelILInstructionAccessor: public LowLevelILTwoOperandInstruction {}; - template <> struct LowLevelILInstructionAccessor: public LowLevelILTwoOperandInstruction {}; - template <> struct LowLevelILInstructionAccessor: public LowLevelILTwoOperandInstruction {}; - template <> struct LowLevelILInstructionAccessor: public LowLevelILTwoOperandInstruction {}; - template <> struct LowLevelILInstructionAccessor: public LowLevelILTwoOperandInstruction {}; - template <> struct LowLevelILInstructionAccessor: public LowLevelILTwoOperandInstruction {}; - - template <> struct LowLevelILInstructionAccessor: public LowLevelILTwoOperandWithCarryInstruction {}; - template <> struct LowLevelILInstructionAccessor: public LowLevelILTwoOperandWithCarryInstruction {}; - template <> struct LowLevelILInstructionAccessor: public LowLevelILTwoOperandWithCarryInstruction {}; - template <> struct LowLevelILInstructionAccessor: public LowLevelILTwoOperandWithCarryInstruction {}; - - template <> struct LowLevelILInstructionAccessor: public LowLevelILOneOperandInstruction {}; - template <> struct LowLevelILInstructionAccessor: public LowLevelILOneOperandInstruction {}; - template <> struct LowLevelILInstructionAccessor: public LowLevelILOneOperandInstruction {}; - template <> struct LowLevelILInstructionAccessor: public LowLevelILOneOperandInstruction {}; - template <> struct LowLevelILInstructionAccessor: public LowLevelILOneOperandInstruction {}; - template <> struct LowLevelILInstructionAccessor: public LowLevelILOneOperandInstruction {}; - template <> struct LowLevelILInstructionAccessor: public LowLevelILOneOperandInstruction {}; - template <> struct LowLevelILInstructionAccessor: public LowLevelILOneOperandInstruction {}; - template <> struct LowLevelILInstructionAccessor: public LowLevelILOneOperandInstruction {}; - template <> struct LowLevelILInstructionAccessor: public LowLevelILOneOperandInstruction {}; - template <> struct LowLevelILInstructionAccessor: public LowLevelILOneOperandInstruction {}; - template <> struct LowLevelILInstructionAccessor: public LowLevelILOneOperandInstruction {}; - template <> struct LowLevelILInstructionAccessor: public LowLevelILOneOperandInstruction {}; - template <> struct LowLevelILInstructionAccessor: public LowLevelILOneOperandInstruction {}; - template <> struct LowLevelILInstructionAccessor: public LowLevelILOneOperandInstruction {}; - template <> struct LowLevelILInstructionAccessor: public LowLevelILOneOperandInstruction {}; - template <> struct LowLevelILInstructionAccessor: public LowLevelILOneOperandInstruction {}; - template <> struct LowLevelILInstructionAccessor: public LowLevelILOneOperandInstruction {}; + template <> + struct LowLevelILInstructionAccessor : public LowLevelILInstructionBase + {}; + template <> + struct LowLevelILInstructionAccessor : public LowLevelILInstructionBase + {}; + template <> + struct LowLevelILInstructionAccessor : public LowLevelILInstructionBase + {}; + template <> + struct LowLevelILInstructionAccessor : public LowLevelILInstructionBase + {}; + template <> + struct LowLevelILInstructionAccessor : public LowLevelILInstructionBase + {}; + template <> + struct LowLevelILInstructionAccessor : public LowLevelILInstructionBase + {}; + template <> + struct LowLevelILInstructionAccessor : public LowLevelILInstructionBase + {}; + + template <> + struct LowLevelILInstructionAccessor : public LowLevelILConstantInstruction + {}; + template <> + struct LowLevelILInstructionAccessor : public LowLevelILConstantInstruction + {}; + template <> + struct LowLevelILInstructionAccessor : public LowLevelILConstantInstruction + {}; + + template <> + struct LowLevelILInstructionAccessor : public LowLevelILTwoOperandInstruction + {}; + template <> + struct LowLevelILInstructionAccessor : public LowLevelILTwoOperandInstruction + {}; + template <> + struct LowLevelILInstructionAccessor : public LowLevelILTwoOperandInstruction + {}; + template <> + struct LowLevelILInstructionAccessor : public LowLevelILTwoOperandInstruction + {}; + template <> + struct LowLevelILInstructionAccessor : public LowLevelILTwoOperandInstruction + {}; + template <> + struct LowLevelILInstructionAccessor : public LowLevelILTwoOperandInstruction + {}; + template <> + struct LowLevelILInstructionAccessor : public LowLevelILTwoOperandInstruction + {}; + template <> + struct LowLevelILInstructionAccessor : public LowLevelILTwoOperandInstruction + {}; + template <> + struct LowLevelILInstructionAccessor : public LowLevelILTwoOperandInstruction + {}; + template <> + struct LowLevelILInstructionAccessor : public LowLevelILTwoOperandInstruction + {}; + template <> + struct LowLevelILInstructionAccessor : public LowLevelILTwoOperandInstruction + {}; + template <> + struct LowLevelILInstructionAccessor : public LowLevelILTwoOperandInstruction + {}; + template <> + struct LowLevelILInstructionAccessor : public LowLevelILTwoOperandInstruction + {}; + template <> + struct LowLevelILInstructionAccessor : public LowLevelILTwoOperandInstruction + {}; + template <> + struct LowLevelILInstructionAccessor : public LowLevelILTwoOperandInstruction + {}; + template <> + struct LowLevelILInstructionAccessor : public LowLevelILTwoOperandInstruction + {}; + template <> + struct LowLevelILInstructionAccessor : public LowLevelILTwoOperandInstruction + {}; + template <> + struct LowLevelILInstructionAccessor : public LowLevelILTwoOperandInstruction + {}; + template <> + struct LowLevelILInstructionAccessor : public LowLevelILTwoOperandInstruction + {}; + template <> + struct LowLevelILInstructionAccessor : public LowLevelILTwoOperandInstruction + {}; + template <> + struct LowLevelILInstructionAccessor : public LowLevelILTwoOperandInstruction + {}; + template <> + struct LowLevelILInstructionAccessor : public LowLevelILTwoOperandInstruction + {}; + template <> + struct LowLevelILInstructionAccessor : public LowLevelILTwoOperandInstruction + {}; + template <> + struct LowLevelILInstructionAccessor : public LowLevelILTwoOperandInstruction + {}; + template <> + struct LowLevelILInstructionAccessor : public LowLevelILTwoOperandInstruction + {}; + template <> + struct LowLevelILInstructionAccessor : public LowLevelILTwoOperandInstruction + {}; + template <> + struct LowLevelILInstructionAccessor : public LowLevelILTwoOperandInstruction + {}; + template <> + struct LowLevelILInstructionAccessor : public LowLevelILTwoOperandInstruction + {}; + template <> + struct LowLevelILInstructionAccessor : public LowLevelILTwoOperandInstruction + {}; + template <> + struct LowLevelILInstructionAccessor : public LowLevelILTwoOperandInstruction + {}; + template <> + struct LowLevelILInstructionAccessor : public LowLevelILTwoOperandInstruction + {}; + template <> + struct LowLevelILInstructionAccessor : public LowLevelILTwoOperandInstruction + {}; + template <> + struct LowLevelILInstructionAccessor : public LowLevelILTwoOperandInstruction + {}; + template <> + struct LowLevelILInstructionAccessor : public LowLevelILTwoOperandInstruction + {}; + template <> + struct LowLevelILInstructionAccessor : public LowLevelILTwoOperandInstruction + {}; + template <> + struct LowLevelILInstructionAccessor : public LowLevelILTwoOperandInstruction + {}; + template <> + struct LowLevelILInstructionAccessor : public LowLevelILTwoOperandInstruction + {}; + template <> + struct LowLevelILInstructionAccessor : public LowLevelILTwoOperandInstruction + {}; + template <> + struct LowLevelILInstructionAccessor : public LowLevelILTwoOperandInstruction + {}; + template <> + struct LowLevelILInstructionAccessor : public LowLevelILTwoOperandInstruction + {}; + template <> + struct LowLevelILInstructionAccessor : public LowLevelILTwoOperandInstruction + {}; + template <> + struct LowLevelILInstructionAccessor : public LowLevelILTwoOperandInstruction + {}; + template <> + struct LowLevelILInstructionAccessor : public LowLevelILTwoOperandInstruction + {}; + template <> + struct LowLevelILInstructionAccessor : public LowLevelILTwoOperandInstruction + {}; + template <> + struct LowLevelILInstructionAccessor : public LowLevelILTwoOperandInstruction + {}; + + template <> + struct LowLevelILInstructionAccessor : public LowLevelILTwoOperandWithCarryInstruction + {}; + template <> + struct LowLevelILInstructionAccessor : public LowLevelILTwoOperandWithCarryInstruction + {}; + template <> + struct LowLevelILInstructionAccessor : public LowLevelILTwoOperandWithCarryInstruction + {}; + template <> + struct LowLevelILInstructionAccessor : public LowLevelILTwoOperandWithCarryInstruction + {}; + + template <> + struct LowLevelILInstructionAccessor : public LowLevelILOneOperandInstruction + {}; + template <> + struct LowLevelILInstructionAccessor : public LowLevelILOneOperandInstruction + {}; + template <> + struct LowLevelILInstructionAccessor : public LowLevelILOneOperandInstruction + {}; + template <> + struct LowLevelILInstructionAccessor : public LowLevelILOneOperandInstruction + {}; + template <> + struct LowLevelILInstructionAccessor : public LowLevelILOneOperandInstruction + {}; + template <> + struct LowLevelILInstructionAccessor : public LowLevelILOneOperandInstruction + {}; + template <> + struct LowLevelILInstructionAccessor : public LowLevelILOneOperandInstruction + {}; + template <> + struct LowLevelILInstructionAccessor : public LowLevelILOneOperandInstruction + {}; + template <> + struct LowLevelILInstructionAccessor : public LowLevelILOneOperandInstruction + {}; + template <> + struct LowLevelILInstructionAccessor : public LowLevelILOneOperandInstruction + {}; + template <> + struct LowLevelILInstructionAccessor : public LowLevelILOneOperandInstruction + {}; + template <> + struct LowLevelILInstructionAccessor : public LowLevelILOneOperandInstruction + {}; + template <> + struct LowLevelILInstructionAccessor : public LowLevelILOneOperandInstruction + {}; + template <> + struct LowLevelILInstructionAccessor : public LowLevelILOneOperandInstruction + {}; + template <> + struct LowLevelILInstructionAccessor : public LowLevelILOneOperandInstruction + {}; + template <> + struct LowLevelILInstructionAccessor : public LowLevelILOneOperandInstruction + {}; + template <> + struct LowLevelILInstructionAccessor : public LowLevelILOneOperandInstruction + {}; + template <> + struct LowLevelILInstructionAccessor : public LowLevelILOneOperandInstruction + {}; #undef _STD_VECTOR #undef _STD_SET #undef _STD_UNORDERED_MAP #undef _STD_MAP -} +} // namespace BinaryNinjaCore -- cgit v1.3.1