ROSE 0.11.145.237
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#ifdef ROSE_ENABLE_BOOST_SERIALIZATION
13#include <boost/serialization/access.hpp>
14#include <boost/serialization/export.hpp>
15#include <boost/serialization/nvp.hpp>
16#include <boost/serialization/shared_ptr.hpp>
17#include <boost/serialization/version.hpp>
18#endif
19
20namespace Rose {
21namespace BinaryAnalysis {
22namespace InstructionSemantics {
23namespace BaseSemantics {
24
26// Register States
28
33public:
36
37private:
38 MergerPtr merger_;
39 SValuePtr protoval_;
41protected:
45 // Serialization
46#ifdef ROSE_ENABLE_BOOST_SERIALIZATION
47private:
48 friend class boost::serialization::access;
49
50 template<class S>
51 void serialize(S &s, const unsigned version) {
52 //s & merger_; -- not saved
53 s & BOOST_SERIALIZATION_BASE_OBJECT_NVP(AddressSpace);
54 s & BOOST_SERIALIZATION_NVP(protoval_);
55 if (version >= 1)
56 s & BOOST_SERIALIZATION_NVP(regdict);
57 }
58#endif
59
60
62 // Real constructors
63protected:
64 RegisterState(); // for serialization
65
67
68public:
69 virtual ~RegisterState();
70
72 // Static allocating constructors. None are needed--this class is abstract.
73
74
76 // Virtual constructors.
77public:
83
85 // Dynamic pointer casts. No-op since this is the base class.
86public:
87 static RegisterStatePtr promote(const AddressSpacePtr&);
88
89public:
91 // The rest of the API...
92
101 MergerPtr merger() const { return merger_; }
102 void merger(const MergerPtr &m) { merger_ = m; }
106 SValuePtr protoval() const { return protoval_; }
107
128 virtual void clear() = 0;
129
131 virtual void zero() = 0;
132
147
152
159
166 virtual void writeRegister(RegisterDescriptor reg, const SValuePtr &value, RiscOperators *ops) = 0;
167
173};
174
175} // namespace
176} // namespace
177} // namespace
178} // namespace
179
180#ifdef ROSE_ENABLE_BOOST_SERIALIZATION
183#endif
184
185#endif
186#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.