ROSE 0.11.145.192
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
Rose::BinaryAnalysis::InstructionSemantics::IntervalSemantics::MemoryState Class Reference

Description

Byte-addressable memory.

This class represents an entire state of memory via a list of memory cells. The memory cell list is sorted in reverse chronological order and addresses that satisfy a "must-alias" predicate are pruned so that only the must recent such memory cell is in the table.

A memory write operation prunes away any existing memory cell that must-alias the newly written address, then adds a new memory cell to the front of the memory cell list.

A memory read operation scans the memory cell list and returns the union of all possible matches.

Definition at line 181 of file IntervalSemantics.h.

#include <Rose/BinaryAnalysis/InstructionSemantics/IntervalSemantics.h>

Inheritance diagram for Rose::BinaryAnalysis::InstructionSemantics::IntervalSemantics::MemoryState:
Inheritance graph
[legend]
Collaboration diagram for Rose::BinaryAnalysis::InstructionSemantics::IntervalSemantics::MemoryState:
Collaboration graph
[legend]

Public Types

using Super = BaseSemantics::MemoryCellList
 Base type.
 
using Ptr = MemoryStatePtr
 Shared-ownership pointer.
 
- Public Types inherited from Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::MemoryCellList
using Super = MemoryCellState
 Base type.
 
using Ptr = MemoryCellListPtr
 Shared-ownership pointer.
 
- Public Types inherited from Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::MemoryCellState
using Super = MemoryState
 Base type.
 
using Ptr = MemoryCellStatePtr
 Shared-ownership pointer.
 
- Public Types inherited from Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::MemoryState
typedef MemoryStatePtr Ptr
 Shared-ownership pointer.
 
- Public Types inherited from Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::AddressSpace
using Ptr = AddressSpacePtr
 Shared-ownership pointer.
 
using Purpose = AddressSpacePurpose
 Purpose for the address space.
 

Public Member Functions

virtual BaseSemantics::MemoryStatePtr create (const BaseSemantics::MemoryCellPtr &protocell) const override
 Virtual allocating constructor.
 
virtual BaseSemantics::MemoryStatePtr create (const BaseSemantics::SValuePtr &addrProtoval, const BaseSemantics::SValuePtr &valProtoval) const override
 Virtual allocating constructor.
 
virtual BaseSemantics::AddressSpacePtr clone () const override
 Deep-copy of this address space.
 
virtual BaseSemantics::SValuePtr readMemory (const BaseSemantics::SValuePtr &addr, const BaseSemantics::SValuePtr &dflt, BaseSemantics::RiscOperators *addrOps, BaseSemantics::RiscOperators *valOps) override
 Read a byte from memory.
 
virtual BaseSemantics::SValuePtr peekMemory (const BaseSemantics::SValuePtr &addr, const BaseSemantics::SValuePtr &dflt, BaseSemantics::RiscOperators *addrOps, BaseSemantics::RiscOperators *valOps) override
 Read a byte from memory without side effects.
 
virtual void writeMemory (const BaseSemantics::SValuePtr &addr, const BaseSemantics::SValuePtr &value, BaseSemantics::RiscOperators *addrOps, BaseSemantics::RiscOperators *valOps) override
 Write a byte to memory.
 
- Public Member Functions inherited from Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::MemoryCellList
virtual void clear () override
 Clear memory.
 
virtual bool merge (const AddressSpacePtr &other, RiscOperators *addrOps, RiscOperators *valOps) override
 Merge address spaces for data flow analysis.
 
virtual std::vector< MemoryCellPtrmatchingCells (MemoryCell::Predicate &) const override
 Find all matching cells.
 
virtual std::vector< MemoryCellPtrleadingCells (MemoryCell::Predicate &) const override
 Find leading matching cells.
 
virtual void eraseMatchingCells (MemoryCell::Predicate &) override
 Remove all matching cells.
 
virtual void eraseLeadingCells (MemoryCell::Predicate &) override
 Remove leading matching cells.
 
virtual void traverse (MemoryCell::Visitor &) override
 Traverse and modify cells.
 
virtual void hash (Combinatorics::Hasher &, RiscOperators *addrOps, RiscOperators *valOps) const override
 Hash this address space.
 
virtual void print (std::ostream &, Formatter &) const override
 Print an address space.
 
bool mergeNoAliasing (const AddressSpacePtr &other, RiscOperators *addrOps, RiscOperators *valOps)
 Merge two states without aliasing.
 
bool mergeWithAliasing (const AddressSpacePtr &other, RiscOperators *addrOps, RiscOperators *valOps)
 Merge two states with aliasing.
 
virtual bool isAllPresent (const SValuePtr &address, size_t nBytes, RiscOperators *addrOps, RiscOperators *valOps) const
 Predicate to determine whether all bytes are present.
 
template<class Iterator >
CellList scan (Iterator &cursor, const SValuePtr &addr, size_t nBits, RiscOperators *addrOps, RiscOperators *valOps) const
 Scan cell list to find matching cells.
 
virtual AddressSet getWritersUnion (const SValuePtr &addr, size_t nBits, RiscOperators *addrOps, RiscOperators *valOps) override
 Writers for an address.
 
virtual AddressSet getWritersIntersection (const SValuePtr &addr, size_t nBits, RiscOperators *addrOps, RiscOperators *valOps) override
 Writers for an address.
 
bool occlusionsErased () const
 Property: erase occluded cells.
 
void occlusionsErased (bool b)
 Property: erase occluded cells.
 
virtual const CellListget_cells () const
 Returns the list of all memory cells.
 
virtual CellListget_cells ()
 Returns the list of all memory cells.
 
- Public Member Functions inherited from Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::MemoryCellState
virtual void updateReadProperties (const CellList &)
 Adjust I/O properties after reading memory.
 
virtual void updateWriteProperties (const CellList &, InputOutputPropertySet)
 Adjust I/O properties after writing memory.
 
void eraseNonWritten ()
 Erase cells that have no writers.
 
std::vector< MemoryCellPtrallCells () const
 All cells.
 
virtual MemoryCellPtr latestWrittenCell () const
 Property: Cell most recently written.
 
virtual void latestWrittenCell (const MemoryCellPtr &)
 Property: Cell most recently written.
 
- Public Member Functions inherited from Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::MemoryState
SValuePtr get_addr_protoval () const
 Return the address protoval.
 
SValuePtr get_val_protoval () const
 Return the value protoval.
 
MergerPtr merger () const
 Property: Merger.
 
void merger (const MergerPtr &)
 Property: Merger.
 
bool byteRestricted () const
 Indicates whether memory cell values are required to be eight bits wide.
 
void byteRestricted (bool)
 Indicates whether memory cell values are required to be eight bits wide.
 
ByteOrder::Endianness get_byteOrder () const
 Memory byte order.
 
void set_byteOrder (ByteOrder::Endianness)
 Memory byte order.
 
- Public Member Functions inherited from Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::AddressSpace
virtual SValuePtr read (const AddressSpaceAddress &, const SValuePtr &dflt, RiscOperators &addrOps, RiscOperators &valOps)
 Read a value from the address space.
 
virtual SValuePtr peek (const AddressSpaceAddress &, const SValuePtr &dflt, RiscOperators &addrOps, RiscOperators &valOps)
 Read without causing side effects.
 
virtual void write (const AddressSpaceAddress &, const SValuePtr &value, RiscOperators &addrOps, RiscOperators &valOps)
 Write a value to an address space.
 
std::string printableName () const
 Printable name for this address space.
 
Purpose purpose () const
 Property: Purpose of this address space.
 
void purpose (Purpose)
 Property: Purpose of this address space.
 
const std::string & name () const
 Property: Name for this address space.
 
void name (const std::string &)
 Property: Name for this address space.
 
void print (std::ostream &, const std::string &prefix="") const
 Print an address space.
 
WithFormatter with_format (Formatter &)
 Used for printing address spaces with formatting.
 
WithFormatter operator+ (Formatter &)
 Used for printing address spaces with formatting.
 
WithFormatter operator+ (const std::string &linePrefix)
 Used for printing address spaces with formatting.
 

Static Public Member Functions

static MemoryStatePtr instance (const BaseSemantics::MemoryCellPtr &protocell)
 Instantiate a new memory state with specified prototypical cells and values.
 
static MemoryStatePtr instance (const BaseSemantics::SValuePtr &addrProtoval, const BaseSemantics::SValuePtr &valProtoval)
 Instantiate a new memory state with prototypical value.
 
- Static Public Member Functions inherited from Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::MemoryCellList
static MemoryCellListPtr instance (const SValuePtr &addrProtoval, const SValuePtr &valProtoval)
 Instantiate a new prototypical memory state.
 
static MemoryCellListPtr instance (const MemoryCellPtr &protocell)
 Instantiate a new memory state with prototypical memory cell.
 
static MemoryCellListPtr instance (const MemoryCellListPtr &other)
 Instantiate a new copy of an existing memory state.
 
static MemoryCellListPtr promote (const BaseSemantics::AddressSpacePtr &m)
 Promote a base address space pointer to a BaseSemantics::MemoryCellList pointer.
 
- Static Public Member Functions inherited from Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::MemoryCellState
static MemoryCellStatePtr promote (const BaseSemantics::AddressSpacePtr &)
 Promote a base address space pointer to a BaseSemantics::MemoryCellState pointer.
 
- Static Public Member Functions inherited from Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::MemoryState
static MemoryStatePtr promote (const AddressSpacePtr &)
 

Protected Member Functions

 MemoryState (const BaseSemantics::MemoryCellPtr &protocell)
 
 MemoryState (const BaseSemantics::SValuePtr &addrProtoval, const BaseSemantics::SValuePtr &valProtoval)
 
 MemoryState (const MemoryState &)
 
- Protected Member Functions inherited from Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::MemoryCellList
 MemoryCellList (const MemoryCellPtr &protocell)
 
 MemoryCellList (const SValuePtr &addrProtoval, const SValuePtr &valProtoval)
 
 MemoryCellList (const MemoryCellList &other)
 
virtual SValuePtr mergeCellValues (const CellList &cells, const SValuePtr &dflt, RiscOperators *addrOps, RiscOperators *valOps)
 
virtual AddressSet mergeCellWriters (const CellList &cells)
 
virtual InputOutputPropertySet mergeCellProperties (const CellList &cells)
 
virtual MemoryCellPtr insertReadCell (const SValuePtr &addr, const SValuePtr &value)
 
virtual MemoryCellPtr insertReadCell (const SValuePtr &addr, const SValuePtr &value, const AddressSet &writers, const InputOutputPropertySet &props)
 
- Protected Member Functions inherited from Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::MemoryCellState
 MemoryCellState (const MemoryCellPtr &protocell)
 
 MemoryCellState (const SValuePtr &addrProtoval, const SValuePtr &valProtoval)
 
 MemoryCellState (const MemoryCellState &other)
 
- Protected Member Functions inherited from Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::MemoryState
 MemoryState (const SValuePtr &addrProtoval, const SValuePtr &valProtoval)
 
 MemoryState (const MemoryStatePtr &other)
 
- Protected Member Functions inherited from Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::AddressSpace
 AddressSpace (Purpose, const std::string &name)
 
 AddressSpace (const AddressSpace &)
 
AddressSpaceoperator= (const AddressSpace &)=delete
 

Additional Inherited Members

- Protected Attributes inherited from Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::MemoryCellList
CellList cells
 
bool occlusionsErased_
 
- Protected Attributes inherited from Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::MemoryCellState
MemoryCellPtr protocell
 
MemoryCellPtr latestWrittenCell_
 

Member Typedef Documentation

◆ Super

Base type.

Definition at line 184 of file IntervalSemantics.h.

◆ Ptr

Shared-ownership pointer.

Definition at line 187 of file IntervalSemantics.h.

Member Function Documentation

◆ instance()

static MemoryStatePtr Rose::BinaryAnalysis::InstructionSemantics::IntervalSemantics::MemoryState::instance ( const BaseSemantics::SValuePtr addrProtoval,
const BaseSemantics::SValuePtr valProtoval 
)
static

Instantiate a new memory state with prototypical value.

This constructor uses BaseSemantics::MemoryCell as the cell type. The address protoval and value protoval are usually the same (or at least the same dynamic type).

◆ create() [1/2]

virtual BaseSemantics::MemoryStatePtr Rose::BinaryAnalysis::InstructionSemantics::IntervalSemantics::MemoryState::create ( const BaseSemantics::MemoryCellPtr protocell) const
overridevirtual

Virtual allocating constructor.

Reimplemented from Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::MemoryCellList.

◆ create() [2/2]

virtual BaseSemantics::MemoryStatePtr Rose::BinaryAnalysis::InstructionSemantics::IntervalSemantics::MemoryState::create ( const BaseSemantics::SValuePtr addrProtoval,
const BaseSemantics::SValuePtr valProtoval 
) const
overridevirtual

Virtual allocating constructor.

Allocates and constructs a new MemoryState object having the same dynamic type as this object. A prototypical SValue must be supplied and will be used to construct any additional SValue objects needed during the operation of a MemoryState. Two prototypical values are supplied, one for addresses and another for values stored at those addresses, although they will almost always be the same.

Reimplemented from Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::MemoryCellList.

◆ clone()

virtual BaseSemantics::AddressSpacePtr Rose::BinaryAnalysis::InstructionSemantics::IntervalSemantics::MemoryState::clone ( ) const
overridevirtual

Deep-copy of this address space.

Reimplemented from Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::MemoryCellList.

◆ readMemory()

virtual BaseSemantics::SValuePtr Rose::BinaryAnalysis::InstructionSemantics::IntervalSemantics::MemoryState::readMemory ( const BaseSemantics::SValuePtr addr,
const BaseSemantics::SValuePtr dflt,
BaseSemantics::RiscOperators addrOps,
BaseSemantics::RiscOperators valOps 
)
overridevirtual

Read a byte from memory.

In order to read a multi-byte value, use RiscOperators::readMemory().

Reimplemented from Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::MemoryCellList.

◆ peekMemory()

virtual BaseSemantics::SValuePtr Rose::BinaryAnalysis::InstructionSemantics::IntervalSemantics::MemoryState::peekMemory ( const BaseSemantics::SValuePtr addr,
const BaseSemantics::SValuePtr dflt,
BaseSemantics::RiscOperators addrOps,
BaseSemantics::RiscOperators valOps 
)
overridevirtual

Read a byte from memory without side effects.

In order to read a multi-byte value, use RiscOperators::peekMemory().

Reimplemented from Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::MemoryCellList.

◆ writeMemory()

virtual void Rose::BinaryAnalysis::InstructionSemantics::IntervalSemantics::MemoryState::writeMemory ( const BaseSemantics::SValuePtr addr,
const BaseSemantics::SValuePtr value,
BaseSemantics::RiscOperators addrOps,
BaseSemantics::RiscOperators valOps 
)
overridevirtual

Write a byte to memory.

In order to write a multi-byte value, use RiscOperators::writeMemory().

Reimplemented from Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::MemoryCellList.


The documentation for this class was generated from the following file: