1 #ifndef ROSE_BinaryAnalysis_InstructionSemantics_BaseSemantics_MemoryCellMap_H
2 #define ROSE_BinaryAnalysis_InstructionSemantics_BaseSemantics_MemoryCellMap_H
3 #include <featureTests.h>
4 #ifdef ROSE_ENABLE_BINARY_ANALYSIS
6 #include <Rose/BinaryAnalysis/InstructionSemantics/BaseSemantics/BasicTypes.h>
7 #include <Rose/BinaryAnalysis/InstructionSemantics/BaseSemantics/MemoryCellState.h>
9 #include <Sawyer/Map.h>
11 #include <boost/serialization/access.hpp>
12 #include <boost/serialization/base_object.hpp>
13 #include <boost/serialization/export.hpp>
16 namespace BinaryAnalysis {
17 namespace InstructionSemantics {
48 uint32_t lastPosition_ = 0;
53 #ifdef ROSE_HAVE_BOOST_SERIALIZATION_LIB
55 friend class boost::serialization::access;
58 void serialize(S &s,
const unsigned ) {
60 s & BOOST_SERIALIZATION_NVP(cells);
68 : MemoryCellState(protocell) {}
71 : MemoryCellState(addrProtoval, valProtoval) {}
73 MemoryCellMap(
const MemoryCellMap&);
76 MemoryCellMap& operator=(MemoryCellMap&) ;
82 MemoryCellMapPtr retval = boost::dynamic_pointer_cast<
MemoryCellMap>(x);
83 ASSERT_not_null(retval);
108 virtual void clear()
override;
129 unsigned nextPosition();
132 unsigned lastPosition()
const;
133 void lastPosition(
unsigned);
141 #ifdef ROSE_HAVE_BOOST_SERIALIZATION_LIB
virtual CellKey generateCellKey(const SValuePtr &address) const =0
Generate a cell lookup key.
Base classes for instruction semantics.
virtual void clear() override
Clear memory.
virtual void eraseMatchingCells(MemoryCell::Predicate &) override
Remove all matching cells.
virtual bool isAllPresent(const SValuePtr &address, size_t nBytes, RiscOperators *addrOps) const
Predicate to determine whether all bytes are present.
boost::shared_ptr< class MemoryCellMap > MemoryCellMapPtr
Shared-ownership pointer to a map-based memory state.
virtual std::vector< MemoryCellPtr > leadingCells(MemoryCell::Predicate &) const override
Find leading matching cells.
virtual AddressSet getWritersUnion(const SValuePtr &addr, size_t nBits, RiscOperators *addrOps, RiscOperators *valOps) override
Writers for an address.
virtual SValuePtr peekMemory(const SValuePtr &address, const SValuePtr &dflt, RiscOperators *addrOps, RiscOperators *valOps) override
Read a value from memory without side effects.
virtual SValuePtr readMemory(const SValuePtr &address, const SValuePtr &dflt, RiscOperators *addrOps, RiscOperators *valOps) override
Read a value from memory.
Simple map-based memory state.
Main namespace for the ROSE library.
virtual void traverse(MemoryCell::Visitor &) override
Traverse and modify cells.
boost::shared_ptr< MemoryCell > MemoryCellPtr
Shared-ownership pointer to a memory cell.
static MemoryCellMapPtr promote(const MemoryStatePtr &x)
Promote a base memory state pointer to a MemoryCellMap pointer.
virtual void writeMemory(const SValuePtr &address, const SValuePtr &value, RiscOperators *addrOps, RiscOperators *valOps) override
Write a value to memory.
virtual void eraseLeadingCells(MemoryCell::Predicate &) override
Remove leading matching cells.
boost::shared_ptr< MemoryState > MemoryStatePtr
Shared-ownership pointer to a memory state.
Sawyer::Container::Map< CellKey, MemoryCellPtr > CellMap
Map of memory cells indexed by cell keys.
virtual void hash(Combinatorics::Hasher &, RiscOperators *addrOps, RiscOperators *valOps) const override
Calculate a hash for this memory state.
virtual std::vector< MemoryCellPtr > matchingCells(MemoryCell::Predicate &) const override
Find all matching cells.
uint64_t CellKey
Key used to look up memory cells.
Sawyer::SharedPointer< SValue > SValuePtr
Shared-ownership pointer to a semantic value in any domain.
MemoryCellMapPtr Ptr
Shared-ownership pointer.
virtual bool merge(const MemoryStatePtr &other, RiscOperators *addrOps, RiscOperators *valOps) override
Merge memory states for data flow analysis.
virtual void print(std::ostream &, Formatter &) const override
Print a memory state to more than one line of output.
Predicate for matching cells.
Base class for most instruction semantics RISC operators.
Visitor for traversing a cells.
virtual MemoryCellPtr findCell(const SValuePtr &addr) const
Look up memory cell for address.
virtual AddressSet getWritersIntersection(const SValuePtr &addr, size_t nBits, RiscOperators *addrOps, RiscOperators *valOps) override
Writers for an address.