diff options
Diffstat (limited to 'src/disasm.h')
-rw-r--r-- | src/disasm.h | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/src/disasm.h b/src/disasm.h index a3c589b..39af8e3 100644 --- a/src/disasm.h +++ b/src/disasm.h @@ -42,9 +42,9 @@ static constexpr uint32_t AlignInstructionAddress(const uint32_t address) } struct DisasmNode { - const NodeType type{}; + NodeType type{}; /// Address of the instruction (PC value basically) - const uint32_t address{}; + uint32_t address{}; /// Instruction size in bytes size_t size{selectSize(type, kInstructionSizeStepBytes)}; /// Indicates whether `ref_addr` should be interpreted and how @@ -105,6 +105,7 @@ struct DisasmNode { size_t Disasm(const DataView &code, const Settings &); size_t DisasmAsRaw(const DataView &code); void AddReferencedBy(uint32_t address, ReferenceType); + void RemoveReferencedBy(uint32_t address); bool IsYetToBeHandled(DisasmMapType dmtype) { return op.opcode == OpCode::kNone || @@ -176,8 +177,19 @@ class DisasmMap { uint32_t address, bool return_last_considered=false) const; DisasmNode &insertNode(uint32_t address, NodeType); DisasmNode &insertNodeQuickPeek(uint32_t address, NodeType); - /// Returns primary, secondary ceases to exist - DisasmNode *mergeNodes(DisasmNode *primary, DisasmNode *secondary); + /** Merges \p secondary node with the \p primary node on the overlapping + * span. + * + * If \p primary and \p secondary nodes overlap, then all the overlapping + * address space of the target machine becomes assigned to \p primary node. + * If \p primary node fully contains the space that belongs to \p secondary + * node, then \p secondary node ceases to exist after the merge. All the + * references pointing at the overlapping space are transferred from \p + * secondary to \p primary node. + * + * \returns \p primary literally, so it is never reallocated. + */ + DisasmNode *mergeNodeOverlappingSpace(DisasmNode *primary, DisasmNode *secondary); DisasmNode &insertReferencedBy( const uint32_t by_addr, const uint32_t ref_addr, |