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.