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


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 322 of file SymbolicExpressionParser.h.

#include <Rose/BinaryAnalysis/SymbolicExpressionParser.h>

Inheritance diagram for Rose::BinaryAnalysis::SymbolicExpressionParser::RegisterSubstituter:
Inheritance graph
Collaboration diagram for Rose::BinaryAnalysis::SymbolicExpressionParser::RegisterSubstituter:
Collaboration graph

Public Types

typedef Sawyer::SharedPointer< RegisterSubstituterPtr
 Shared-ownership pointer. More...
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. More...
- Public Types inherited from Rose::BinaryAnalysis::SymbolicExpressionParser::Expansion
typedef Sawyer::SharedPointer< ExpansionPtr
 Shared-ownership pointer to an Expansion. More...

Public Member Functions

SymbolicExpression::Ptr immediateExpansion (const SymbolicExpressionParser::Token &) override
 Expand a parsed atom into some other expression. More...
SymbolicExpression::Ptr delayedExpansion (const SymbolicExpression::Ptr &, const SymbolicExpressionParser *) override
 Substitute one expression with another. More...
InstructionSemantics::BaseSemantics::RiscOperatorsPtr riscOperators () const
 Property: Semantic state used during delayed expansion. More...
void riscOperators (const InstructionSemantics::BaseSemantics::RiscOperatorsPtr &ops)
 Property: Semantic state used during delayed expansion. More...
- 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. More...
void docString (const std::string &s)
 Property: Documentation string. More...
- Public Member Functions inherited from Sawyer::SharedObject
 SharedObject ()
 Default constructor. More...
 SharedObject (const SharedObject &)
 Copy constructor. More...
virtual ~SharedObject ()
 Virtual destructor. More...
SharedObjectoperator= (const SharedObject &)
 Assignment. More...

Static Public Member Functions

static Ptr instance (const RegisterDictionaryPtr &)
 Allocating constructor. More...

Protected Member Functions

 RegisterSubstituter (const RegisterDictionaryPtr &regdict)

Member Typedef Documentation

Shared-ownership pointer.

See Shared ownership.

Definition at line 325 of file SymbolicExpressionParser.h.

Member Function Documentation

static Ptr Rose::BinaryAnalysis::SymbolicExpressionParser::RegisterSubstituter::instance ( const RegisterDictionaryPtr )

Allocating constructor.

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

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 349 of file SymbolicExpressionParser.h.

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

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 352 of file SymbolicExpressionParser.h.

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

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.

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

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: