yield f"#define SVP64_NAME_MAX {max(map(lambda entry: len(entry.name), entries))}"
yield ""
- yield "enum svp64_reg_category {"
- yield " SVP64_REG_CATEGORY_UNKNOWN,"
- yield " SVP64_REG_CATEGORY_GPR,"
- yield " SVP64_REG_CATEGORY_FPR,"
- yield " SVP64_REG_CATEGORY_CR_3BIT,"
- yield " SVP64_REG_CATEGORY_CR_5BIT,"
- yield "};"
- yield ""
-
- yield "enum svp64_reg_category"
- yield "svp64_reg_category(unsigned char type);"
-
yield "#ifdef __cplusplus"
yield "}"
yield "#endif"
yield " sizeof (svp64_entries) / sizeof (svp64_entries[0]);"
yield ""
- yield "#ifndef BC"
- yield "#define BC CRB"
- yield "#endif"
- yield ""
- yield "enum svp64_reg_category"
- yield "svp64_reg_category(unsigned char type)"
- yield "{"
- yield " size_t i;"
- yield " static struct {"
- yield " unsigned char type;"
- yield " unsigned char category;"
- yield " } const table[] = {"
- yield " {BF , SVP64_REG_CATEGORY_CR_3BIT},"
- yield " {BFA , SVP64_REG_CATEGORY_CR_3BIT},"
- yield " {BA , SVP64_REG_CATEGORY_CR_5BIT},"
- yield " {BB , SVP64_REG_CATEGORY_CR_5BIT},"
- yield " {BC , SVP64_REG_CATEGORY_CR_5BIT},"
- yield " {BI , SVP64_REG_CATEGORY_CR_5BIT},"
- yield " {BT , SVP64_REG_CATEGORY_CR_5BIT},"
- yield " {RA , SVP64_REG_CATEGORY_GPR},"
- yield " {RB , SVP64_REG_CATEGORY_GPR},"
- yield " {RC , SVP64_REG_CATEGORY_GPR},"
- yield " {RS , SVP64_REG_CATEGORY_GPR},"
- yield " {RT , SVP64_REG_CATEGORY_GPR},"
- yield " {FRA , SVP64_REG_CATEGORY_FPR},"
- yield " {FRB , SVP64_REG_CATEGORY_FPR},"
- yield " {FRC , SVP64_REG_CATEGORY_FPR},"
- yield " {FRS , SVP64_REG_CATEGORY_FPR},"
- yield " {FRT , SVP64_REG_CATEGORY_FPR},"
- yield " };"
- yield ""
- yield " for (i = 0; i < sizeof (table) / sizeof (table[0]); ++i) {"
- yield " if (table[i].type == type)"
- yield " return (enum svp64_reg_category)table[i].category;"
- yield " }"
- yield ""
- yield " return SVP64_REG_CATEGORY_UNKNOWN;"
- yield "}"
-
return {
Codegen.PPC_SVP64_H: ppc_svp64_h,
Codegen.PPC_SVP64_OPC_C: ppc_svp64_opc_c,