ROSE 0.11.145.246
DispatcherCil.h
1#ifndef ROSE_BinaryAnalysis_InstructionSemantics_DispatcherCil_H
2#define ROSE_BinaryAnalysis_InstructionSemantics_DispatcherCil_H
3#include <featureTests.h>
4#ifdef ROSE_ENABLE_BINARY_ANALYSIS
5
6#include <Rose/BinaryAnalysis/BasicTypes.h>
7#include <Rose/BinaryAnalysis/InstructionSemantics/BaseSemantics.h>
8#include <Rose/BinaryAnalysis/InstructionEnumsCil.h>
9
10#ifdef ROSE_ENABLE_BOOST_SERIALIZATION
11#include <boost/serialization/access.hpp>
12#include <boost/serialization/base_object.hpp>
13#include <boost/serialization/export.hpp>
14#include <boost/serialization/split_member.hpp>
15#endif
16
17namespace Rose {
18namespace BinaryAnalysis {
19namespace InstructionSemantics {
20
22typedef boost::shared_ptr<class DispatcherCil> DispatcherCilPtr;
23
25public:
28
31
32public:
42 // Floating-point condition code bits
44 // Floating-point status register exception bits
47 // Floating-point status register accrued exception bits
51#ifdef ROSE_ENABLE_BOOST_SERIALIZATION
52private:
53 friend class boost::serialization::access;
54
55 template<class S>
56 void save(S &s, const unsigned /*version*/) const {
57 s & BOOST_SERIALIZATION_BASE_OBJECT_NVP(Super);
58 };
59
60 template<class S>
61 void load(S &s, const unsigned /*version*/) {
62 s & BOOST_SERIALIZATION_BASE_OBJECT_NVP(Super);
64 iproc_init();
66 }
67
68 BOOST_SERIALIZATION_SPLIT_MEMBER();
69#endif
70
71private:
72 DispatcherCil(); // used only by boost::serialization
73
74protected:
75 DispatcherCil(const Architecture::BaseConstPtr&); // prototypical constructor
76
78
82 void iproc_init();
83
88
93
94public:
96
101
104
107
110
112 virtual RegisterDescriptor stackPointerRegister() const override;
113 virtual int iprocKey(SgAsmInstruction *insn_) const override;
114 virtual BaseSemantics::SValuePtr read(SgAsmExpression*, size_t value_nbits, size_t addr_nbits=0) override;
115
118 const BaseSemantics::SValuePtr &b, SgAsmType *bType);
119
122 const BaseSemantics::SValuePtr &b, SgAsmType *bType);
123
129 void updateFpsrExcOvfl(const BaseSemantics::SValuePtr &intermediate, SgAsmType *valueType,
130 SgAsmType *rounding, SgAsmType *dstType);
131
139 void updateFpsrExcUnfl(const BaseSemantics::SValuePtr &intermediate, SgAsmType *valueType,
140 SgAsmType *rounding, SgAsmType *dstType);
141
144
147
150
153};
154
155} // namespace
156} // namespace
157} // namespace
158
159#ifdef ROSE_ENABLE_BOOST_SERIALIZATION
161#endif
162
163#endif
164#endif
Dispatches instructions through the RISC layer.
Definition Dispatcher.h:46
Base class for most instruction semantics RISC operators.
static DispatcherCilPtr instance(const Architecture::BaseConstPtr &, const BaseSemantics::RiscOperatorsPtr &)
Constructor.
void iproc_init()
Loads the iproc table with instruction processing functors.
void updateFpsrExcUnfl(const BaseSemantics::SValuePtr &intermediate, SgAsmType *valueType, SgAsmType *rounding, SgAsmType *dstType)
Set or clear FPSR EXC UVFL bit.
void updateFpsrExcInan(const BaseSemantics::SValuePtr &a, SgAsmType *aType, const BaseSemantics::SValuePtr &b, SgAsmType *bType)
Set or clear FPSR EXC INAN bit.
virtual BaseSemantics::SValuePtr read(SgAsmExpression *, size_t value_nbits, size_t addr_nbits=0) override
Reads an R-value expression.
virtual int iprocKey(SgAsmInstruction *insn_) const override
Given an instruction, return the InsnProcessor key that can be used as an index into the iproc_table.
void memory_init()
Make sure memory is set up correctly.
void updateFpsrExcIde(const BaseSemantics::SValuePtr &a, SgAsmType *aType, const BaseSemantics::SValuePtr &b, SgAsmType *bType)
Set or clear FPSR EXC IDE bit.
BaseSemantics::SValuePtr condition(CilInstructionKind, BaseSemantics::RiscOperators *)
Determines if an instruction should branch.
void updateFpsrExcInex()
Set or clear FPSR EXC INEX bit.
DispatcherCilPtr Ptr
Shared-ownership pointer.
void updateFpsrExcOvfl(const BaseSemantics::SValuePtr &intermediate, SgAsmType *valueType, SgAsmType *rounding, SgAsmType *dstType)
Set or clear FPSR EXC OVFL bit.
virtual RegisterDescriptor stackPointerRegister() const override
Returns the stack pointer register.
static DispatcherCilPtr instance(const Architecture::BaseConstPtr &)
Construct a prototypical dispatcher.
void regcache_init()
Load the cached register descriptors.
static DispatcherCilPtr promote(const BaseSemantics::DispatcherPtr &)
Dynamic cast to DispatcherCilPtr with assertion.
virtual RegisterDescriptor instructionPointerRegister() const override
Returns the instruction pointer register.
void accumulateFpExceptions()
Update accrued floating-point exceptions.
virtual BaseSemantics::DispatcherPtr create(const BaseSemantics::RiscOperatorsPtr &) const override
Virtual constructor.
void adjustFpConditionCodes(const BaseSemantics::SValuePtr &result, SgAsmFloatType *)
Set floating point condition codes according to result.
Describes (part of) a physical CPU register.
Base class for expressions.
Floating point types.
Base class for machine instructions.
Base class for binary types.
std::shared_ptr< const Base > BaseConstPtr
Reference counted pointer for Architecture::Base.
boost::shared_ptr< RiscOperators > RiscOperatorsPtr
Shared-ownership pointer to a RISC operators object.
boost::shared_ptr< Dispatcher > DispatcherPtr
Shared-ownership pointer to a semantics instruction dispatcher.
boost::shared_ptr< class DispatcherCil > DispatcherCilPtr
Shared-ownership pointer to an CIL instruction dispatcher.
The ROSE library.