Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
483 changes: 258 additions & 225 deletions highlevelilinstruction.cpp

Large diffs are not rendered by default.

27 changes: 12 additions & 15 deletions highlevelilinstruction.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ namespace BinaryNinja
/*!
\ingroup highlevelil
*/
enum HighLevelILOperandType
enum HighLevelILOperandType : uint8_t
{
IntegerHighLevelOperand,
ConstantDataHighLevelOperand,
Expand All @@ -79,7 +79,7 @@ namespace BinaryNinja
/*!
\ingroup highlevelil
*/
enum HighLevelILOperandUsage
enum HighLevelILOperandUsage : uint8_t
{
SourceExprHighLevelOperandUsage,
VariableHighLevelOperandUsage,
Expand Down Expand Up @@ -358,10 +358,6 @@ namespace BinaryNinja
size_t exprIndex, instructionIndex;
bool ast;

static _STD_UNORDERED_MAP<HighLevelILOperandUsage, HighLevelILOperandType> operandTypeForUsage;
static _STD_UNORDERED_MAP<BNHighLevelILOperation, _STD_VECTOR<HighLevelILOperandUsage>> operationOperandUsage;
static _STD_UNORDERED_MAP<BNHighLevelILOperation, _STD_UNORDERED_MAP<HighLevelILOperandUsage, size_t>>
operationOperandIndex;

HighLevelILOperandList GetOperands() const;

Expand Down Expand Up @@ -856,28 +852,29 @@ namespace BinaryNinja
typedef value_type reference;

const HighLevelILOperandList* owner;
_STD_VECTOR<HighLevelILOperandUsage>::const_iterator pos;
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; }
size_t index;
constexpr bool operator==(const ListIterator& a) const { return index == a.index; }
constexpr auto operator<=>(const ListIterator& a) const { return index <=> a.index; }
ListIterator& operator++()
{
++pos;
++index;
return *this;
}
const HighLevelILOperand operator*();
};

HighLevelILInstruction m_instr;
const _STD_VECTOR<HighLevelILOperandUsage>& m_usageList;
const _STD_UNORDERED_MAP<HighLevelILOperandUsage, size_t>& m_operandIndexMap;
const HighLevelILOperandUsage* m_usages;
const uint8_t* m_indices;
uint8_t m_count;

public:
typedef ListIterator const_iterator;

HighLevelILOperandList(const HighLevelILInstruction& instr,
const _STD_VECTOR<HighLevelILOperandUsage>& usageList,
const _STD_UNORDERED_MAP<HighLevelILOperandUsage, size_t>& operandIndexMap);
const HighLevelILOperandUsage* usages,
const uint8_t* indices,
uint8_t count);

const_iterator begin() const;
const_iterator end() const;
Expand Down
626 changes: 328 additions & 298 deletions lowlevelilinstruction.cpp

Large diffs are not rendered by default.

27 changes: 11 additions & 16 deletions lowlevelilinstruction.h
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ namespace BinaryNinja
/*!
\ingroup lowlevelil
*/
enum LowLevelILOperandType
enum LowLevelILOperandType : uint8_t
{
IntegerLowLevelOperand,
IndexLowLevelOperand,
Expand Down Expand Up @@ -192,7 +192,7 @@ namespace BinaryNinja
/*!
\ingroup lowlevelil
*/
enum LowLevelILOperandUsage
enum LowLevelILOperandUsage : uint8_t
{
SourceExprLowLevelOperandUsage,
SourceRegisterLowLevelOperandUsage,
Expand Down Expand Up @@ -750,11 +750,6 @@ namespace BinaryNinja
#endif
size_t exprIndex, instructionIndex;

static _STD_UNORDERED_MAP<LowLevelILOperandUsage, LowLevelILOperandType> operandTypeForUsage;
static _STD_UNORDERED_MAP<BNLowLevelILOperation, _STD_VECTOR<LowLevelILOperandUsage>> operationOperandUsage;
static _STD_UNORDERED_MAP<BNLowLevelILOperation, _STD_UNORDERED_MAP<LowLevelILOperandUsage, size_t>>
operationOperandIndex;

LowLevelILOperandList GetOperands() const;

uint64_t GetRawOperandAsInteger(size_t operand) const;
Expand Down Expand Up @@ -1290,27 +1285,27 @@ namespace BinaryNinja
typedef value_type reference;

const LowLevelILOperandList* owner;
_STD_VECTOR<LowLevelILOperandUsage>::const_iterator pos;
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; }
size_t index;
constexpr bool operator==(const ListIterator& a) const { return index == a.index; }
constexpr auto operator<=>(const ListIterator& a) const { return index <=> a.index; }
ListIterator& operator++()
{
++pos;
++index;
return *this;
}
const LowLevelILOperand operator*();
};

LowLevelILInstruction m_instr;
const _STD_VECTOR<LowLevelILOperandUsage>& m_usageList;
const _STD_UNORDERED_MAP<LowLevelILOperandUsage, size_t>& m_operandIndexMap;
const LowLevelILOperandUsage* m_usages;
const uint8_t* m_indices;
uint8_t m_count;

public:
typedef ListIterator const_iterator;

LowLevelILOperandList(const LowLevelILInstruction& instr, const _STD_VECTOR<LowLevelILOperandUsage>& usageList,
const _STD_UNORDERED_MAP<LowLevelILOperandUsage, size_t>& operandIndexMap);
LowLevelILOperandList(const LowLevelILInstruction& instr, const LowLevelILOperandUsage* usages,
const uint8_t* indices, uint8_t count);

const_iterator begin() const;
const_iterator end() const;
Expand Down
Loading
Loading