1#ifndef ROSE_BinaryAnalysis_RegisterParts_H
2#define ROSE_BinaryAnalysis_RegisterParts_H
3#include <featureTests.h>
4#ifdef ROSE_ENABLE_BINARY_ANALYSIS
6#include <Rose/BinaryAnalysis/BasicTypes.h>
8#include <Sawyer/IntervalSet.h>
11#ifdef ROSE_ENABLE_BOOST_SERIALIZATION
12#include <boost/serialization/access.hpp>
16namespace BinaryAnalysis {
43 unsigned majr_, minr_;
45#ifdef ROSE_ENABLE_BOOST_SERIALIZATION
47 friend class boost::serialization::access;
50 void serialize(S &s,
const unsigned ) {
51 s & BOOST_SERIALIZATION_NVP(majr_);
52 s & BOOST_SERIALIZATION_NVP(minr_);
57 MajorMinor(): majr_(0), minr_(0) {}
62 bool operator<(
const MajorMinor &other)
const {
63 return majr_ < other.majr_ || (majr_ == other.majr_ && minr_ < other.minr_);
66 unsigned get_major()
const {
return majr_; }
67 unsigned get_minor()
const {
return minr_; }
84#ifdef ROSE_ENABLE_BOOST_SERIALIZATION
86 friend class boost::serialization::access;
89 void serialize(S &s,
const unsigned ) {
90 s & BOOST_SERIALIZATION_NVP(map_);
117 return map_.
exists(reg) && map_[reg].overlaps(bitRange(reg));
125 return map_.
exists(reg) && map_[reg].contains(bitRange(reg));
Describes (part of) a physical CPU register.
size_t offset() const
Property: Offset to least-significant bit.
unsigned minorNumber() const
Property: Minor number.
bool isEmpty() const
Predicate returns true if the width is zero.
unsigned majorNumber() const
Property: Major number.
size_t nBits() const
Property: Size in bits.
Holds a set of registers without regard for register boundaries.
RegisterParts(RegisterDescriptor reg)
Constructor to insert a register.
bool existsAll(RegisterDescriptor reg) const
Predicate checking if all of a register is present.
void erase(RegisterDescriptor reg)
Erase register from container.
RegisterParts()
Default construct an object with no register parts.
RegisterParts & operator|=(const RegisterParts &other)
Add some register parts.
bool existsAny(RegisterDescriptor reg) const
Predicate checking if part of a register is present.
void clear()
Erase everything.
RegisterParts operator|(const RegisterParts &other) const
Compute the union.
bool isEmpty() const
Predicate checking whether this container is empty.
RegisterParts operator&(const RegisterParts &other) const
Compute the intersection.
std::vector< RegisterDescriptor > extract(const RegisterDictionaryPtr ®Dict, bool extractAll=false)
Extract individual registers.
void insert(RegisterDescriptor reg)
Insert register into container.
RegisterParts & operator&=(const RegisterParts &other)
Erase some register parts.
RegisterParts operator-(const RegisterParts &other) const
Compute difference.
std::vector< RegisterDescriptor > listAll(const RegisterDictionaryPtr &) const
List registers present.
std::vector< RegisterDescriptor > listNamed(const RegisterDictionaryPtr &) const
List registers present.
RegisterParts & operator-=(const RegisterParts &other)
Erase some register parts.
A container holding a set of values.
Range of values delimited by endpoints.
static Interval baseSize(size_t lo, size_t size)
Construct an interval from one endpoint and a size.
Container associating values with keys.
bool exists(const Key &key) const
Determine if a key exists.
bool isEmpty() const
Determines whether this container is empty.
Value & insertMaybeDefault(const Key &key)
Conditionally insert a new key with default value.
Map & clear()
Remove all nodes.