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
5#include <Rose/BinaryAnalysis/InstructionSemantics/BaseSemantics/BasicTypes.h>
7#include <Rose/BinaryAnalysis/AddressSet.h>
8#include <Combinatorics.h>
10#include <Sawyer/Set.h>
12#include <boost/enable_shared_from_this.hpp>
13#include <boost/serialization/access.hpp>
14#include <boost/serialization/export.hpp>
15#include <boost/serialization/list.hpp>
19namespace BinaryAnalysis {
20namespace InstructionSemantics {
31class MemoryCell:
public boost::enable_shared_from_this<MemoryCell> {
75 unsigned position_ = 0;
79#ifdef ROSE_HAVE_BOOST_SERIALIZATION_LIB
81 friend class boost::serialization::access;
84 void serialize(S &s,
const unsigned version) {
85 s & BOOST_SERIALIZATION_NVP(address_);
86 s & BOOST_SERIALIZATION_NVP(value_);
87 s & BOOST_SERIALIZATION_NVP(writers_);
88 s & BOOST_SERIALIZATION_NVP(ioProperties_);
90 s & BOOST_SERIALIZATION_NVP(position_);
249 void print(std::ostream &stream)
const;
259 void print(std::ostream &stream)
const { obj->print(stream, fmt); }
278std::ostream& operator<<(std::ostream&,
const MemoryCell&);
Predicate that always returns true.
virtual bool operator()(const MemoryCellPtr &) override
Invoked for some cell.
Predicate for non-written cells.
virtual bool operator()(const MemoryCellPtr &) override
Invoked for some cell.
Predicate for matching cells.
virtual bool operator()(const MemoryCellPtr &)=0
Invoked for some cell.
Visitor for traversing a cells.
Represents one location in memory.
virtual MemoryCellPtr clone() const
Creates a new deep-copy of this memory cell.
MemoryCellPtr Ptr
Shared-ownership pointer.
WithFormatter operator+(Formatter &)
Used for printing states with formatting.
virtual SValuePtr address() const
Property: Memory cell address.
virtual bool eraseWriters(const AddressSet &writerVas)
Erase specified writers.
unsigned position() const
Property: Position in listings.
bool mustAlias(const MemoryCellPtr &other, RiscOperators *addrOps) const
Test whether two memory cells must alias one another.
void position(unsigned p)
Property: Position in listings.
virtual void address(const SValuePtr &addr)
Property: Memory cell address.
InputOutputPropertySet & ioProperties()
Properties: Boolean property set.
bool eraseWriter(rose_addr_t writerVa)
Erase specified writers.
virtual void value(const SValuePtr &v)
Property: Memory cell value.
static MemoryCellPtr instance(const MemoryCellPtr &other)
Instantiates a new copy of an existing cell.
virtual bool insertWriters(const AddressSet &writerVas)
Insert writer information.
virtual void eraseWriters()
Erase all writers.
virtual void print(std::ostream &, Formatter &) const
Print the memory cell on a single line.
virtual const AddressSet & getWriters() const
Get writer information.
WithFormatter with_format(Formatter &)
Used for printing states with formatting.
virtual MemoryCellPtr create(const SValuePtr &address, const SValuePtr &value)
Creates a new memory cell object with the specified address and value.
bool insertWriter(rose_addr_t writerVa)
Insert writer information.
bool mayAlias(const MemoryCellPtr &other, RiscOperators *addrOps) const
Test whether two memory cells can alias one another.
const InputOutputPropertySet & ioProperties() const
Properties: Boolean property set.
void print(std::ostream &stream) const
Print the memory cell on a single line.
static MemoryCellPtr instance(const SValuePtr &address, const SValuePtr &value)
Instantiates a new memory cell object with the specified address and value.
virtual SValuePtr value() const
Property: Memory cell value.
void setWriter(rose_addr_t writerVa)
Sets writer information.
WithFormatter operator+(const std::string &linePrefix)
Used for printing states with formatting.
virtual void setWriters(const AddressSet &writerVas)
Sets writer information.
virtual void hash(Combinatorics::Hasher &) const
Hash the address and value.
Base class for most instruction semantics RISC operators.
bool insert(const Value &value)
Insert a value.
bool erase(const Value &value)
Erase a value.
void clear()
Erase all values.
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.