ROSE 0.11.145.192
|
Semantic domain composed of subdomains.
The MultiSemantics semantic domain is a pseudo domain composed of one or more subdomains. Each of the RISC operations implemented in this policy invokes the operation in each of the enabled subdomains. The type of values manipulated by the MultiSemantics domain are the union of the values from each of the subdomains. One could accomplish the same thing by instantiating multiple instruction semantics objects and calling each one for each instruction. However, using this MultiSemantics domain is cleaner and easier to specialize.
A multi-domain is created by instantiating all the subdomain RiscOperators and adding them one by one to the multi-domain RiscOperators object via its add_subdomain() method. Each call to add_subdomain() returns an ID number for the subdomain, by which the subdomain's RiscOperators and SValue objects can be accessed given a multi-domain RiscOperators or SValue object.
A sub-domain can be marked as active or inactive. When the a multi-domain RISC operation is called, the same operation will be invoked in each of the active sub-domains (provided the operation's inputs are valid for that sub-domain). If the operation returns a multi-value (as most do), then the sub-values corresponding to called sub-domains will be marked valid and the other sub-values are marked invalid.
Using a multi-domain directly is not all that interesting. Where the real convenience comes is in specializing the multi-domain to do things like convert values from one domain to another. For example, consider two semantic domains called Alpha and Beta implemented operating on values of type AlphaValue and BetaValue. Assume that for some reason, and ADD operation in Beta is expensive and that a BetaValue can be constructed from an AlphaValue. Therefore, it is more efficient to skip the ADD operation in Beta and instead compute the Beta sum from the Alpha sum. One does that by subclassing the MultiDomain::RiscOperators and overriding its add() method. Here's the basic idea, sans error handling, etc.:
Classes | |
class | Formatter |
Helps printing multidomain values by allowing the user to specify a name for each subdomain. More... | |
class | RiscOperators |
Defines RISC operators for the MultiSemantics domain. More... | |
class | SValue |
Type of values manipulated by the MultiSemantics domain. More... | |
Typedefs | |
typedef Sawyer::SharedPointer< class SValue > | SValuePtr |
Shared-ownership pointer to a multi-semantic value. | |
typedef void | RegisterState |
typedef boost::shared_ptr< void > | RegisterStatePtr |
Shared-ownership pointer to a multi-semantics register state. | |
typedef void | MemoryState |
typedef boost::shared_ptr< void > | MemoryStatePtr |
Shared-ownership pointer to a multi-semantics memory state. | |
typedef void | State |
typedef boost::shared_ptr< void > | StatePtr |
Shared-ownership pointer to a multi-semantics state. | |
typedef boost::shared_ptr< class RiscOperators > | RiscOperatorsPtr |
Shared-ownership pointer to multi-semantics RISC operators. | |
typedef Sawyer::SharedPointer<class SValue> Rose::BinaryAnalysis::InstructionSemantics::MultiSemantics::SValuePtr |
Shared-ownership pointer to a multi-semantic value.
Definition at line 73 of file MultiSemantics.h.
typedef void Rose::BinaryAnalysis::InstructionSemantics::MultiSemantics::RegisterState |
Definition at line 200 of file MultiSemantics.h.
typedef boost::shared_ptr<void> Rose::BinaryAnalysis::InstructionSemantics::MultiSemantics::RegisterStatePtr |
Shared-ownership pointer to a multi-semantics register state.
Definition at line 203 of file MultiSemantics.h.
typedef void Rose::BinaryAnalysis::InstructionSemantics::MultiSemantics::MemoryState |
Definition at line 209 of file MultiSemantics.h.
typedef boost::shared_ptr<void> Rose::BinaryAnalysis::InstructionSemantics::MultiSemantics::MemoryStatePtr |
Shared-ownership pointer to a multi-semantics memory state.
Definition at line 212 of file MultiSemantics.h.
typedef void Rose::BinaryAnalysis::InstructionSemantics::MultiSemantics::State |
Definition at line 218 of file MultiSemantics.h.
typedef boost::shared_ptr<void> Rose::BinaryAnalysis::InstructionSemantics::MultiSemantics::StatePtr |
Shared-ownership pointer to a multi-semantics state.
Definition at line 221 of file MultiSemantics.h.
typedef boost::shared_ptr<class RiscOperators> Rose::BinaryAnalysis::InstructionSemantics::MultiSemantics::RiscOperatorsPtr |
Shared-ownership pointer to multi-semantics RISC operators.
Definition at line 228 of file MultiSemantics.h.