// file : arch/v1/arch_inst.c // project : Salis-VM // author : Paul Oliver #include #include #include #include #define ARCH_EXPORT_INST_COUNT #include "arch_spec.h" #include "arch_inst.h" wchar_t arch_inst_symbol(uint8_t inst) { assert(inst < ARCH_INST_COUNT); assert(inst_enum_count == ARCH_INST_COUNT); switch (inst) { #define ARCH_SPEC_INST(label, symbol, core) case label: return symbol; ARCH_SPEC_INST_SET(core) #undef ARCH_SPEC_INST } assert(false); return L'\0'; } const char *arch_inst_mnemonic(uint8_t inst) { assert(inst < ARCH_INST_COUNT); assert(inst_enum_count == ARCH_INST_COUNT); switch (inst) { #define ARCH_SPEC_INST(label, symbol, core) case label: return #label; ARCH_SPEC_INST_SET(core) #undef ARCH_SPEC_INST } assert(false); return NULL; }