1#ifndef ROSE_BinaryAnalysis_RegisterDescriptor_H 
    2#define ROSE_BinaryAnalysis_RegisterDescriptor_H 
    3#include <featureTests.h> 
    4#ifdef ROSE_ENABLE_BINARY_ANALYSIS 
    6#include <Sawyer/Interval.h> 
    8#ifdef ROSE_ENABLE_BOOST_SERIALIZATION 
    9#include <boost/serialization/access.hpp> 
   13namespace BinaryAnalysis {
 
   54    static const uint32_t EMPTY_PATTERN     = 0x000005ff; 
 
   55    static const uint32_t OFFSET_WIDTH_MASK = 0x0003ffff; 
 
   57#ifdef ROSE_ENABLE_BOOST_SERIALIZATION 
   59    friend class boost::serialization::access;
 
   62    void serialize(S &s, 
const unsigned ) {
 
   63        s & BOOST_SERIALIZATION_NVP(data_);
 
   72        : data_(EMPTY_PATTERN) {}
 
 
  124        return (data_ >> 18) & 0x3ff;                   
 
 
  140        if ((data_ & OFFSET_WIDTH_MASK) == EMPTY_PATTERN)
 
  142        unsigned offsetField = (data_ >> 9) & 0x1ff;    
 
  143        unsigned widthField = data_ & 0x1ff;            
 
  144        if (offsetField + widthField == 512)
 
 
  159        if ((data_ & OFFSET_WIDTH_MASK) == EMPTY_PATTERN)
 
  161        unsigned offsetField = (data_ >> 9) & 0x1ff;    
 
  162        unsigned widthField = data_ & 0x1ff;            
 
  163        if (offsetField + widthField == 512)
 
  165        return widthField + 1;
 
 
  175        if (
const size_t n = 
nBits()) {
 
 
  220    void this_type_does_not_support_comparisons()
 const {}
 
  222    operator unspecified_bool()
 const {
 
  223        return isEmpty() ? 0 : &RegisterDescriptor::this_type_does_not_support_comparisons;
 
  232        return data_ < other.data_;
 
 
  240        return data_ == other.data_;
 
 
  248        return data_ != other.data_;
 
 
  282    unsigned get_major()
 const {
 
  285    bool is_valid()
 const {
 
  292    unsigned get_minor()
 const {
 
  299    unsigned get_offset()
 const {
 
  306    unsigned get_nbits()
 const {
 
 
Describes (part of) a physical CPU register.
 
bool operator<(RegisterDescriptor other) const
Compare two descriptors.
 
void raw(uint32_t r)
The raw value of the descriptor.
 
static RegisterDescriptor fromRaw(uint32_t raw)
Construct a descriptor from a raw value.
 
void offset(size_t)
Property: Offset to least-significant bit.
 
static unsigned maxMajor()
Maximum possible major number.
 
bool operator==(RegisterDescriptor other) const
Check descriptors for equality.
 
static unsigned maxMinor()
Maximum possible minor number.
 
static unsigned maxOffset()
Maximum possible bit offset.
 
void nBits(size_t)
Property: Size in bits.
 
void majorNumber(unsigned)
Property: Major number.
 
bool operator!=(RegisterDescriptor other) const
Check descriptors for inequality.
 
RegisterDescriptor(unsigned majr, unsigned minr, size_t offset, size_t width)
Construct a descriptor from its constituent parts.
 
RegisterDescriptor()
Create an empty register descriptor.
 
RegisterDescriptor operator&(RegisterDescriptor other) const
Compute the intersection of two register descriptors.
 
std::string toString() const
Show the properties as a string.
 
size_t offset() const
Property: Offset to least-significant bit.
 
void print(std::ostream &o) const
Print all properties.
 
bool isSubsetOf(RegisterDescriptor other) const
True if this descriptor is a subset of the specified descriptor.
 
void setOffsetWidth(size_t offset, size_t nBits)
Set offset and size at the same time.
 
unsigned minorNumber() const
Property: Minor number.
 
uint32_t raw() const
The raw value of the descriptor.
 
Sawyer::Container::Interval< size_t > bits() const
Bit range.
 
bool isEmpty() const
Predicate returns true if the width is zero.
 
static unsigned maxNBits()
Maximum possible size in bits.
 
bool isValid() const
Predicate returns true if width is non-zero.
 
void minorNumber(unsigned)
Property: Minor number.
 
unsigned majorNumber() const
Property: Major number.
 
unsigned hash() const
Hash value.
 
size_t nBits() const
Property: Size in bits.
 
Range of values delimited by endpoints.
 
static Interval baseSize(T lo, T size)
Construct an interval from one endpoint and a size.