ROSE 0.11.145.147
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
Rose::BinaryAnalysis::SymbolicExpressionParser::RegisterSubstituter Class Reference

Description

Expand register name to placeholder variables.

The problem with RegisterToValue is that the expansion from register name to register value occurs at parsing time, and parsing is a relatively slow operation. Therefore, this class takes a slightly different approach: at parsing time, register names are replaced by symbolic variables (placeholders), and information is returned about how these placeholders map to register names. Then, at a later time, a substition can be run to replace the placeholders with the register values.

Definition at line 323 of file SymbolicExpressionParser.h.

#include <Rose/BinaryAnalysis/SymbolicExpressionParser.h>

Inheritance diagram for Rose::BinaryAnalysis::SymbolicExpressionParser::RegisterSubstituter:
Inheritance graph
[legend]
Collaboration diagram for Rose::BinaryAnalysis::SymbolicExpressionParser::RegisterSubstituter:
Collaboration graph
[legend]

Public Types

typedef Sawyer::SharedPointer< RegisterSubstituterPtr
 Shared-ownership pointer.
 
typedef Sawyer::Container::BiMap< RegisterDescriptor, SymbolicExpression::PtrRegToVarMap
 
- Public Types inherited from Rose::BinaryAnalysis::SymbolicExpressionParser::AtomExpansion
typedef Sawyer::SharedPointer< AtomExpansionPtr
 Shared-ownership pointer to an AtomExpansion.
 
- Public Types inherited from Rose::BinaryAnalysis::SymbolicExpressionParser::Expansion
typedef Sawyer::SharedPointer< ExpansionPtr
 Shared-ownership pointer to an Expansion.
 

Public Member Functions

SymbolicExpression::Ptr immediateExpansion (const SymbolicExpressionParser::Token &) override
 Expand a parsed atom into some other expression.
 
SymbolicExpression::Ptr delayedExpansion (const SymbolicExpression::Ptr &, const SymbolicExpressionParser *) override
 Substitute one expression with another.
 
InstructionSemantics::BaseSemantics::RiscOperatorsPtr riscOperators () const
 Property: Semantic state used during delayed expansion.
 
void riscOperators (const InstructionSemantics::BaseSemantics::RiscOperatorsPtr &ops)
 Property: Semantic state used during delayed expansion.
 
- Public Member Functions inherited from Rose::BinaryAnalysis::SymbolicExpressionParser::Expansion
const std::string & title () const
 Property: Title to use for documentation.
 
void title (const std::string &s)
 Property: Title to use for documentation.
 
const std::string & docString () const
 Property: Documentation string.
 
void docString (const std::string &s)
 Property: Documentation string.
 
- Public Member Functions inherited from Sawyer::SharedObject
 SharedObject ()
 Default constructor.
 
 SharedObject (const SharedObject &)
 Copy constructor.
 
virtual ~SharedObject ()
 Virtual destructor.
 
SharedObjectoperator= (const SharedObject &)
 Assignment.
 

Static Public Member Functions

static Ptr instance (const RegisterDictionaryPtr &)
 Allocating constructor.
 

Protected Member Functions

 RegisterSubstituter (const RegisterDictionaryPtr &regdict)
 

Member Typedef Documentation

◆ Ptr

Shared-ownership pointer.

See Shared ownership.

Definition at line 326 of file SymbolicExpressionParser.h.

◆ RegToVarMap

Definition at line 329 of file SymbolicExpressionParser.h.

Constructor & Destructor Documentation

◆ RegisterSubstituter()

Rose::BinaryAnalysis::SymbolicExpressionParser::RegisterSubstituter::RegisterSubstituter ( const RegisterDictionaryPtr regdict)
inlineprotected

Definition at line 337 of file SymbolicExpressionParser.h.

Member Function Documentation

◆ riscOperators() [1/2]

InstructionSemantics::BaseSemantics::RiscOperatorsPtr Rose::BinaryAnalysis::SymbolicExpressionParser::RegisterSubstituter::riscOperators ( ) const
inline

Property: Semantic state used during delayed expansion.

This property holds a pointer to the semantic operators and its current state that's used during the second phase of expansion (delayedExpansion).

Definition at line 350 of file SymbolicExpressionParser.h.

◆ riscOperators() [2/2]

void Rose::BinaryAnalysis::SymbolicExpressionParser::RegisterSubstituter::riscOperators ( const InstructionSemantics::BaseSemantics::RiscOperatorsPtr ops)
inline

Property: Semantic state used during delayed expansion.

This property holds a pointer to the semantic operators and its current state that's used during the second phase of expansion (delayedExpansion).

Definition at line 353 of file SymbolicExpressionParser.h.

◆ immediateExpansion()

SymbolicExpression::Ptr Rose::BinaryAnalysis::SymbolicExpressionParser::RegisterSubstituter::immediateExpansion ( const SymbolicExpressionParser::Token name)
overridevirtual

Expand a parsed atom into some other expression.

This method takes a token parsed from the input and optionally replaces it with some other expression. For instance, a subclass that recognizes the token "true" would replace it with a single-bit constant 1. If this object does not recognize the token, it should return a null pointer. This phase of expansion occurs immediately during parsing; a second phase may occur later.

Implements Rose::BinaryAnalysis::SymbolicExpressionParser::AtomExpansion.

◆ delayedExpansion()

SymbolicExpression::Ptr Rose::BinaryAnalysis::SymbolicExpressionParser::RegisterSubstituter::delayedExpansion ( const SymbolicExpression::Ptr src,
const SymbolicExpressionParser  
)
overridevirtual

Substitute one expression with another.

This second phase of expansion occurs after parsing (perhaps much later) and is able to dynamically replace the given expression with some other expression. For instance, if this object recognizes register names, it it might replace the register names with variables in the first phase, and during the second phase read register values from a provided state.

If the input expression does not need to be substituted, then this function should return the original expression.

Reimplemented from Rose::BinaryAnalysis::SymbolicExpressionParser::Expansion.


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