ROSE 0.11.145.192
BaseSemantics/MemoryCellState.h
1#ifndef ROSE_BinaryAnalysis_InstructionSemantics_BaseSemantics_MemoryCellState_H
2#define ROSE_BinaryAnalysis_InstructionSemantics_BaseSemantics_MemoryCellState_H
3#include <featureTests.h>
4#ifdef ROSE_ENABLE_BINARY_ANALYSIS
5
6#include <Rose/BinaryAnalysis/InstructionSemantics/BaseSemantics/MemoryCell.h>
7#include <Rose/BinaryAnalysis/InstructionSemantics/BaseSemantics/MemoryState.h>
8
9#include <boost/serialization/access.hpp>
10#include <boost/serialization/base_object.hpp>
11#include <boost/serialization/export.hpp>
12
13namespace Rose {
14namespace BinaryAnalysis {
15namespace InstructionSemantics {
16namespace BaseSemantics {
17
22public:
25
28
29protected:
30 MemoryCellPtr protocell; // prototypical memory cell used for its virtual constructors
31 MemoryCellPtr latestWrittenCell_; // the cell whose value was most recently written to, if any
32
33#ifdef ROSE_HAVE_BOOST_SERIALIZATION_LIB
34private:
35 friend class boost::serialization::access;
36
37 template<class S>
38 void serialize(S &s, const unsigned /*version*/) {
39 s & BOOST_SERIALIZATION_BASE_OBJECT_NVP(MemoryState);
40 s & BOOST_SERIALIZATION_NVP(protocell);
41 s & BOOST_SERIALIZATION_NVP(latestWrittenCell_);
42 }
43#endif
44
45protected:
46 MemoryCellState(); // for serialization
47
48 explicit MemoryCellState(const MemoryCellPtr &protocell);
49
50 MemoryCellState(const SValuePtr &addrProtoval, const SValuePtr &valProtoval);
51
52 MemoryCellState(const MemoryCellState &other);
53
54public:
56
57public:
61
62public:
63 virtual void clear() override;
64
65public:
70 virtual void latestWrittenCell(const MemoryCellPtr&);
79 virtual AddressSet getWritersUnion(const SValuePtr &addr, size_t nBits, RiscOperators *addrOps,
80 RiscOperators *valOps) = 0;
81
88 virtual AddressSet getWritersIntersection(const SValuePtr &addr, size_t nBits, RiscOperators *addrOps,
89 RiscOperators *valOps) = 0;
90
94 virtual std::vector<MemoryCellPtr> matchingCells(MemoryCell::Predicate&) const = 0;
95
101 virtual std::vector<MemoryCellPtr> leadingCells(MemoryCell::Predicate&) const = 0;
102
107
113
117 virtual void traverse(MemoryCell::Visitor&) = 0;
118
124 virtual void updateReadProperties(const CellList&);
125
131
134
136 std::vector<MemoryCellPtr> allCells() const;
137};
138
139} // namespace
140} // namespace
141} // namespace
142} // namespace
143
144#ifdef ROSE_HAVE_BOOST_SERIALIZATION_LIB
146#endif
147
148#endif
149#endif
virtual std::vector< MemoryCellPtr > matchingCells(MemoryCell::Predicate &) const =0
Find all matching cells.
virtual void updateReadProperties(const CellList &)
Adjust I/O properties after reading memory.
virtual AddressSet getWritersIntersection(const SValuePtr &addr, size_t nBits, RiscOperators *addrOps, RiscOperators *valOps)=0
Writers for an address.
virtual MemoryCellPtr latestWrittenCell() const
Property: Cell most recently written.
virtual void eraseMatchingCells(MemoryCell::Predicate &)=0
Remove all matching cells.
virtual void eraseLeadingCells(MemoryCell::Predicate &)=0
Remove leading matching cells.
virtual void updateWriteProperties(const CellList &, InputOutputPropertySet)
Adjust I/O properties after writing memory.
virtual std::vector< MemoryCellPtr > leadingCells(MemoryCell::Predicate &) const =0
Find leading matching cells.
virtual void traverse(MemoryCell::Visitor &)=0
Traverse and modify cells.
virtual AddressSet getWritersUnion(const SValuePtr &addr, size_t nBits, RiscOperators *addrOps, RiscOperators *valOps)=0
Writers for an address.
virtual void latestWrittenCell(const MemoryCellPtr &)
Property: Cell most recently written.
static MemoryCellStatePtr promote(const BaseSemantics::AddressSpacePtr &)
Promote a base address space pointer to a BaseSemantics::MemoryCellState pointer.
Base class for most instruction semantics RISC operators.
Base classes for instruction semantics.
boost::shared_ptr< MemoryCell > MemoryCellPtr
Shared-ownership pointer to a memory cell.
std::list< MemoryCellPtr > CellList
List of memory cells.
Definition MemoryCell.h:276
boost::shared_ptr< class MemoryCellState > MemoryCellStatePtr
Shared-ownership pointer to a cell-based memory state.
boost::shared_ptr< AddressSpace > AddressSpacePtr
Shared-ownership pointer for AddressSpace objects.
The ROSE library.