ROSE 0.11.145.272
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#ifdef ROSE_ENABLE_BOOST_SERIALIZATION
10#include <boost/serialization/access.hpp>
11#include <boost/serialization/base_object.hpp>
12#include <boost/serialization/export.hpp>
13#endif
14
15namespace Rose {
16namespace BinaryAnalysis {
17namespace InstructionSemantics {
18namespace BaseSemantics {
19
24public:
27
30
31protected:
32 MemoryCellPtr protocell; // prototypical memory cell used for its virtual constructors
33 MemoryCellPtr latestWrittenCell_; // the cell whose value was most recently written to, if any
34
35#ifdef ROSE_ENABLE_BOOST_SERIALIZATION
36private:
37 friend class boost::serialization::access;
38
39 template<class S>
40 void serialize(S &s, const unsigned /*version*/) {
41 s & BOOST_SERIALIZATION_BASE_OBJECT_NVP(MemoryState);
42 s & BOOST_SERIALIZATION_NVP(protocell);
43 s & BOOST_SERIALIZATION_NVP(latestWrittenCell_);
44 }
45#endif
46
47protected:
48 MemoryCellState(); // for serialization
49
50 explicit MemoryCellState(const MemoryCellPtr &protocell);
51
52 MemoryCellState(const SValuePtr &addrProtoval, const SValuePtr &valProtoval);
53
54 MemoryCellState(const MemoryCellState &other);
55
56public:
58
59public:
63
64public:
65 virtual void clear() override;
66
67public:
72 virtual void latestWrittenCell(const MemoryCellPtr&);
81 virtual AddressSet getWritersUnion(const SValuePtr &addr, size_t nBits, RiscOperators *addrOps,
82 RiscOperators *valOps) = 0;
83
90 virtual AddressSet getWritersIntersection(const SValuePtr &addr, size_t nBits, RiscOperators *addrOps,
91 RiscOperators *valOps) = 0;
92
96 virtual std::vector<MemoryCellPtr> matchingCells(MemoryCell::Predicate&) const = 0;
97
103 virtual std::vector<MemoryCellPtr> leadingCells(MemoryCell::Predicate&) const = 0;
104
109
115
119 virtual void traverse(MemoryCell::Visitor&) = 0;
120
126 virtual void updateReadProperties(const CellList&);
127
133
136
138 std::vector<MemoryCellPtr> allCells() const;
139};
140
141} // namespace
142} // namespace
143} // namespace
144} // namespace
145
146#ifdef ROSE_ENABLE_BOOST_SERIALIZATION
148#endif
149
150#endif
151#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:280
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.