ROSE  0.11.98.0
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
Rose::BinaryAnalysis::SymbolicExprParser::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 322 of file SymbolicExprParser.h.

#include <Rose/BinaryAnalysis/SymbolicExprParser.h>

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

Public Types

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

Public Member Functions

SymbolicExpr::Ptr immediateExpansion (const SymbolicExprParser::Token &) override
 Expand a parsed atom into some other expression. More...
 
SymbolicExpr::Ptr delayedExpansion (const SymbolicExpr::Ptr &, const SymbolicExprParser *) 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::SymbolicExprParser::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 SymbolicExprParser.h.

Member Function Documentation

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

Allocating constructor.

InstructionSemantics::BaseSemantics::RiscOperatorsPtr Rose::BinaryAnalysis::SymbolicExprParser::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 349 of file SymbolicExprParser.h.

void Rose::BinaryAnalysis::SymbolicExprParser::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 352 of file SymbolicExprParser.h.

SymbolicExpr::Ptr Rose::BinaryAnalysis::SymbolicExprParser::RegisterSubstituter::immediateExpansion ( const SymbolicExprParser::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::SymbolicExprParser::AtomExpansion.

SymbolicExpr::Ptr Rose::BinaryAnalysis::SymbolicExprParser::RegisterSubstituter::delayedExpansion ( const SymbolicExpr::Ptr src,
const SymbolicExprParser parser 
)
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::SymbolicExprParser::Expansion.


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