From 9aa54ef6723ad06b019c02c22b574516dca6289b Mon Sep 17 00:00:00 2001 From: Peter LaFosse Date: Mon, 21 Oct 2024 10:55:45 -0400 Subject: Linear view function regions collapse Update collapse code to support PseudoC --- highlevelilinstruction.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'highlevelilinstruction.h') diff --git a/highlevelilinstruction.h b/highlevelilinstruction.h index be6f8b43..25c639ec 100644 --- a/highlevelilinstruction.h +++ b/highlevelilinstruction.h @@ -388,6 +388,17 @@ namespace BinaryNinja bool HasParent() const; HighLevelILInstruction GetParent() const; + uint64_t GetInstructionHash(size_t discriminator = 0) const + { + constexpr auto rotl = [](uint64_t value, int shift) + { return (value << shift) | (value >> (64 - shift)); }; + std::hash hasher; + uint64_t hash = hasher(operation); + hash ^= rotl(hasher(address), 23); + hash ^= rotl(hasher(discriminator), 47); + + return hash; + } template HighLevelILInstructionAccessor& As() @@ -764,6 +775,7 @@ namespace BinaryNinja size_t GetSourceMemoryVersion() const; HighLevelILIndexList GetSourceMemoryVersions() const; size_t GetDestMemoryVersion() const; + static bool CanCollapse(int operand); }; /*! -- cgit v1.3.1