ROSE  0.9.9.139
Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
Rose::BinaryAnalysis::InstructionSemantics2::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 133 of file NullSemantics2.h.

#include <NullSemantics2.h>

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

Public Member Functions

virtual BaseSemantics::RegisterStatePtr create (const BaseSemantics::SValuePtr &protoval, const RegisterDictionary *regdict) const ROSE_OVERRIDE
 Virtual constructor. More...
 
virtual BaseSemantics::RegisterStatePtr clone () const ROSE_OVERRIDE
 Make a copy of this register state. More...
 
virtual bool merge (const BaseSemantics::RegisterStatePtr &other_, BaseSemantics::RiscOperators *) ROSE_OVERRIDE
 Merge register states for data flow analysis. More...
 
virtual void clear () ROSE_OVERRIDE
 Removes stored values from the register state. More...
 
virtual void zero () ROSE_OVERRIDE
 Set all registers to the zero. More...
 
virtual BaseSemantics::SValuePtr readRegister (RegisterDescriptor reg, const BaseSemantics::SValuePtr &dflt, BaseSemantics::RiscOperators *ops) ROSE_OVERRIDE
 Read a value from a register. More...
 
virtual void writeRegister (RegisterDescriptor reg, const BaseSemantics::SValuePtr &value, BaseSemantics::RiscOperators *ops) ROSE_OVERRIDE
 Write a value to a register. More...
 
virtual void print (std::ostream &, BaseSemantics::Formatter &) const ROSE_OVERRIDE
 Print the register contents. More...
 
- Public Member Functions inherited from Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::RegisterState
SValuePtr protoval () const
 Return the protoval. More...
 
SValuePtr get_protoval () const ROSE_DEPRECATED("use protoval instead")
 
MergerPtr merger () const
 Property: Merger. More...
 
void merger (const MergerPtr &m)
 Property: Merger. More...
 
const RegisterDictionaryget_register_dictionary () const
 The register dictionary should be compatible with the register dictionary used for other parts of binary analysis. More...
 
void set_register_dictionary (const RegisterDictionary *rd)
 The register dictionary should be compatible with the register dictionary used for other parts of binary analysis. More...
 
void print (std::ostream &stream, const std::string prefix="") const
 Print the register contents. More...
 
WithFormatter with_format (Formatter &fmt)
 Used for printing register states with formatting. More...
 
WithFormatter operator+ (Formatter &fmt)
 Used for printing register states with formatting. More...
 

Static Public Member Functions

static RegisterStatePtr instance (const BaseSemantics::SValuePtr &protoval, const RegisterDictionary *regdict)
 
static RegisterStatePtr promote (const BaseSemantics::RegisterStatePtr &from)
 
- Static Public Member Functions inherited from Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::RegisterState
static RegisterStatePtr promote (const RegisterStatePtr &x)
 

Protected Member Functions

 RegisterState (const RegisterState &other)
 
 RegisterState (const BaseSemantics::SValuePtr &protoval, const RegisterDictionary *regdict)
 
- Protected Member Functions inherited from Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::RegisterState
 RegisterState (const SValuePtr &protoval, const RegisterDictionary *regdict)
 

Additional Inherited Members

- Public Types inherited from Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::RegisterState
typedef RegisterStatePtr Ptr
 Shared-ownership pointer for a RegisterState object. More...
 
- Protected Attributes inherited from Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::RegisterState
const RegisterDictionaryregdict
 Registers that are able to be stored by this state. More...
 

Member Function Documentation

virtual BaseSemantics::RegisterStatePtr Rose::BinaryAnalysis::InstructionSemantics2::NullSemantics::RegisterState::create ( const BaseSemantics::SValuePtr protoval,
const RegisterDictionary regdict 
) const
inlinevirtual

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::InstructionSemantics2::BaseSemantics::RegisterState.

Definition at line 146 of file NullSemantics2.h.

virtual BaseSemantics::RegisterStatePtr Rose::BinaryAnalysis::InstructionSemantics2::NullSemantics::RegisterState::clone ( ) const
inlinevirtual

Make a copy of this register state.

Implements Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::RegisterState.

Definition at line 151 of file NullSemantics2.h.

virtual bool Rose::BinaryAnalysis::InstructionSemantics2::NullSemantics::RegisterState::merge ( const BaseSemantics::RegisterStatePtr other,
BaseSemantics::RiscOperators ops 
)
inlinevirtual

Merge register states for data flow analysis.

Merges the other state into this state, returning true if this state changed.

Implements Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::RegisterState.

Definition at line 161 of file NullSemantics2.h.

virtual void Rose::BinaryAnalysis::InstructionSemantics2::NullSemantics::RegisterState::clear ( )
inlinevirtual

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, RegisterStateX86, which stores register values using fixed length arrays assigns new undefined values to each element of those arrays, whereas 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 RegisterStateGeneric::initialize_nonoverlapping for one way to initialize that register state.

Implements Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::RegisterState.

Definition at line 165 of file NullSemantics2.h.

virtual void Rose::BinaryAnalysis::InstructionSemantics2::NullSemantics::RegisterState::zero ( )
inlinevirtual

Set all registers to the zero.

Implements Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::RegisterState.

Definition at line 166 of file NullSemantics2.h.

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

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 RiscOperators::readRegister for more details.

Implements Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::RegisterState.

Definition at line 169 of file NullSemantics2.h.

References Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::RegisterState::protoval().

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

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 RiscOperators::readRegister for more details.

Implements Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::RegisterState.

Definition at line 174 of file NullSemantics2.h.

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

Print the register contents.

This emits one line per register and contains the register name and its value.

Implements Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::RegisterState.

Definition at line 177 of file NullSemantics2.h.


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