ROSE  0.11.145.0
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 262 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. More...
 
using Ptr = MemoryStatePtr
 Shared-ownership pointer. More...
 
- Public Types inherited from Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::MemoryCellList
using Super = MemoryCellState
 Base type. More...
 
using Ptr = MemoryCellListPtr
 Shared-ownership pointer. More...
 
- Public Types inherited from Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::MemoryCellState
using Super = MemoryState
 Base type. More...
 
using Ptr = MemoryCellStatePtr
 Shared-ownership pointer. More...
 
- Public Types inherited from Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::MemoryState
typedef MemoryStatePtr Ptr
 Shared-ownership pointer. More...
 

Public Member Functions

virtual BaseSemantics::MemoryStatePtr create (const BaseSemantics::MemoryCellPtr &protocell) const override
 Virtual allocating constructor. More...
 
virtual BaseSemantics::MemoryStatePtr create (const BaseSemantics::SValuePtr &addrProtoval, const BaseSemantics::SValuePtr &valProtoval) const override
 Virtual allocating constructor. More...
 
virtual BaseSemantics::MemoryStatePtr clone () const override
 Virtual allocating copy constructor. More...
 
virtual BaseSemantics::SValuePtr readMemory (const BaseSemantics::SValuePtr &addr, const BaseSemantics::SValuePtr &dflt, BaseSemantics::RiscOperators *addrOps, BaseSemantics::RiscOperators *valOps) override
 Read a byte from memory. More...
 
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. More...
 
virtual void writeMemory (const BaseSemantics::SValuePtr &addr, const BaseSemantics::SValuePtr &value, BaseSemantics::RiscOperators *addrOps, BaseSemantics::RiscOperators *valOps) override
 Write a byte to memory. More...
 
- Public Member Functions inherited from Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::MemoryCellList
virtual void clear () override
 Clear memory. More...
 
virtual bool merge (const MemoryStatePtr &other, RiscOperators *addrOps, RiscOperators *valOps) override
 Merge memory states for data flow analysis. More...
 
virtual std::vector< MemoryCellPtrmatchingCells (MemoryCell::Predicate &) const override
 Find all matching cells. More...
 
virtual std::vector< MemoryCellPtrleadingCells (MemoryCell::Predicate &) const override
 Find leading matching cells. More...
 
virtual void eraseMatchingCells (MemoryCell::Predicate &) override
 Remove all matching cells. More...
 
virtual void eraseLeadingCells (MemoryCell::Predicate &) override
 Remove leading matching cells. More...
 
virtual void traverse (MemoryCell::Visitor &) override
 Traverse and modify cells. More...
 
virtual void hash (Combinatorics::Hasher &, RiscOperators *addrOps, RiscOperators *valOps) const override
 Calculate a hash for this memory state. More...
 
virtual void print (std::ostream &, Formatter &) const override
 Print a memory state to more than one line of output.
 
bool mergeNoAliasing (const MemoryStatePtr &other, RiscOperators *addrOps, RiscOperators *valOps)
 Merge two states without aliasing. More...
 
bool mergeWithAliasing (const MemoryStatePtr &other, RiscOperators *addrOps, RiscOperators *valOps)
 Merge two states with aliasing. More...
 
virtual bool isAllPresent (const SValuePtr &address, size_t nBytes, RiscOperators *addrOps, RiscOperators *valOps) const
 Predicate to determine whether all bytes are present. More...
 
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. More...
 
virtual AddressSet getWritersUnion (const SValuePtr &addr, size_t nBits, RiscOperators *addrOps, RiscOperators *valOps) override
 Writers for an address. More...
 
virtual AddressSet getWritersIntersection (const SValuePtr &addr, size_t nBits, RiscOperators *addrOps, RiscOperators *valOps) override
 Writers for an address. More...
 
bool occlusionsErased () const
 Property: erase occluded cells. More...
 
void occlusionsErased (bool b)
 Property: erase occluded cells. More...
 
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. More...
 
virtual void updateWriteProperties (const CellList &, InputOutputPropertySet)
 Adjust I/O properties after writing memory. More...
 
void eraseNonWritten ()
 Erase cells that have no writers. More...
 
std::vector< MemoryCellPtrallCells () const
 All cells. More...
 
virtual MemoryCellPtr latestWrittenCell () const
 Property: Cell most recently written.
 
virtual void latestWrittenCell (const MemoryCellPtr &cell)
 Property: Cell most recently written.
 
- Public Member Functions inherited from Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::MemoryState
SValuePtr get_addr_protoval () const
 Return the address protoval. More...
 
SValuePtr get_val_protoval () const
 Return the value protoval. More...
 
MergerPtr merger () const
 Property: Merger. More...
 
void merger (const MergerPtr &)
 Property: Merger. More...
 
bool byteRestricted () const
 Indicates whether memory cell values are required to be eight bits wide. More...
 
void byteRestricted (bool)
 Indicates whether memory cell values are required to be eight bits wide. More...
 
ByteOrder::Endianness get_byteOrder () const
 Memory byte order.
 
void set_byteOrder (ByteOrder::Endianness)
 Memory byte order.
 
void print (std::ostream &, const std::string prefix="") const
 Print a memory state to more than one line of output.
 
WithFormatter with_format (Formatter &)
 Used for printing memory states with formatting. More...
 
WithFormatter operator+ (Formatter &)
 Used for printing memory states with formatting. More...
 
WithFormatter operator+ (const std::string &linePrefix)
 Used for printing memory states with formatting. More...
 

Static Public Member Functions

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

Protected Member Functions

 MemoryState (const BaseSemantics::MemoryCellPtr &protocell)
 
 MemoryState (const BaseSemantics::SValuePtr &addrProtoval, const BaseSemantics::SValuePtr &valProtoval)
 
 MemoryState (const MemoryState &other)
 
- 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)
 

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

Base type.

Definition at line 265 of file IntervalSemantics.h.

Shared-ownership pointer.

Definition at line 268 of file IntervalSemantics.h.

Member Function Documentation

static MemoryStatePtr Rose::BinaryAnalysis::InstructionSemantics::IntervalSemantics::MemoryState::instance ( const BaseSemantics::MemoryCellPtr protocell)
inlinestatic

Instantiate a new memory state with specified prototypical cells and values.

Definition at line 286 of file IntervalSemantics.h.

Referenced by create().

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

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).

Definition at line 292 of file IntervalSemantics.h.

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

Virtual allocating constructor.

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

Definition at line 299 of file IntervalSemantics.h.

References instance().

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

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.

Definition at line 303 of file IntervalSemantics.h.

References instance().

virtual BaseSemantics::MemoryStatePtr Rose::BinaryAnalysis::InstructionSemantics::IntervalSemantics::MemoryState::clone ( ) const
inlineoverridevirtual

Virtual allocating copy constructor.

Creates a new MemoryState object which is a copy of this object.

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

Definition at line 308 of file IntervalSemantics.h.

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.

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.

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: