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>
7 #include <Sawyer/IntervalSet.h>
8 #include <Sawyer/Map.h>
9 #include <boost/serialization/access.hpp>
12 namespace BinaryAnalysis {
39 unsigned majr_, minr_;
41 #ifdef ROSE_HAVE_BOOST_SERIALIZATION_LIB
43 friend class boost::serialization::access;
46 void serialize(S &s,
const unsigned ) {
47 s & BOOST_SERIALIZATION_NVP(majr_);
48 s & BOOST_SERIALIZATION_NVP(minr_);
53 MajorMinor(): majr_(0), minr_(0) {}
58 bool operator<(
const MajorMinor &other)
const {
59 return majr_ < other.majr_ || (majr_ == other.majr_ && minr_ < other.minr_);
62 unsigned get_major()
const {
return majr_; }
63 unsigned get_minor()
const {
return minr_; }
80 #ifdef ROSE_HAVE_BOOST_SERIALIZATION_LIB
82 friend class boost::serialization::access;
85 void serialize(S &s,
const unsigned ) {
86 s & BOOST_SERIALIZATION_NVP(map_);
113 return map_.
exists(reg) && map_[reg].overlaps(bitRange(reg));
121 return map_.
exists(reg) && map_[reg].contains(bitRange(reg));
void insert(RegisterDescriptor reg)
Insert register into container.
unsigned majorNumber() const
Property: Major number.
RegisterParts & operator&=(const RegisterParts &other)
Erase some register parts.
bool exists(const Key &key) const
Determine if a key exists.
size_t nBits() const
Property: Size in bits.
RegisterParts(RegisterDescriptor reg)
Constructor to insert a register.
RegisterParts operator-(const RegisterParts &other) const
Compute difference.
Value & insertMaybeDefault(const Key &key)
Conditionally insert a new key with default value.
Main namespace for the ROSE library.
Map & clear()
Remove all nodes.
Holds a set of registers without regard for register boundaries.
void erase(RegisterDescriptor reg)
Erase register from container.
A container holding a set of values.
std::vector< RegisterDescriptor > listAll(const RegisterDictionaryPtr &) const
List registers present.
static Interval baseSize(size_t lo, size_t size)
Construct an interval from one endpoint and a size.
bool isEmpty() const
Determines whether this container is empty.
void clear()
Erase everything.
std::vector< RegisterDescriptor > extract(const RegisterDictionaryPtr ®Dict, bool extractAll=false)
Extract individual registers.
Describes (part of) a physical CPU register.
bool isEmpty() const
Predicate checking whether this container is empty.
size_t offset() const
Property: Offset to least-significant bit.
RegisterParts operator&(const RegisterParts &other) const
Compute the intersection.
RegisterParts()
Default construct an object with no register parts.
bool existsAny(RegisterDescriptor reg) const
Predicate checking if part of a register is present.
unsigned minorNumber() const
Property: Minor number.
std::vector< RegisterDescriptor > listNamed(const RegisterDictionaryPtr &) const
List registers present.
RegisterParts & operator-=(const RegisterParts &other)
Erase some register parts.
bool isEmpty() const
Predicate returns true if the width is zero.
bool existsAll(RegisterDescriptor reg) const
Predicate checking if all of a register is present.
RegisterParts operator|(const RegisterParts &other) const
Compute the union.
RegisterParts & operator|=(const RegisterParts &other)
Add some register parts.