1 #ifndef ROSE_BinaryAnalysis_InstructionSemantics_BaseSemantics_MemoryCell_H
2 #define ROSE_BinaryAnalysis_InstructionSemantics_BaseSemantics_MemoryCell_H
3 #include <featureTests.h>
4 #ifdef ROSE_ENABLE_BINARY_ANALYSIS
6 #include <Rose/BinaryAnalysis/InstructionSemantics/BaseSemantics/BasicTypes.h>
8 #include <Sawyer/Set.h>
10 #include <boost/enable_shared_from_this.hpp>
11 #include <boost/serialization/access.hpp>
12 #include <boost/serialization/export.hpp>
13 #include <boost/serialization/list.hpp>
17 namespace BinaryAnalysis {
18 namespace InstructionSemantics {
29 class MemoryCell:
public boost::enable_shared_from_this<MemoryCell> {
73 unsigned position_ = 0;
77 #ifdef ROSE_HAVE_BOOST_SERIALIZATION_LIB
79 friend class boost::serialization::access;
82 void serialize(S &s,
const unsigned version) {
83 s & BOOST_SERIALIZATION_NVP(address_);
84 s & BOOST_SERIALIZATION_NVP(value_);
85 s & BOOST_SERIALIZATION_NVP(writers_);
86 s & BOOST_SERIALIZATION_NVP(ioProperties_);
88 s & BOOST_SERIALIZATION_NVP(position_);
247 void print(std::ostream &stream)
const;
257 void print(std::ostream &stream)
const { obj->print(stream, fmt); }
276 std::ostream& operator<<(std::ostream&,
const MemoryCell&);
Base classes for instruction semantics.
virtual bool eraseWriters(const AddressSet &writerVas)
Erase specified writers.
virtual bool operator()(const MemoryCellPtr &)=0
Invoked for some cell.
static MemoryCellPtr instance(const MemoryCellPtr &other)
Instantiates a new copy of an existing cell.
void print(std::ostream &stream) const
Print the memory cell on a single line.
InputOutputPropertySet & ioProperties()
Properties: Boolean property set.
virtual bool insertWriters(const AddressSet &writerVas)
Insert writer information.
void clear()
Erase all values.
bool insert(const Value &value)
Insert a value.
virtual void eraseWriters()
Erase all writers.
unsigned position() const
Property: Position in listings.
virtual bool operator()(const MemoryCellPtr &) override
Invoked for some cell.
Main namespace for the ROSE library.
boost::shared_ptr< MemoryCell > MemoryCellPtr
Shared-ownership pointer to a memory cell.
virtual MemoryCellPtr clone() const
Creates a new deep-copy of this memory cell.
virtual void setWriters(const AddressSet &writerVas)
Sets writer information.
static MemoryCellPtr instance(const SValuePtr &address, const SValuePtr &value)
Instantiates a new memory cell object with the specified address and value.
Predicate for non-written cells.
void setWriter(rose_addr_t writerVa)
Sets writer information.
virtual SValuePtr value() const
Property: Memory cell value.
bool eraseWriter(rose_addr_t writerVa)
Erase specified writers.
virtual const AddressSet & getWriters() const
Get writer information.
std::list< MemoryCellPtr > CellList
List of memory cells.
bool erase(const Value &value)
Erase a value.
MemoryCellPtr Ptr
Shared-ownership pointer.
virtual bool operator()(const MemoryCellPtr &) override
Invoked for some cell.
Predicate that always returns true.
Sawyer::SharedPointer< SValue > SValuePtr
Shared-ownership pointer to a semantic value in any domain.
bool insertWriter(rose_addr_t writerVa)
Insert writer information.
WithFormatter with_format(Formatter &)
Used for printing states with formatting.
bool mayAlias(const MemoryCellPtr &other, RiscOperators *addrOps) const
Test whether two memory cells can alias one another.
Predicate for matching cells.
void position(unsigned p)
Property: Position in listings.
Base class for most instruction semantics RISC operators.
Visitor for traversing a cells.
bool mustAlias(const MemoryCellPtr &other, RiscOperators *addrOps) const
Test whether two memory cells must alias one another.
const InputOutputPropertySet & ioProperties() const
Properties: Boolean property set.
virtual MemoryCellPtr create(const SValuePtr &address, const SValuePtr &value)
Creates a new memory cell object with the specified address and value.
Represents one location in memory.
WithFormatter operator+(Formatter &)
Used for printing states with formatting.
virtual SValuePtr address() const
Property: Memory cell address.
virtual void hash(Combinatorics::Hasher &) const
Hash the address and value.