ROSE  0.11.87.0
Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::MemoryCell Class Reference

Description

Represents one location in memory.

MemoryCell objects are used by the MemoryCellList to represent a memory state. Each memory cell has an address and a value. A cell also has an optional list of instruction addresses that wrote to that cell, and this list is manipulated by the RiscOperators separately from updating cell addresses and values and according to settings in the RiscOperators. Cells written to by RiscOperators typically contain one writer address since each write operation creates a new cell; however, the result of a dataflow merge operation might produce cells that have multiple writers.

Definition at line 27 of file BaseSemantics/MemoryCell.h.

#include <Rose/BinaryAnalysis/InstructionSemantics2/BaseSemantics/MemoryCell.h>

Inheritance diagram for Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::MemoryCell:
Inheritance graph
[legend]
Collaboration diagram for Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::MemoryCell:
Collaboration graph
[legend]

Classes

class  AllCells
 Predicate that always returns true. More...
 
class  NonWrittenCells
 Predicate for non-written cells. More...
 
class  Predicate
 Predicate for matching cells. More...
 
class  Visitor
 Visitor for traversing a cells. More...
 
class  WithFormatter
 State with formatter. More...
 

Public Types

using Ptr = MemoryCellPtr
 Shared-ownership pointer. More...
 

Public Member Functions

virtual MemoryCellPtr create (const SValuePtr &address, const SValuePtr &value)
 Creates a new memory cell object with the specified address and value. More...
 
virtual MemoryCellPtr clone () const
 Creates a new deep-copy of this memory cell. More...
 
virtual const AddressSetgetWriters () const
 Get writer information. More...
 
virtual void eraseWriters ()
 Erase all writers. More...
 
bool mayAlias (const MemoryCellPtr &other, RiscOperators *addrOps) const
 Test whether two memory cells can alias one another. More...
 
virtual bool may_alias (const MemoryCellPtr &other, RiscOperators *addrOps) const
 
bool mustAlias (const MemoryCellPtr &other, RiscOperators *addrOps) const
 Test whether two memory cells must alias one another. More...
 
virtual bool must_alias (const MemoryCellPtr &other, RiscOperators *addrOps) const
 
virtual void hash (Combinatorics::Hasher &) const
 Hash the address and value. More...
 
virtual SValuePtr get_address () const
 
virtual void set_address (const SValuePtr &addr)
 
virtual SValuePtr get_value () const
 
virtual void set_value (const SValuePtr &v)
 
SValuePtr address () const
 Property: Memory cell address. More...
 
void address (const SValuePtr &addr)
 Property: Memory cell address. More...
 
SValuePtr value () const
 Property: Memory cell value. More...
 
void value (const SValuePtr &v)
 Property: Memory cell value. More...
 
bool insertWriter (rose_addr_t writerVa)
 Insert writer information. More...
 
virtual bool insertWriters (const AddressSet &writerVas)
 Insert writer information. More...
 
bool eraseWriter (rose_addr_t writerVa)
 Erase specified writers. More...
 
virtual bool eraseWriters (const AddressSet &writerVas)
 Erase specified writers. More...
 
void setWriter (rose_addr_t writerVa)
 Sets writer information. More...
 
virtual void setWriters (const AddressSet &writerVas)
 Sets writer information. More...
 
const InputOutputPropertySetioProperties () const
 Properties: Boolean property set. More...
 
InputOutputPropertySetioProperties ()
 Properties: Boolean property set. More...
 
unsigned position () const
 Property: Position in listings. More...
 
void position (unsigned p)
 Property: Position in listings. More...
 
void print (std::ostream &stream) const
 Print the memory cell on a single line.
 
virtual void print (std::ostream &, Formatter &) const
 Print the memory cell on a single line.
 
WithFormatter with_format (Formatter &)
 Used for printing states with formatting. More...
 
WithFormatter operator+ (Formatter &)
 Used for printing states with formatting. More...
 
WithFormatter operator+ (const std::string &linePrefix)
 Used for printing states with formatting. More...
 

Static Public Member Functions

static MemoryCellPtr instance (const SValuePtr &address, const SValuePtr &value)
 Instantiates a new memory cell object with the specified address and value. More...
 
static MemoryCellPtr instance (const MemoryCellPtr &other)
 Instantiates a new copy of an existing cell. More...
 
static MemoryCellPtr promote (const MemoryCellPtr &x)
 

Protected Member Functions

 MemoryCell (const SValuePtr &address, const SValuePtr &value)
 
 MemoryCell (const MemoryCell &other)
 

Member Typedef Documentation

Shared-ownership pointer.

Definition at line 30 of file BaseSemantics/MemoryCell.h.

Member Function Documentation

static MemoryCellPtr Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::MemoryCell::instance ( const SValuePtr address,
const SValuePtr value 
)
inlinestatic

Instantiates a new memory cell object with the specified address and value.

Definition at line 107 of file BaseSemantics/MemoryCell.h.

Referenced by create().

static MemoryCellPtr Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::MemoryCell::instance ( const MemoryCellPtr other)
inlinestatic

Instantiates a new copy of an existing cell.

Definition at line 112 of file BaseSemantics/MemoryCell.h.

virtual MemoryCellPtr Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::MemoryCell::create ( const SValuePtr address,
const SValuePtr value 
)
inlinevirtual

Creates a new memory cell object with the specified address and value.

Definition at line 120 of file BaseSemantics/MemoryCell.h.

References instance().

virtual MemoryCellPtr Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::MemoryCell::clone ( ) const
inlinevirtual

Creates a new deep-copy of this memory cell.

Definition at line 125 of file BaseSemantics/MemoryCell.h.

SValuePtr Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::MemoryCell::address ( ) const
inline

Property: Memory cell address.

This property holds the address of the memory cell. The address must not be null.

This method should not be reimplemented (yet) in subclasses. Instead, it calls get_address and set_address to do its work.

Definition at line 148 of file BaseSemantics/MemoryCell.h.

void Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::MemoryCell::address ( const SValuePtr addr)
inline

Property: Memory cell address.

This property holds the address of the memory cell. The address must not be null.

This method should not be reimplemented (yet) in subclasses. Instead, it calls get_address and set_address to do its work.

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

SValuePtr Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::MemoryCell::value ( ) const
inline

Property: Memory cell value.

This property holds the value of the memory cell. It must not be null.

This method should not be reimplemented (yet) in subclasses. Instead, it calls get_value and set_value to do its work.

Definition at line 164 of file BaseSemantics/MemoryCell.h.

void Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::MemoryCell::value ( const SValuePtr v)
inline

Property: Memory cell value.

This property holds the value of the memory cell. It must not be null.

This method should not be reimplemented (yet) in subclasses. Instead, it calls get_value and set_value to do its work.

Definition at line 167 of file BaseSemantics/MemoryCell.h.

virtual const AddressSet& Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::MemoryCell::getWriters ( ) const
inlinevirtual

Get writer information.

Returns all instruction addresses that have written to the specified memory address.

Definition at line 175 of file BaseSemantics/MemoryCell.h.

bool Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::MemoryCell::insertWriter ( rose_addr_t  writerVa)
inline

Insert writer information.

Insert the specified instruction addresses as writers for this memory cell. Returns true if any address was inserted, false if they were all already members.

Definition at line 185 of file BaseSemantics/MemoryCell.h.

References Sawyer::Container::Set< T, C, A >::insert().

virtual bool Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::MemoryCell::insertWriters ( const AddressSet writerVas)
inlinevirtual

Insert writer information.

Insert the specified instruction addresses as writers for this memory cell. Returns true if any address was inserted, false if they were all already members.

Definition at line 186 of file BaseSemantics/MemoryCell.h.

References Sawyer::Container::Set< T, C, A >::insert().

bool Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::MemoryCell::eraseWriter ( rose_addr_t  writerVa)
inline

Erase specified writers.

Removes the specified addresses from the set of writers for this memory cell. Returns true if none of the writer addresses existed, false if any were removed.

Definition at line 195 of file BaseSemantics/MemoryCell.h.

References Sawyer::Container::Set< T, C, A >::erase().

virtual bool Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::MemoryCell::eraseWriters ( const AddressSet writerVas)
inlinevirtual

Erase specified writers.

Removes the specified addresses from the set of writers for this memory cell. Returns true if none of the writer addresses existed, false if any were removed.

Definition at line 196 of file BaseSemantics/MemoryCell.h.

References Sawyer::Container::Set< T, C, A >::erase().

void Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::MemoryCell::setWriter ( rose_addr_t  writerVa)

Sets writer information.

Changes writer information to be excactly the specified address or set of addresses.

virtual void Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::MemoryCell::setWriters ( const AddressSet writerVas)
inlinevirtual

Sets writer information.

Changes writer information to be excactly the specified address or set of addresses.

Definition at line 205 of file BaseSemantics/MemoryCell.h.

References Sawyer::Container::Set< T, C, A >::insert().

virtual void Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::MemoryCell::eraseWriters ( )
inlinevirtual

Erase all writers.

Erases all writer information for this memory cell.

Definition at line 211 of file BaseSemantics/MemoryCell.h.

References Sawyer::Container::Set< T, C, A >::clear().

const InputOutputPropertySet& Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::MemoryCell::ioProperties ( ) const
inline

Properties: Boolean property set.

This set holds Boolean input/output properties. If a property is present in the set then it is considered to be true, otherwise false.

Definition at line 219 of file BaseSemantics/MemoryCell.h.

InputOutputPropertySet& Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::MemoryCell::ioProperties ( )
inline

Properties: Boolean property set.

This set holds Boolean input/output properties. If a property is present in the set then it is considered to be true, otherwise false.

Definition at line 220 of file BaseSemantics/MemoryCell.h.

unsigned Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::MemoryCell::position ( ) const
inline

Property: Position in listings.

For memory states that support it, this property holds an integer position of the cell relative to the other cells. For instance, a map-based memory state that uses address hashes would normally list the memory cells in order of their hashes, which makes it confusing for a human to look at because the bytes for a single multi-byte word will be scattered throughout the listing. By setting a position, the user can control the order that the four bytes are listed with respect to each other and with respect to the other cells in the memory state.

Definition at line 232 of file BaseSemantics/MemoryCell.h.

void Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::MemoryCell::position ( unsigned  p)
inline

Property: Position in listings.

For memory states that support it, this property holds an integer position of the cell relative to the other cells. For instance, a map-based memory state that uses address hashes would normally list the memory cells in order of their hashes, which makes it confusing for a human to look at because the bytes for a single multi-byte word will be scattered throughout the listing. By setting a position, the user can control the order that the four bytes are listed with respect to each other and with respect to the other cells in the memory state.

Definition at line 233 of file BaseSemantics/MemoryCell.h.

bool Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::MemoryCell::mayAlias ( const MemoryCellPtr other,
RiscOperators addrOps 
) const
inline

Test whether two memory cells can alias one another.

Two cells may alias one another if it is possible that their addresses cause them to overlap. For cells containing one-byte values, aliasing may occur if their two addresses may be equal; multi-byte cells will need to check ranges of addresses.

For now, this just calls the old virtual may_alias method, but eventually we'll remove that method.

Definition at line 244 of file BaseSemantics/MemoryCell.h.

bool Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::MemoryCell::mustAlias ( const MemoryCellPtr other,
RiscOperators addrOps 
) const
inline

Test whether two memory cells must alias one another.

Two cells must alias one another when it can be proven that their addresses cause them to overlap. For cells containing one-byte values, aliasing must occur unless their addresses can be different; multi-byte cells will need to check ranges of addresses.

For now, this just calls the old virtual must_alias method, but eventually we'll remove that method.

Definition at line 260 of file BaseSemantics/MemoryCell.h.

virtual void Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::MemoryCell::hash ( Combinatorics::Hasher ) const
virtual

Hash the address and value.

This hashes the address and value for the cell, but not any other properties. The goal is that an analysis that encounters the same state twice might be able to eliminate some work, and comparing hashes is a fast first test of equality: different hashes mean the states are different.

WithFormatter Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::MemoryCell::with_format ( Formatter )

Used for printing states with formatting.

The usual way to use this is:

MemoryCellPtr obj = ...;
Formatter fmt = ...;
std::cout <<"The value is: " <<(*obj+fmt) <<"\n";
WithFormatter Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::MemoryCell::operator+ ( Formatter )

Used for printing states with formatting.

The usual way to use this is:

MemoryCellPtr obj = ...;
Formatter fmt = ...;
std::cout <<"The value is: " <<(*obj+fmt) <<"\n";
WithFormatter Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::MemoryCell::operator+ ( const std::string &  linePrefix)

Used for printing states with formatting.

The usual way to use this is:

MemoryCellPtr obj = ...;
Formatter fmt = ...;
std::cout <<"The value is: " <<(*obj+fmt) <<"\n";

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