IDA C++ SDK 9.2
Loading...
Searching...
No Matches
reglist_base_t< Derived > Struct Template Reference

A class for working with a list of registers. More...

#include <ua.hpp>

Public Member Functions

bool empty () const
void clear ()
int count () const
void add (int regnum)
template<typename... Args>
void add (int regnum, Args... args)
void add (const reglist_base_t &r)
void add_range (int first, int count)
void del (int regnum)
void del (const reglist_base_t &r)
void intersect (const reglist_base_t &r)
bool has (int regnum) const
bool has_any (const reglist_base_t &r) const
bool contains (const reglist_base_t &r) const
 DECLARE_COMPARISONS (reglist_base_t)
int for_each (std::function< int(int)> func) const
int first_reg () const
void print (outctx_t *out, std::function< void(outctx_t *, int)> print_reg, const char *delim) const

Public Attributes

uint64 regs = 0

Protected Member Functions

uint64 _encode (int regnum) const
int _decode (int bitnum) const

Detailed Description

template<class Derived>
struct reglist_base_t< Derived >

A class for working with a list of registers.

It is typically used for operands that encode such a list. For example, 'PUSH {R4-R7,LR}' in ARM or 'lwm $s0-$s1,$ra, 0x1C+var_s0($sp)' in microMIPS. It can also be used to return the list of registers that an instruction changes (spoils).

Note
Usually, such a function is called spoils(). This class represents a list of registers as a bitmask. To use this template, you need to derive your class from it, specifying the name of your class as the template parameter.
This pattern is known as CRTP. In the new class, you must define two methods:
  • 'uint64 encode(int regnum) const' This method returns a bitmask for the specified register REGNUM.
Such a mask may contain more than one bit. For example, in ARM, the FP-register D0 includes two registers S0 and S1, and its mask will contain two bits.
  • 'int decode(int bitnum) const' This method returns the register number for the specified bit number. For an example, refer to the 'reglist_t' class in arm.hpp.

Member Function Documentation

◆ empty()

template<class Derived>
bool reglist_base_t< Derived >::empty ( ) const
inline

◆ clear()

template<class Derived>
void reglist_base_t< Derived >::clear ( )
inline

◆ count()

template<class Derived>
int reglist_base_t< Derived >::count ( ) const
inline

◆ add() [1/3]

template<class Derived>
void reglist_base_t< Derived >::add ( int regnum)
inline

◆ add() [2/3]

template<class Derived>
template<typename... Args>
void reglist_base_t< Derived >::add ( int regnum,
Args... args )
inline

◆ add() [3/3]

template<class Derived>
void reglist_base_t< Derived >::add ( const reglist_base_t< Derived > & r)
inline

◆ add_range()

template<class Derived>
void reglist_base_t< Derived >::add_range ( int first,
int count )
inline

◆ del() [1/2]

template<class Derived>
void reglist_base_t< Derived >::del ( int regnum)
inline

◆ del() [2/2]

template<class Derived>
void reglist_base_t< Derived >::del ( const reglist_base_t< Derived > & r)
inline

◆ intersect()

template<class Derived>
void reglist_base_t< Derived >::intersect ( const reglist_base_t< Derived > & r)
inline

◆ has()

template<class Derived>
bool reglist_base_t< Derived >::has ( int regnum) const
inline

◆ has_any()

template<class Derived>
bool reglist_base_t< Derived >::has_any ( const reglist_base_t< Derived > & r) const
inline

◆ contains()

template<class Derived>
bool reglist_base_t< Derived >::contains ( const reglist_base_t< Derived > & r) const
inline

◆ DECLARE_COMPARISONS()

template<class Derived>
reglist_base_t< Derived >::DECLARE_COMPARISONS ( reglist_base_t< Derived > )
inline

◆ for_each()

template<class Derived>
int reglist_base_t< Derived >::for_each ( std::function< int(int)> func) const
inline

◆ first_reg()

template<class Derived>
int reglist_base_t< Derived >::first_reg ( ) const
inline

◆ print()

template<class Derived>
void reglist_base_t< Derived >::print ( outctx_t * out,
std::function< void(outctx_t *, int)> print_reg,
const char * delim ) const
inline

◆ _encode()

template<class Derived>
uint64 reglist_base_t< Derived >::_encode ( int regnum) const
inlineprotected

◆ _decode()

template<class Derived>
int reglist_base_t< Derived >::_decode ( int bitnum) const
inlineprotected

Member Data Documentation

◆ regs

template<class Derived>
uint64 reglist_base_t< Derived >::regs = 0

The documentation for this struct was generated from the following file:
  • /Users/geoffrey/ida-sdk/src/include/ua.hpp