ROSE 0.11.145.147
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::MemoryCellState Class Referenceabstract

Description

Cell-based memory state.

This is the base class for cell-based memory states.

Definition at line 25 of file BaseSemantics/MemoryCellState.h.

#include <Rose/BinaryAnalysis/InstructionSemantics/BaseSemantics/MemoryCellState.h>

Inheritance diagram for Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::MemoryCellState:
Inheritance graph
[legend]
Collaboration diagram for Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::MemoryCellState:
Collaboration graph
[legend]

Public Types

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 Member Functions

virtual void clear () override
 Clear memory.
 
virtual AddressSet getWritersUnion (const SValuePtr &addr, size_t nBits, RiscOperators *addrOps, RiscOperators *valOps)=0
 Writers for an address.
 
virtual AddressSet getWritersIntersection (const SValuePtr &addr, size_t nBits, RiscOperators *addrOps, RiscOperators *valOps)=0
 Writers for an address.
 
virtual std::vector< MemoryCellPtrmatchingCells (MemoryCell::Predicate &) const =0
 Find all matching cells.
 
virtual std::vector< MemoryCellPtrleadingCells (MemoryCell::Predicate &) const =0
 Find leading matching cells.
 
virtual void eraseMatchingCells (MemoryCell::Predicate &)=0
 Remove all matching cells.
 
virtual void eraseLeadingCells (MemoryCell::Predicate &)=0
 Remove leading matching cells.
 
virtual void traverse (MemoryCell::Visitor &)=0
 Traverse and modify cells.
 
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 &cell)
 Property: Cell most recently written.
 
- Public Member Functions inherited from Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::MemoryState
virtual MemoryStatePtr create (const SValuePtr &addrProtoval, const SValuePtr &valProtoval) const =0
 Virtual allocating constructor.
 
virtual MemoryStatePtr clone () const =0
 Virtual allocating copy constructor.
 
SValuePtr get_addr_protoval () const
 Return the address protoval.
 
SValuePtr get_val_protoval () const
 Return the value protoval.
 
virtual bool merge (const MemoryStatePtr &other, RiscOperators *addrOps, RiscOperators *valOps)=0
 Merge memory states for data flow analysis.
 
virtual SValuePtr readMemory (const SValuePtr &address, const SValuePtr &dflt, RiscOperators *addrOps, RiscOperators *valOps)=0
 Read a value from memory.
 
virtual SValuePtr peekMemory (const SValuePtr &address, const SValuePtr &dflt, RiscOperators *addrOps, RiscOperators *valOps)=0
 Read a value from memory without side effects.
 
virtual void writeMemory (const SValuePtr &addr, const SValuePtr &value, RiscOperators *addrOps, RiscOperators *valOps)=0
 Write a value to memory.
 
virtual void hash (Combinatorics::Hasher &, RiscOperators *addrOps, RiscOperators *valOps) const =0
 Calculate a hash for this memory state.
 
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.
 
void print (std::ostream &, const std::string prefix="") const
 Print a memory state to more than one line of output.
 
virtual void print (std::ostream &, Formatter &) const =0
 Print a memory state to more than one line of output.
 
WithFormatter with_format (Formatter &)
 Used for printing memory states with formatting.
 
WithFormatter operator+ (Formatter &)
 Used for printing memory states with formatting.
 
WithFormatter operator+ (const std::string &linePrefix)
 Used for printing memory states with formatting.
 

Static Public Member Functions

static MemoryCellStatePtr promote (const BaseSemantics::MemoryStatePtr &m)
 Promote a base memory state pointer to a BaseSemantics::MemoryCellState pointer.
 
- Static Public Member Functions inherited from Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::MemoryState
static MemoryStatePtr promote (const MemoryStatePtr &)
 

Protected Member Functions

 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 Attributes

MemoryCellPtr protocell
 
MemoryCellPtr latestWrittenCell_
 

Member Typedef Documentation

◆ Super

Base type.

Definition at line 28 of file BaseSemantics/MemoryCellState.h.

◆ Ptr

Shared-ownership pointer.

Definition at line 31 of file BaseSemantics/MemoryCellState.h.

Constructor & Destructor Documentation

◆ MemoryCellState()

Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::MemoryCellState::MemoryCellState ( )
inlineprotected

Definition at line 50 of file BaseSemantics/MemoryCellState.h.

Member Function Documentation

◆ promote()

static MemoryCellStatePtr Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::MemoryCellState::promote ( const BaseSemantics::MemoryStatePtr m)
inlinestatic

Promote a base memory state pointer to a BaseSemantics::MemoryCellState pointer.

The memory state m must have a BaseSemantics::MemoryCellState dynamic type.

Definition at line 64 of file BaseSemantics/MemoryCellState.h.

◆ clear()

virtual void Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::MemoryCellState::clear ( )
overridevirtual

◆ latestWrittenCell() [1/2]

virtual MemoryCellPtr Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::MemoryCellState::latestWrittenCell ( ) const
inlinevirtual

Property: Cell most recently written.

Definition at line 77 of file BaseSemantics/MemoryCellState.h.

◆ latestWrittenCell() [2/2]

virtual void Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::MemoryCellState::latestWrittenCell ( const MemoryCellPtr cell)
inlinevirtual

Property: Cell most recently written.

Definition at line 80 of file BaseSemantics/MemoryCellState.h.

◆ getWritersUnion()

virtual AddressSet Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::MemoryCellState::getWritersUnion ( const SValuePtr addr,
size_t  nBits,
RiscOperators addrOps,
RiscOperators valOps 
)
pure virtual

Writers for an address.

Returns the set of all writers that wrote to the specified address or any address that might alias the specified address. Memory states that don't normally compute aliases (e.g., MemoryCellMap) return only the writers for the specified address, not any aliases, and in this case getWritersUnion and getWritersIntersection return the same set.

Implemented in Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::MemoryCellList, and Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::MemoryCellMap.

◆ getWritersIntersection()

virtual AddressSet Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::MemoryCellState::getWritersIntersection ( const SValuePtr addr,
size_t  nBits,
RiscOperators addrOps,
RiscOperators valOps 
)
pure virtual

Writers for an address.

Returns the set of all writers that wrote to the specified address and any address that might alias the specified address. Memory states that don't normally compute aliases (e.g., MemoryCellMap) return only the writers for the specified address, not any aliases, and in this case getWritersUnion and getWritersIntersection return the same set.

Implemented in Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::MemoryCellList, and Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::MemoryCellMap.

◆ matchingCells()

virtual std::vector< MemoryCellPtr > Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::MemoryCellState::matchingCells ( MemoryCell::Predicate ) const
pure virtual

Find all matching cells.

Returns a vector of cells for which the predicate returns true.

Implemented in Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::MemoryCellList, and Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::MemoryCellMap.

Referenced by allCells().

◆ leadingCells()

virtual std::vector< MemoryCellPtr > Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::MemoryCellState::leadingCells ( MemoryCell::Predicate ) const
pure virtual

Find leading matching cells.

Returns the vector of cells obtained by invoking the predicate on each cell and returning those leading cells for which the predicate is true. The first cell for which the predicate is false terminates the traversal and does not appear in the return value.

Implemented in Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::MemoryCellList, and Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::MemoryCellMap.

◆ eraseMatchingCells()

virtual void Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::MemoryCellState::eraseMatchingCells ( MemoryCell::Predicate )
pure virtual

Remove all matching cells.

Traverses the memory cells and removes those for which the predicate returns true.

Implemented in Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::MemoryCellList, and Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::MemoryCellMap.

Referenced by eraseNonWritten().

◆ eraseLeadingCells()

virtual void Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::MemoryCellState::eraseLeadingCells ( MemoryCell::Predicate )
pure virtual

Remove leading matching cells.

Traverses the memory cells and removes those for which the predicate returns true. The traversal is terminated the first time the predicate returns false.

Implemented in Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::MemoryCellList, and Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::MemoryCellMap.

◆ traverse()

virtual void Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::MemoryCellState::traverse ( MemoryCell::Visitor )
pure virtual

◆ updateReadProperties()

virtual void Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::MemoryCellState::updateReadProperties ( const CellList )
virtual

Adjust I/O properties after reading memory.

Adjust I/O properties in the specified cells to make it look like they were just read. This adds the READ property and may also add READ_AFTER_WRITE, READ_BEFORE_WRITE, and/or READ_UNINITIALIZED. This should be called automatically by each BaseSemantics::MemoryState::readMemory implementation.

◆ updateWriteProperties()

virtual void Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::MemoryCellState::updateWriteProperties ( const CellList ,
InputOutputPropertySet   
)
virtual

Adjust I/O properties after writing memory.

Adjust I/O properties in the specified cells to make it look like they were just read. This adds the specified properties to the list of I/O properties for the cell.

◆ eraseNonWritten()

void Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::MemoryCellState::eraseNonWritten ( )
inline

Erase cells that have no writers.

Definition at line 145 of file BaseSemantics/MemoryCellState.h.

References eraseMatchingCells().

◆ allCells()

std::vector< MemoryCellPtr > Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::MemoryCellState::allCells ( ) const
inline

All cells.

Definition at line 151 of file BaseSemantics/MemoryCellState.h.

References matchingCells().

Member Data Documentation

◆ protocell

MemoryCellPtr Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::MemoryCellState::protocell
protected

Definition at line 34 of file BaseSemantics/MemoryCellState.h.

◆ latestWrittenCell_

MemoryCellPtr Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::MemoryCellState::latestWrittenCell_
protected

Definition at line 35 of file BaseSemantics/MemoryCellState.h.


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