1#ifndef ROSE_BinaryAnalysis_InstructionSemantics_BaseSemantics_MemoryState_H
2#define ROSE_BinaryAnalysis_InstructionSemantics_BaseSemantics_MemoryState_H
3#include <featureTests.h>
4#ifdef ROSE_ENABLE_BINARY_ANALYSIS
5#include <Rose/BinaryAnalysis/InstructionSemantics/BaseSemantics/BasicTypes.h>
7#include <Rose/BinaryAnalysis/ByteOrder.h>
8#include <Combinatorics.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/shared_ptr.hpp>
16namespace BinaryAnalysis {
17namespace InstructionSemantics {
27class MemoryState:
public boost::enable_shared_from_this<MemoryState> {
41#ifdef ROSE_HAVE_BOOST_SERIALIZATION_LIB
43 friend class boost::serialization::access;
46 void serialize(S &s,
const unsigned ) {
47 s & BOOST_SERIALIZATION_NVP(addrProtoval_);
48 s & BOOST_SERIALIZATION_NVP(valProtoval_);
49 s & BOOST_SERIALIZATION_NVP(byteOrder_);
51 s & BOOST_SERIALIZATION_NVP(byteRestricted_);
186 void print(std::ostream&,
const std::string prefix =
"")
const;
198 void print(std::ostream&)
const;
222std::ostream& operator<<(std::ostream&,
const MemoryState&);
Represents all memory in the state.
void set_byteOrder(ByteOrder::Endianness)
Memory byte order.
WithFormatter with_format(Formatter &)
Used for printing memory states with formatting.
WithFormatter operator+(const std::string &linePrefix)
Used for printing memory states with formatting.
virtual bool merge(const MemoryStatePtr &other, RiscOperators *addrOps, RiscOperators *valOps)=0
Merge memory states for data flow analysis.
virtual MemoryStatePtr create(const SValuePtr &addrProtoval, const SValuePtr &valProtoval) const =0
Virtual allocating constructor.
virtual void print(std::ostream &, Formatter &) const =0
Print a memory state to more than one line of output.
virtual SValuePtr peekMemory(const SValuePtr &address, const SValuePtr &dflt, RiscOperators *addrOps, RiscOperators *valOps)=0
Read a value from memory without side effects.
void print(std::ostream &, const std::string prefix="") const
Print a memory state to more than one line of output.
SValuePtr get_val_protoval() const
Return the value protoval.
void merger(const MergerPtr &)
Property: Merger.
virtual void writeMemory(const SValuePtr &addr, const SValuePtr &value, RiscOperators *addrOps, RiscOperators *valOps)=0
Write a value to memory.
MergerPtr merger() const
Property: Merger.
ByteOrder::Endianness get_byteOrder() const
Memory byte order.
virtual MemoryStatePtr clone() const =0
Virtual allocating copy constructor.
MemoryStatePtr Ptr
Shared-ownership pointer.
SValuePtr get_addr_protoval() const
Return the address protoval.
virtual void clear()=0
Clear memory.
bool byteRestricted() const
Indicates whether memory cell values are required to be eight bits wide.
virtual void hash(Combinatorics::Hasher &, RiscOperators *addrOps, RiscOperators *valOps) const =0
Calculate a hash for this memory state.
WithFormatter operator+(Formatter &)
Used for printing memory states with formatting.
virtual SValuePtr readMemory(const SValuePtr &address, const SValuePtr &dflt, RiscOperators *addrOps, RiscOperators *valOps)=0
Read a value from memory.
void byteRestricted(bool)
Indicates whether memory cell values are required to be eight bits wide.
Base class for most instruction semantics RISC operators.
Base classes for instruction semantics.
boost::shared_ptr< MemoryState > MemoryStatePtr
Shared-ownership pointer to a memory state.