1#ifndef ROSE_BinaryAnalysis_InstructionSemantics_BaseSemantics_AddressSpace_H
2#define ROSE_BinaryAnalysis_InstructionSemantics_BaseSemantics_AddressSpace_H
3#include <featureTests.h>
4#ifdef ROSE_ENABLE_BINARY_ANALYSIS
5#include <Rose/BinaryAnalysis/InstructionSemantics/BaseSemantics/BasicTypes.h>
7#include <Rose/BinaryAnalysis/Address.h>
8#include <Rose/BinaryAnalysis/RegisterDescriptor.h>
9#include <Combinatorics.h>
11#include <boost/enable_shared_from_this.hpp>
12#include <boost/serialization/access.hpp>
13#include <boost/serialization/nvp.hpp>
14#include <boost/serialization/shared_ptr.hpp>
17namespace BinaryAnalysis {
18namespace InstructionSemantics {
88class AddressSpace:
public boost::enable_shared_from_this<AddressSpace> {
100#ifdef ROSE_HAVE_BOOST_SERIALIZATION_LIB
102 friend class boost::serialization::access;
105 void serialize(S &s,
const unsigned ) {
106 s & BOOST_SERIALIZATION_NVP(purpose_);
107 s & BOOST_SERIALIZATION_NVP(name_);
146 const std::string&
name()
const;
195 void print(std::ostream&,
const std::string &prefix =
"")
const;
207 void print(std::ostream&)
const;
231std::ostream& operator<<(std::ostream&,
const AddressSpace&);
Addresses for base address space.
AddressSpaceAddress(RegisterDescriptor)
Construct an address that's a concrete register.
AddressSpaceAddress()
Construct a null address.
Sawyer::Optional< Address > toConcrete() const
Convert an address to a concrete value if possible.
bool isEmpty() const
True if the address is null.
SValuePtr toAbstract(RiscOperators &addrOps) const
Convert an address to an abstract value if possible.
AddressSpaceAddress(Address)
Construct an address that's a concrete value.
RegisterDescriptor registerDescriptor() const
Return the underlying address.
AddressSpaceAddress(const SValuePtr &)
Construct an address that's an abstract value.
const Sawyer::Optional< Address > & concrete() const
Return the underlying address.
SValuePtr abstract() const
Return the underlying address.
Base class for address spaces.
const std::string & name() const
Property: Name for this address space.
void purpose(Purpose)
Property: Purpose of this address space.
virtual void write(const AddressSpaceAddress &, const SValuePtr &value, RiscOperators &addrOps, RiscOperators &valOps)
Write a value to an address space.
virtual SValuePtr peek(const AddressSpaceAddress &, const SValuePtr &dflt, RiscOperators &addrOps, RiscOperators &valOps)
Read without causing side effects.
virtual Ptr clone() const =0
Deep-copy of this address space.
WithFormatter with_format(Formatter &)
Used for printing address spaces with formatting.
virtual SValuePtr read(const AddressSpaceAddress &, const SValuePtr &dflt, RiscOperators &addrOps, RiscOperators &valOps)
Read a value from the address space.
void print(std::ostream &, const std::string &prefix="") const
Print an address space.
virtual void hash(Combinatorics::Hasher &, RiscOperators *addrOps, RiscOperators *valOps) const =0
Hash this address space.
WithFormatter operator+(Formatter &)
Used for printing address spaces with formatting.
AddressSpacePurpose Purpose
Purpose for the address space.
std::string printableName() const
Printable name for this address space.
virtual void clear()=0
Remove all values.
AddressSpacePtr Ptr
Shared-ownership pointer.
void name(const std::string &)
Property: Name for this address space.
WithFormatter operator+(const std::string &linePrefix)
Used for printing address spaces with formatting.
virtual void print(std::ostream &, Formatter &) const =0
Print an address space.
Purpose purpose() const
Property: Purpose of this address space.
virtual bool merge(const AddressSpacePtr &other, RiscOperators *addrOps, RiscOperators *valOps)=0
Merge address spaces for data flow analysis.
Base class for most instruction semantics RISC operators.
Describes (part of) a physical CPU register.
Holds a value or nothing.
Base classes for instruction semantics.
AddressSpacePurpose
Purpose that an address space serves.
boost::shared_ptr< AddressSpace > AddressSpacePtr
Shared-ownership pointer for AddressSpace objects.
std::uint64_t Address
Address.