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#include <boost/serialization/access.hpp>
14namespace BinaryAnalysis {
41 unsigned majr_, minr_;
43#ifdef ROSE_HAVE_BOOST_SERIALIZATION_LIB
45 friend class boost::serialization::access;
48 void serialize(S &s,
const unsigned ) {
49 s & BOOST_SERIALIZATION_NVP(majr_);
50 s & BOOST_SERIALIZATION_NVP(minr_);
55 MajorMinor(): majr_(0), minr_(0) {}
60 bool operator<(
const MajorMinor &other)
const {
61 return majr_ < other.majr_ || (majr_ == other.majr_ && minr_ < other.minr_);
64 unsigned get_major()
const {
return majr_; }
65 unsigned get_minor()
const {
return minr_; }
82#ifdef ROSE_HAVE_BOOST_SERIALIZATION_LIB
84 friend class boost::serialization::access;
87 void serialize(S &s,
const unsigned ) {
88 s & BOOST_SERIALIZATION_NVP(map_);
115 return map_.
exists(reg) && map_[reg].overlaps(bitRange(reg));
123 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.