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

Description

Null register state.

This register state does not store any values. Read operations always return (new) undefined values.

Definition at line 113 of file NullSemantics.h.

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

Inheritance diagram for Rose::BinaryAnalysis::InstructionSemantics::NullSemantics::RegisterState:
Inheritance graph
[legend]
Collaboration diagram for Rose::BinaryAnalysis::InstructionSemantics::NullSemantics::RegisterState:
Collaboration graph
[legend]

Public Types

using Super = BaseSemantics::RegisterState
 Base type.
 
using Ptr = RegisterStatePtr
 Shared-ownership pointer.
 
- Public Types inherited from Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::RegisterState
using Ptr = RegisterStatePtr
 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::RegisterStatePtr create (const BaseSemantics::SValuePtr &protoval, const RegisterDictionaryPtr &regdict) const override
 Virtual constructor.
 
virtual BaseSemantics::AddressSpacePtr clone () const override
 Deep-copy of this address space.
 
virtual bool merge (const BaseSemantics::AddressSpacePtr &, BaseSemantics::RiscOperators *addrOps, BaseSemantics::RiscOperators *valOps) override
 Merge address spaces for data flow analysis.
 
virtual void clear () override
 Removes stored values from the register state.
 
virtual void zero () override
 Set all registers to the zero.
 
virtual BaseSemantics::SValuePtr readRegister (RegisterDescriptor, const BaseSemantics::SValuePtr &, BaseSemantics::RiscOperators *) override
 Read a value from a register.
 
virtual BaseSemantics::SValuePtr peekRegister (RegisterDescriptor, const BaseSemantics::SValuePtr &, BaseSemantics::RiscOperators *) override
 Read a register without side effects.
 
virtual void writeRegister (RegisterDescriptor, const BaseSemantics::SValuePtr &, BaseSemantics::RiscOperators *) override
 Write a value to a register.
 
virtual void updateReadProperties (RegisterDescriptor) override
 Update register properties after reading a register.
 
virtual void updateWriteProperties (RegisterDescriptor, BaseSemantics::InputOutputProperty) override
 Update register properties after writing to a register.
 
virtual void hash (Combinatorics::Hasher &, BaseSemantics::RiscOperators *, BaseSemantics::RiscOperators *) const override
 Hash this address space.
 
virtual void print (std::ostream &, BaseSemantics::Formatter &) const override
 Print an address space.
 
- Public Member Functions inherited from Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::RegisterState
SValuePtr protoval () const
 Return the protoval.
 
MergerPtr merger () const
 Property: Merger.
 
void merger (const MergerPtr &m)
 Property: Merger.
 
RegisterDictionaryPtr registerDictionary () const
 Property: Register dictionary.
 
void registerDictionary (const RegisterDictionaryPtr &)
 Property: Register dictionary.
 
- 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 RegisterStatePtr instance (const BaseSemantics::SValuePtr &protoval, const RegisterDictionaryPtr &)
 
static RegisterStatePtr promote (const BaseSemantics::AddressSpacePtr &from)
 
- Static Public Member Functions inherited from Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::RegisterState
static RegisterStatePtr promote (const AddressSpacePtr &)
 

Protected Member Functions

 RegisterState (const RegisterState &other)
 
 RegisterState (const BaseSemantics::SValuePtr &protoval, const RegisterDictionaryPtr &)
 
- Protected Member Functions inherited from Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::RegisterState
 RegisterState (const SValuePtr &protoval, const RegisterDictionaryPtr &regdict)
 
- 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::RegisterState
RegisterDictionaryPtr regdict
 Registers that are able to be stored by this state.
 

Member Typedef Documentation

◆ Super

Base type.

Definition at line 116 of file NullSemantics.h.

◆ Ptr

Shared-ownership pointer.

Definition at line 119 of file NullSemantics.h.

Constructor & Destructor Documentation

◆ ~RegisterState()

Rose::BinaryAnalysis::InstructionSemantics::NullSemantics::RegisterState::~RegisterState ( )
virtual

Member Function Documentation

◆ create()

virtual BaseSemantics::RegisterStatePtr Rose::BinaryAnalysis::InstructionSemantics::NullSemantics::RegisterState::create ( const BaseSemantics::SValuePtr protoval,
const RegisterDictionaryPtr regdict 
) const
overridevirtual

Virtual constructor.

The protoval argument must be a non-null pointer to a semantic value which will be used only to create additional instances of the value via its virtual constructors. The prototypical value is normally of the same type for all parts of a semantic analysis. The register state must be compatible with the rest of the binary analysis objects in use.

Implements Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::RegisterState.

◆ clone()

virtual BaseSemantics::AddressSpacePtr Rose::BinaryAnalysis::InstructionSemantics::NullSemantics::RegisterState::clone ( ) const
overridevirtual

◆ merge()

virtual bool Rose::BinaryAnalysis::InstructionSemantics::NullSemantics::RegisterState::merge ( const BaseSemantics::AddressSpacePtr other,
BaseSemantics::RiscOperators addrOps,
BaseSemantics::RiscOperators valOps 
)
overridevirtual

Merge address spaces for data flow analysis.

Merges the other address space into this address space, returning true if this space changed.

Implements Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::AddressSpace.

◆ clear()

virtual void Rose::BinaryAnalysis::InstructionSemantics::NullSemantics::RegisterState::clear ( )
overridevirtual

Removes stored values from the register state.

Depending on the register state implementation, this could either store new, distinct undefined values in each register, or it could simply erase all information about stored values leaving the register state truly empty. For instance RegisterStateGeneric, which uses variable length arrays to store information about a dynamically changing set of registers, clears its arrays to zero length.

Register states can also be initialized by clearing them or by explicitly writing new values into each desired register (or both). See BaseSemantics::RegisterStateGeneric::initialize_nonoverlapping for one way to initialize that register state.

Implements Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::RegisterState.

◆ zero()

virtual void Rose::BinaryAnalysis::InstructionSemantics::NullSemantics::RegisterState::zero ( )
overridevirtual

◆ readRegister()

virtual BaseSemantics::SValuePtr Rose::BinaryAnalysis::InstructionSemantics::NullSemantics::RegisterState::readRegister ( RegisterDescriptor  reg,
const BaseSemantics::SValuePtr dflt,
BaseSemantics::RiscOperators ops 
)
overridevirtual

Read a value from a register.

The register descriptor, reg, not only describes which register, but also which bits of that register (e.g., "al", "ah", "ax", "eax", and "rax" are all the same hardware register on an amd64, but refer to different parts of that register). The RISC operations are provided so that they can be used to extract the correct bits from a wider hardware register if necessary.

The dflt value is written into the register state if the register was not defined in the state. By doing this, a subsequent read of the same register will return the same value. Some register states cannot distinguish between a register that was never accessed and a register that was only read, in which case dflt is not used since all registers are already initialized.

See BaseSemantics::RiscOperators::readRegister for more details.

Implements Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::RegisterState.

◆ peekRegister()

virtual BaseSemantics::SValuePtr Rose::BinaryAnalysis::InstructionSemantics::NullSemantics::RegisterState::peekRegister ( RegisterDescriptor  reg,
const BaseSemantics::SValuePtr dflt,
BaseSemantics::RiscOperators ops 
)
overridevirtual

Read a register without side effects.

This is similar to readRegister except it doesn't modify the register state in any way.

Implements Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::RegisterState.

◆ writeRegister()

virtual void Rose::BinaryAnalysis::InstructionSemantics::NullSemantics::RegisterState::writeRegister ( RegisterDescriptor  reg,
const BaseSemantics::SValuePtr value,
BaseSemantics::RiscOperators ops 
)
overridevirtual

Write a value to a register.

The register descriptor, reg, not only describes which register, but also which bits of that register (e.g., "al", "ah", "ax", "eax", and "rax" are all the same hardware register on an amd64, but refer to different parts of that register). The RISC operations are provided so that they can be used to insert the value bits into a wider the hardware register if necessary. See BaseSemantics::RiscOperators::readRegister for more details.

Implements Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::RegisterState.

◆ updateReadProperties()

virtual void Rose::BinaryAnalysis::InstructionSemantics::NullSemantics::RegisterState::updateReadProperties ( RegisterDescriptor  )
overridevirtual

Update register properties after reading a register.

This should be called by all implementations of BaseSemantics::RiscOperators::readRegister. Depending on the semantic domain, it usually adds the READ property to all bits of the register, and conditionally adds READ_BEFORE_WRITE and/or READ_UNINITIALIZED properties to parts of the register.

Implements Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::RegisterState.

◆ updateWriteProperties()

virtual void Rose::BinaryAnalysis::InstructionSemantics::NullSemantics::RegisterState::updateWriteProperties ( RegisterDescriptor  ,
BaseSemantics::InputOutputProperty   
)
overridevirtual

Update register properties after writing to a register.

This should be called by all implementations of BaseSemantics::RiscOperators::writeRegister. Depending on the domain, it usually adds the WRITE or INIT property to the bits of the rgister.

Implements Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::RegisterState.

◆ hash()

virtual void Rose::BinaryAnalysis::InstructionSemantics::NullSemantics::RegisterState::hash ( Combinatorics::Hasher ,
BaseSemantics::RiscOperators addrOps,
BaseSemantics::RiscOperators valOps 
) const
overridevirtual

Hash this address space.

Hashes this address space by appending its data to the specified hasher. The goal is to identify when two address spaces are the "same" and allow certain kinds of analyses to take shortcuts. The address space purpose and name are not included in the hash. Separate RISC operators are passed for the addresses and values of this address space and are used if the hashing requires any operations on the addresses or values.

Implements Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::AddressSpace.

◆ print()

virtual void Rose::BinaryAnalysis::InstructionSemantics::NullSemantics::RegisterState::print ( std::ostream &  ,
BaseSemantics::Formatter  
) const
overridevirtual

Print an address space.

The output most likely occupies more than one line and each emitted line will be terminated with a line feed.

Implements Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::AddressSpace.


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