ROSE  0.9.6a
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RegisterDescriptor Struct Reference

Describes (part of) a physical CPU register. More...

#include <Cxx_Grammar.h>

Public Member Functions

 RegisterDescriptor ()
 
 RegisterDescriptor (unsigned majr, unsigned minr, unsigned offset, unsigned nbits)
 
unsigned get_major () const
 
bool is_valid () const
 
RegisterDescriptorset_major (unsigned majr)
 
unsigned get_minor () const
 
RegisterDescriptorset_minor (unsigned minr)
 
unsigned get_offset () const
 
RegisterDescriptorset_offset (unsigned offset)
 
unsigned get_nbits () const
 
RegisterDescriptorset_nbits (unsigned nbits)
 
bool operator< (const RegisterDescriptor &other) const
 
bool operator== (const RegisterDescriptor &other) const
 
bool operator!= (const RegisterDescriptor &other) const
 
void print (std::ostream &o) const
 

Private Attributes

unsigned majr
 
unsigned minr
 Major type of register, such as integer, floating point, flag, etc. More...
 
unsigned offset
 Register number within major division. More...
 
unsigned nbits
 Low-bit offset within the physical register. More...
 

Friends

std::ostream & operator<< (std::ostream &, const RegisterDescriptor &)
 

Detailed Description

Describes (part of) a physical CPU register.

Some architectures have multiple names for physical registers. For example, a amd64 has a 64-bit integer register, parts of which are referred to as "rax", "eax", "ax", "al", and "ah". The purpose of a RegisterDescriptor is to describe what physical register (major and minor) is being referenced, and the part (offset and nbits) that's being referenced.

The reason for having a major and minor number to specify a register is to allow for different types of registers. For instance, an i686 has a set of 64-bit integer registers and a set of 80-bit floating point registers (among others). Having major and minor numbers allows the physical register set (such as defined by an instruction semantics policy) to be implemented as an array of 64-bit integers and an array of 80-bit floating points (among others). The array is selected by the major number while the element of the array is selected by the minor number.

The RegisterDescriptor type is part of a SgAsmRegisterReferenceExpression and also appears in the register dictionaries (RegisterDictionary) used in various places including the disassembler.

Definition at line 6419 of file Cxx_Grammar.h.

Constructor & Destructor Documentation

RegisterDescriptor::RegisterDescriptor ( )
inline

Definition at line 6421 of file Cxx_Grammar.h.

RegisterDescriptor::RegisterDescriptor ( unsigned  majr,
unsigned  minr,
unsigned  offset,
unsigned  nbits 
)
inline

Definition at line 6423 of file Cxx_Grammar.h.

Member Function Documentation

bool RegisterDescriptor::is_valid ( ) const
inline

Definition at line 6428 of file Cxx_Grammar.h.

References nbits.

RegisterDescriptor& RegisterDescriptor::set_major ( unsigned  majr)
inline

Definition at line 6431 of file Cxx_Grammar.h.

References majr.

unsigned RegisterDescriptor::get_minor ( ) const
inline
RegisterDescriptor& RegisterDescriptor::set_minor ( unsigned  minr)
inline

Definition at line 6438 of file Cxx_Grammar.h.

References minr.

unsigned RegisterDescriptor::get_offset ( ) const
inline
RegisterDescriptor& RegisterDescriptor::set_offset ( unsigned  offset)
inline

Definition at line 6445 of file Cxx_Grammar.h.

References offset.

unsigned RegisterDescriptor::get_nbits ( ) const
inline
RegisterDescriptor& RegisterDescriptor::set_nbits ( unsigned  nbits)
inline

Definition at line 6452 of file Cxx_Grammar.h.

References nbits.

Referenced by RegisterDictionary::resize().

bool RegisterDescriptor::operator< ( const RegisterDescriptor other) const

Definition at line 36 of file Registers.C.

References majr, minr, nbits, and offset.

bool RegisterDescriptor::operator== ( const RegisterDescriptor other) const

Definition at line 24 of file Registers.C.

References majr, minr, nbits, and offset.

bool RegisterDescriptor::operator!= ( const RegisterDescriptor other) const

Definition at line 30 of file Registers.C.

void RegisterDescriptor::print ( std::ostream &  o) const
inline

Definition at line 6459 of file Cxx_Grammar.h.

References majr, minr, nbits, and offset.

Referenced by operator<<().

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  o,
const RegisterDescriptor reg 
)
friend

Definition at line 12 of file Registers.C.

Member Data Documentation

unsigned RegisterDescriptor::majr
private

Definition at line 6465 of file Cxx_Grammar.h.

Referenced by get_major(), operator<(), operator==(), print(), and set_major().

unsigned RegisterDescriptor::minr
private

Major type of register, such as integer, floating point, flag, etc.

Definition at line 6466 of file Cxx_Grammar.h.

Referenced by get_minor(), operator<(), operator==(), print(), and set_minor().

unsigned RegisterDescriptor::offset
private

Register number within major division.

Definition at line 6467 of file Cxx_Grammar.h.

Referenced by get_offset(), operator<(), operator==(), print(), and set_offset().

unsigned RegisterDescriptor::nbits
private

Low-bit offset within the physical register.

Definition at line 6468 of file Cxx_Grammar.h.

Referenced by get_nbits(), is_valid(), operator<(), operator==(), print(), and set_nbits().


The documentation for this struct was generated from the following files: