1 #ifndef ROSE_BinaryAnalysis_InstructionSemantics2_MemoryCellState_H
2 #define ROSE_BinaryAnalysis_InstructionSemantics2_MemoryCellState_H
3 #include <featureTests.h>
4 #ifdef ROSE_ENABLE_BINARY_ANALYSIS
6 #include <BaseSemantics2.h>
7 #include <MemoryCell.h>
9 #include <boost/serialization/access.hpp>
10 #include <boost/serialization/base_object.hpp>
11 #include <boost/serialization/export.hpp>
15 namespace InstructionSemantics2 {
29 #ifdef ROSE_HAVE_BOOST_SERIALIZATION_LIB
31 friend class boost::serialization::access;
34 void serialize(S &s,
const unsigned ) {
35 s & BOOST_SERIALIZATION_BASE_OBJECT_NVP(MemoryState);
36 s & BOOST_SERIALIZATION_NVP(protocell);
37 s & BOOST_SERIALIZATION_NVP(latestWrittenCell_);
45 : MemoryState(protocell->get_address(), protocell->get_value()), protocell(protocell) {}
48 : MemoryState(addrProtoval, valProtoval), protocell(
MemoryCell::instance(addrProtoval, valProtoval)) {}
51 : MemoryState(other), protocell(other.protocell) {}
57 MemoryCellStatePtr retval = boost::dynamic_pointer_cast<
MemoryCellState>(m);
58 ASSERT_not_null(retval);
63 virtual void clear() ROSE_OVERRIDE;
70 return latestWrittenCell_;
73 latestWrittenCell_ = cell;
139 #ifdef ROSE_HAVE_BOOST_SERIALIZATION_LIB
boost::shared_ptr< class MemoryCell > MemoryCellPtr
Shared-ownership pointer to a semantic memory cell.
virtual std::vector< MemoryCellPtr > leadingCells(const MemoryCell::Predicate &) const =0
Find leading matching cells.
Predicate that always returns true.
Predicate for non-written cells.
boost::shared_ptr< class MemoryCellState > MemoryCellStatePtr
Shared-ownership pointer to a cell-based memory state.
std::vector< MemoryCellPtr > allCells() const
All cells.
boost::shared_ptr< MemoryState > MemoryStatePtr
Shared-ownership pointer to a memory state.
Main namespace for the ROSE library.
Predicate for matching cells.
Base classes for instruction semantics.
virtual MemoryCell::AddressSet getWritersIntersection(const SValuePtr &addr, size_t nBits, RiscOperators *addrOps, RiscOperators *valOps)=0
Writers for an address.
virtual void eraseMatchingCells(const MemoryCell::Predicate &)=0
Remove all matching cells.
virtual void eraseLeadingCells(const MemoryCell::Predicate &)=0
Remove leading matching cells.
virtual std::vector< MemoryCellPtr > matchingCells(const MemoryCell::Predicate &) const =0
Find all matching cells.
Base class for most instruction semantics RISC operators.
static MemoryCellPtr instance(const SValuePtr &address, const SValuePtr &value)
Instantiates a new memory cell object with the specified address and value.
virtual void latestWrittenCell(const MemoryCellPtr &cell)
Property: Cell most recently written.
virtual void traverse(MemoryCell::Visitor &)=0
Traverse and modify cells.
static MemoryCellStatePtr promote(const BaseSemantics::MemoryStatePtr &m)
Promote a base memory state pointer to a BaseSemantics::MemoryCellState pointer.
Visitor for traversing a cells.
virtual MemoryCell::AddressSet getWritersUnion(const SValuePtr &addr, size_t nBits, RiscOperators *addrOps, RiscOperators *valOps)=0
Writers for an address.
virtual MemoryCellPtr latestWrittenCell() const
Property: Cell most recently written.
void eraseNonWritten()
Erase cells that have no writers.