ROSE 0.11.145.192
RegisterState.h
1#ifndef ROSE_BinaryAnalysis_InstructionSemantics_BaseSemantics_RegisterState_H
2#define ROSE_BinaryAnalysis_InstructionSemantics_BaseSemantics_RegisterState_H
3#include <featureTests.h>
4#ifdef ROSE_ENABLE_BINARY_ANALYSIS
5
6#include <Rose/BinaryAnalysis/BasicTypes.h>
7#include <Rose/BinaryAnalysis/InstructionSemantics/BaseSemantics/AddressSpace.h>
8#include <Rose/BinaryAnalysis/InstructionSemantics/BaseSemantics/Merger.h>
9#include <Rose/BinaryAnalysis/InstructionSemantics/BaseSemantics/SValue.h>
10#include <Rose/BinaryAnalysis/RegisterDictionary.h>
11
12#include <boost/serialization/access.hpp>
13#include <boost/serialization/export.hpp>
14#include <boost/serialization/nvp.hpp>
15#include <boost/serialization/shared_ptr.hpp>
16#include <boost/serialization/version.hpp>
17
18namespace Rose {
19namespace BinaryAnalysis {
20namespace InstructionSemantics {
21namespace BaseSemantics {
22
24// Register States
26
31public:
34
35private:
36 MergerPtr merger_;
37 SValuePtr protoval_;
39protected:
43 // Serialization
44#ifdef ROSE_HAVE_BOOST_SERIALIZATION_LIB
45private:
46 friend class boost::serialization::access;
47
48 template<class S>
49 void serialize(S &s, const unsigned version) {
50 //s & merger_; -- not saved
51 s & BOOST_SERIALIZATION_BASE_OBJECT_NVP(AddressSpace);
52 s & BOOST_SERIALIZATION_NVP(protoval_);
53 if (version >= 1)
54 s & BOOST_SERIALIZATION_NVP(regdict);
55 }
56#endif
57
58
60 // Real constructors
61protected:
62 RegisterState(); // for serialization
63
65
66public:
67 virtual ~RegisterState();
68
70 // Static allocating constructors. None are needed--this class is abstract.
71
72
74 // Virtual constructors.
75public:
81
83 // Dynamic pointer casts. No-op since this is the base class.
84public:
85 static RegisterStatePtr promote(const AddressSpacePtr&);
86
87public:
89 // The rest of the API...
90
99 MergerPtr merger() const { return merger_; }
100 void merger(const MergerPtr &m) { merger_ = m; }
104 SValuePtr protoval() const { return protoval_; }
105
126 virtual void clear() = 0;
127
129 virtual void zero() = 0;
130
145
150
157
164 virtual void writeRegister(RegisterDescriptor reg, const SValuePtr &value, RiscOperators *ops) = 0;
165
171};
172
173} // namespace
174} // namespace
175} // namespace
176} // namespace
177
178BOOST_CLASS_VERSION(Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::RegisterState, 1);
179BOOST_CLASS_EXPORT_KEY(Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::RegisterState);
180
181#endif
182#endif
virtual void updateWriteProperties(RegisterDescriptor, InputOutputProperty)=0
Update register properties after writing to a register.
virtual SValuePtr peekRegister(RegisterDescriptor reg, const SValuePtr &dflt, RiscOperators *ops)=0
Read a register without side effects.
RegisterDictionaryPtr registerDictionary() const
Property: Register dictionary.
virtual void writeRegister(RegisterDescriptor reg, const SValuePtr &value, RiscOperators *ops)=0
Write a value to a register.
virtual void updateReadProperties(RegisterDescriptor)=0
Update register properties after reading a register.
virtual RegisterStatePtr create(const SValuePtr &protoval, const RegisterDictionaryPtr &regdict) const =0
Virtual constructor.
virtual SValuePtr readRegister(RegisterDescriptor reg, const SValuePtr &dflt, RiscOperators *ops)=0
Read a value from a register.
virtual void clear()=0
Removes stored values from the register state.
RegisterDictionaryPtr regdict
Registers that are able to be stored by this state.
Base class for most instruction semantics RISC operators.
Describes (part of) a physical CPU register.
Base classes for instruction semantics.
boost::shared_ptr< AddressSpace > AddressSpacePtr
Shared-ownership pointer for AddressSpace objects.
boost::shared_ptr< RegisterState > RegisterStatePtr
Shared-ownership pointer to a register state.
The ROSE library.