1#ifndef ROSE_BinaryAnalysis_InstructionSemantics_BaseSemantics_RegisterStateGeneric_H
2#define ROSE_BinaryAnalysis_InstructionSemantics_BaseSemantics_RegisterStateGeneric_H
3#include <featureTests.h>
4#ifdef ROSE_ENABLE_BINARY_ANALYSIS
6#include <Rose/BinaryAnalysis/AddressSet.h>
7#include <Rose/BinaryAnalysis/BasicTypes.h>
8#include <Rose/BinaryAnalysis/InstructionSemantics/BaseSemantics/RegisterState.h>
9#include <Rose/Exception.h>
11#include <boost/serialization/access.hpp>
12#include <boost/serialization/base_object.hpp>
13#include <boost/serialization/export.hpp>
14#include <Sawyer/IntervalSetMap.h>
17namespace BinaryAnalysis {
18namespace InstructionSemantics {
71#ifdef ROSE_HAVE_BOOST_SERIALIZATION_LIB
73 friend class boost::serialization::access;
76 void serialize(S &s,
const unsigned ) {
77 s & BOOST_SERIALIZATION_NVP(majr);
78 s & BOOST_SERIALIZATION_NVP(minr);
85 bool operator<(
const RegStore&)
const;
98#ifdef ROSE_HAVE_BOOST_SERIALIZATION_LIB
100 friend class boost::serialization::access;
103 void serialize(S &s,
const unsigned ) {
104 s & BOOST_SERIALIZATION_NVP(desc);
105 s & BOOST_SERIALIZATION_NVP(value);
160 bool accessModifiesExistingLocations_;
161 bool accessCreatesLocations_;
177#ifdef ROSE_HAVE_BOOST_SERIALIZATION_LIB
179 friend class boost::serialization::access;
182 void serialize(S &s,
const unsigned ) {
184 s & BOOST_SERIALIZATION_NVP(properties_);
185 s & BOOST_SERIALIZATION_NVP(writers_);
186 s & BOOST_SERIALIZATION_NVP(accessModifiesExistingLocations_);
187 s & BOOST_SERIALIZATION_NVP(accessCreatesLocations_);
553 virtual std::vector<RegisterDescriptor>
565 void deep_copy_values();
581 void assertStorageConditions(
const std::string &where,
RegisterDescriptor what)
const;
589#ifdef ROSE_HAVE_BOOST_SERIALIZATION_LIB
Guards whether access is able to create new locations.
Exception when register storage is not present.
Functors for traversing register values in a register state.
Guards whether access can change set of existing locations.
A RegisterState for any architecture.
virtual void updateReadProperties(RegisterDescriptor) override
Update register properties after reading a register.
virtual void zero() override
Set all registers to the zero.
virtual bool insertProperties(RegisterDescriptor, const InputOutputPropertySet &)
Insert Boolean properties.
virtual bool insertWriters(RegisterDescriptor, const AddressSet &writerVas)
Insert writer information.
virtual void print(std::ostream &, Formatter &) const override
Print an address space.
virtual void hash(Combinatorics::Hasher &, RiscOperators *addrOps, RiscOperators *valOps) const override
Hash this address space.
virtual ExtentMap stored_parts(RegisterDescriptor) const
Returns a description of which bits of a register are stored.
virtual void eraseWriters(RegisterDescriptor)
Erase all writers.
virtual void erase_register(RegisterDescriptor, RiscOperators *)
Cause a register to not be stored.
virtual SValuePtr readRegister(RegisterDescriptor, const SValuePtr &dflt, RiscOperators *) override
Read a value from a register.
virtual void clear() override
Removes stored values from the register state.
virtual void setWriters(RegisterDescriptor, const AddressSet &writers)
Set writer information.
virtual bool is_wholly_stored(RegisterDescriptor) const
Determines if the specified register is wholly stored in the state.
virtual void traverse(Visitor &)
Traverse register/value pairs.
virtual RegPairs overlappingRegisters(RegisterDescriptor) const
Find stored registers overlapping with specified register.
virtual bool hasWritersAny(RegisterDescriptor) const
Whether a register has writers.
virtual void initialize_large()
Initialize all registers of the dictionary.
virtual void eraseWriters()
Erase all writers.
virtual bool is_exactly_stored(RegisterDescriptor) const
Determines if the specified register is stored exactly in the state.
std::vector< RegPair > RegPairs
Vector of register/value pairs.
virtual bool is_partly_stored(RegisterDescriptor) const
Determines if some of the specified register is stored in the state.
static RegisterStateGenericPtr instance(const SValuePtr &protoval, const RegisterDictionaryPtr &)
Instantiate a new register state.
virtual void initialize_small()
Initialize all registers of the dictionary.
virtual AddressSpacePtr clone() const override
Deep-copy of this address space.
virtual void eraseProperties(RegisterDescriptor)
Erase all Boolean properties.
virtual bool hasPropertyAny(RegisterDescriptor, InputOutputProperty) const
Whether a register has the specified property.
virtual bool hasWritersAll(RegisterDescriptor) const
Whether a register has writers.
virtual AddressSet getWritersIntersection(RegisterDescriptor) const
Get writer information.
virtual AddressSet getWritersUnion(RegisterDescriptor) const
Get writer information.
virtual void eraseProperties()
Erase all Boolean properties.
virtual SValuePtr peekRegister(RegisterDescriptor, const SValuePtr &dflt, RiscOperators *) override
Read a register without side effects.
void initialize_nonoverlapping(const std::vector< RegisterDescriptor > &, bool initialize_to_zero)
Initialize the specified registers of the dictionary.
virtual bool eraseProperties(RegisterDescriptor, const InputOutputPropertySet &)
Erase Boolean properties.
virtual void eraseWriters(RegisterDescriptor, const AddressSet &writerVas)
Erase specified writers.
virtual void writeRegister(RegisterDescriptor, const SValuePtr &value, RiscOperators *) override
Write a value to a register.
bool accessModifiesExistingLocations() const
Property: Whether stored registers are adapted to access patterns.
bool accessCreatesLocations() const
Property: Whether access can create new locations.
virtual void updateWriteProperties(RegisterDescriptor, InputOutputProperty) override
Update register properties after writing to a register.
RegisterStateGenericPtr Ptr
Shared-ownership pointer.
static RegisterStateGenericPtr instance(const RegisterStateGenericPtr &other)
Instantiate a new copy of an existing register state.
virtual RegisterStatePtr create(const SValuePtr &protoval, const RegisterDictionaryPtr &) const override
Virtual constructor.
virtual bool hasPropertyAll(RegisterDescriptor, InputOutputProperty) const
Whether a register has the specified property.
virtual InputOutputPropertySet getPropertiesUnion(RegisterDescriptor) const
Get properties.
virtual std::vector< RegisterDescriptor > findProperties(const InputOutputPropertySet &required, const InputOutputPropertySet &prohibited=InputOutputPropertySet()) const
Get registers having certain properties.
virtual bool merge(const AddressSpacePtr &other, RiscOperators *addrOps, RiscOperators *valOps) override
Merge address spaces for data flow analysis.
virtual RegPairs get_stored_registers() const
Returns the list of all registers and their values.
Registers registers_
Values for registers that have been accessed.
static RegisterStateGenericPtr promote(const AddressSpacePtr &from)
Run-time promotion of a base address space pointer to a RegisterStateGeneric pointer.
virtual void setProperties(RegisterDescriptor, const InputOutputPropertySet &)
Assign property set.
virtual InputOutputPropertySet getPropertiesIntersection(RegisterDescriptor) const
Get properties.
The set of all registers and their values.
SValuePtr protoval() const
Return the protoval.
Base class for most instruction semantics RISC operators.
Describes (part of) a physical CPU register.
Base class for all ROSE exceptions.
Mapping from integers to sets.
Base classes for instruction semantics.
InputOutputProperty
Boolean properties related to I/O.
boost::shared_ptr< class RegisterStateGeneric > RegisterStateGenericPtr
Shared-ownership pointer to generic register states.
boost::shared_ptr< AddressSpace > AddressSpacePtr
Shared-ownership pointer for AddressSpace objects.
Sawyer::Container::Set< InputOutputProperty > InputOutputPropertySet
Set of Boolean properties.
boost::shared_ptr< RegisterState > RegisterStatePtr
Shared-ownership pointer to a register state.
A register descriptor and its value.