1 #ifndef ROSE_BinaryAnalysis_InstructionSemantics2_BaseSemantics_RegisterState_H
2 #define ROSE_BinaryAnalysis_InstructionSemantics2_BaseSemantics_RegisterState_H
3 #include <featureTests.h>
4 #ifdef ROSE_ENABLE_BINARY_ANALYSIS
6 #include <Rose/BinaryAnalysis/InstructionSemantics2/BaseSemantics/Merger.h>
7 #include <Rose/BinaryAnalysis/InstructionSemantics2/BaseSemantics/SValue.h>
8 #include <Rose/BinaryAnalysis/Registers.h>
10 #include <boost/enable_shared_from_this.hpp>
11 #include <boost/serialization/access.hpp>
12 #include <boost/serialization/export.hpp>
13 #include <boost/serialization/nvp.hpp>
14 #include <boost/serialization/shared_ptr.hpp>
15 #include <boost/serialization/version.hpp>
18 namespace BinaryAnalysis {
19 namespace InstructionSemantics2 {
29 class RegisterState:
public boost::enable_shared_from_this<RegisterState> {
43 #ifdef ROSE_HAVE_BOOST_SERIALIZATION_LIB
45 friend class boost::serialization::access;
48 void serialize(S &s,
const unsigned version) {
50 s & BOOST_SERIALIZATION_NVP(protoval_);
52 s & BOOST_SERIALIZATION_NVP(regdict);
64 : protoval_(protoval), regdict(regdict) {
65 ASSERT_not_null(protoval_);
69 virtual ~RegisterState() {}
134 void set_register_dictionary(
const RegisterDictionary *rd) ROSE_DEPRECATED(
"use registerDictionary property") {
148 virtual void clear() = 0;
151 virtual void zero() = 0;
193 void print(std::ostream &stream,
const std::string prefix =
"")
const;
194 virtual void print(std::ostream&, Formatter&)
const = 0;
203 void print(std::ostream &stream)
const { obj->print(stream, fmt); }
223 WithFormatter
operator+(
const std::string &linePrefix);
228 std::ostream& operator<<(std::ostream&,
const RegisterState&);
229 std::ostream& operator<<(std::ostream&,
const RegisterState::WithFormatter&);
virtual void hash(Combinatorics::Hasher &, RiscOperators *) const =0
Hash the register state.
MergerPtr merger() const
Property: Merger.
virtual RegisterStatePtr clone() const =0
Make a copy of this register state.
virtual void clear()=0
Removes stored values from the register state.
virtual bool merge(const RegisterStatePtr &other, RiscOperators *ops)=0
Merge register states for data flow analysis.
virtual void writeRegister(RegisterDescriptor reg, const SValuePtr &value, RiscOperators *ops)=0
Write a value to a register.
Main namespace for the ROSE library.
void print(std::ostream &stream, const std::string prefix="") const
Print the register contents.
virtual SValuePtr readRegister(RegisterDescriptor reg, const SValuePtr &dflt, RiscOperators *ops)=0
Read a value from a register.
RegisterStatePtr Ptr
Shared-ownership pointer for a RegisterState object.
The set of all registers and their values.
const RegisterDictionary * registerDictionary() const
Property: Register dictionary.
Base classes for instruction semantics.
Describes (part of) a physical CPU register.
WithFormatter operator+(Formatter &fmt)
Used for printing register states with formatting.
WithFormatter with_format(Formatter &fmt)
Used for printing register states with formatting.
void merger(const MergerPtr &m)
Property: Merger.
virtual RegisterStatePtr create(const SValuePtr &protoval, const RegisterDictionary *regdict) const =0
Virtual constructor.
const RegisterDictionary * regdict
Registers that are able to be stored by this state.
Sawyer::SharedPointer< SValue > SValuePtr
Shared-ownership pointer to a semantic value in any domain.
Defines registers available for a particular architecture.
virtual void zero()=0
Set all registers to the zero.
virtual SValuePtr peekRegister(RegisterDescriptor reg, const SValuePtr &dflt, RiscOperators *ops)=0
Read a register without side effects.
boost::shared_ptr< RegisterState > RegisterStatePtr
Shared-ownership pointer to a register state.
void registerDictionary(const RegisterDictionary *rd)
Property: Register dictionary.
SValuePtr protoval() const
Return the protoval.