YASM_ARCH_CHECK_ID_INSN, /**< An instruction. */
YASM_ARCH_CHECK_ID_PREFIX, /**< An instruction prefix. */
YASM_ARCH_CHECK_ID_REG, /**< A register. */
+ YASM_ARCH_CHECK_ID_REGGROUP, /**< A register group. */
YASM_ARCH_CHECK_ID_SEGREG,/**< a segment register (for memory overrides). */
YASM_ARCH_CHECK_ID_TARGETMOD /**< A target modifier (for jumps) */
} yasm_arch_check_id_retval;
*/
unsigned int (*get_reg_size) (yasm_arch *arch, unsigned long reg);
+ /** Module-level implementation of yasm_arch_reggroup_get_reg().
+ * Call yasm_arch_reggroup_get_reg() instead of calling this function.
+ */
+ unsigned long (*reggroup_get_reg) (yasm_arch *arch, unsigned long reggroup,
+ unsigned long regindex);
+
/** Module-level implementation of yasm_arch_reg_print().
* Call yasm_arch_reg_print() instead of calling this function.
*/
*/
unsigned int yasm_arch_get_reg_size(yasm_arch *arch, unsigned long reg);
+/** Get a specific register of a register group, based on the register
+ * group and the index within the group.
+ * \param arch architecture
+ * \param reggroup register group
+ * \param regindex register index
+ * \return 0 if regindex is not valid for that register group, otherwise the
+ * specific register value.
+ */
+unsigned long yasm_arch_reggroup_get_reg(yasm_arch *arch,
+ unsigned long reggroup,
+ unsigned long regindex);
+
/** Print a register. For debugging purposes.
* \param arch architecture
* \param reg register
return 2;
}
+static unsigned long
+lc3b_reggroup_get_reg(/*@unused@*/ yasm_arch *arch,
+ /*@unused@*/ unsigned long reggroup,
+ /*@unused@*/ unsigned long regindex)
+{
+ return 0;
+}
+
static void
lc3b_reg_print(/*@unused@*/ yasm_arch *arch, unsigned long reg, FILE *f)
{
yasm_lc3b__intnum_fixup_rel,
yasm_lc3b__intnum_tobytes,
lc3b_get_reg_size,
+ lc3b_reggroup_get_reg,
lc3b_reg_print,
NULL, /*yasm_lc3b__segreg_print*/
lc3b_ea_create_expr,
return 0;
}
+static unsigned long
+x86_reggroup_get_reg(yasm_arch *arch, unsigned long reggroup,
+ unsigned long regindex)
+{
+ yasm_arch_x86 *arch_x86 = (yasm_arch_x86 *)arch;
+ switch ((x86_expritem_reg_size)(reggroup & ~0xFUL)) {
+ case X86_XMMREG:
+ if (arch_x86->mode_bits == 64) {
+ if (regindex > 15)
+ return 0;
+ return reggroup | (regindex & 15);
+ }
+ /*@fallthrough@*/
+ case X86_MMXREG:
+ case X86_FPUREG:
+ if (regindex > 7)
+ return 0;
+ return reggroup | (regindex & 7);
+ default:
+ yasm_internal_error(N_("bad register group"));
+ }
+ return 0;
+}
+
static void
x86_reg_print(yasm_arch *arch, unsigned long reg, FILE *f)
{
yasm_x86__intnum_fixup_rel,
yasm_x86__intnum_tobytes,
yasm_x86__get_reg_size,
+ x86_reggroup_get_reg,
x86_reg_print,
x86_segreg_print,
yasm_x86__ea_create_expr,