mirror of
https://github.com/DarkPlacesEngine/gmqcc.git
synced 2025-01-18 22:31:36 +00:00
Not an assembler instruction, but virtual instruction used by the IR.
This commit is contained in:
parent
18c317a787
commit
b9f46f4ef7
4 changed files with 34 additions and 40 deletions
2
ast.c
2
ast.c
|
@ -2834,7 +2834,7 @@ bool ast_switch_codegen(ast_switch *self, ast_function *func, bool lvalue, ir_va
|
|||
return true;
|
||||
|
||||
cmpinstr = type_eq_instr[irop->vtype];
|
||||
if (cmpinstr >= AINSTR_END) {
|
||||
if (cmpinstr >= VINSTR_END) {
|
||||
ast_type_to_string(self->operand, typestr, sizeof(typestr));
|
||||
compile_error(ast_ctx(self), "invalid type to perform a switch on: %s", typestr);
|
||||
return false;
|
||||
|
|
8
gmqcc.h
8
gmqcc.h
|
@ -683,17 +683,11 @@ enum {
|
|||
INSTR_BITAND,
|
||||
INSTR_BITOR,
|
||||
|
||||
/*
|
||||
* Virtual instructions used by the assembler
|
||||
* keep at the end but before virtual instructions
|
||||
* for the IR below.
|
||||
*/
|
||||
AINSTR_END,
|
||||
|
||||
/*
|
||||
* Virtual instructions used by the IR
|
||||
* Keep at the end!
|
||||
*/
|
||||
VINSTR_END,
|
||||
VINSTR_PHI,
|
||||
VINSTR_JUMP,
|
||||
VINSTR_COND,
|
||||
|
|
60
ir.c
60
ir.c
|
@ -83,11 +83,11 @@ uint16_t type_store_instr[TYPE_COUNT] = {
|
|||
|
||||
INSTR_STORE_V, /* variant, should never be accessed */
|
||||
|
||||
AINSTR_END, /* struct */
|
||||
AINSTR_END, /* union */
|
||||
AINSTR_END, /* array */
|
||||
AINSTR_END, /* nil */
|
||||
AINSTR_END, /* noexpr */
|
||||
VINSTR_END, /* struct */
|
||||
VINSTR_END, /* union */
|
||||
VINSTR_END, /* array */
|
||||
VINSTR_END, /* nil */
|
||||
VINSTR_END, /* noexpr */
|
||||
};
|
||||
|
||||
uint16_t field_store_instr[TYPE_COUNT] = {
|
||||
|
@ -107,11 +107,11 @@ uint16_t field_store_instr[TYPE_COUNT] = {
|
|||
|
||||
INSTR_STORE_V, /* variant, should never be accessed */
|
||||
|
||||
AINSTR_END, /* struct */
|
||||
AINSTR_END, /* union */
|
||||
AINSTR_END, /* array */
|
||||
AINSTR_END, /* nil */
|
||||
AINSTR_END, /* noexpr */
|
||||
VINSTR_END, /* struct */
|
||||
VINSTR_END, /* union */
|
||||
VINSTR_END, /* array */
|
||||
VINSTR_END, /* nil */
|
||||
VINSTR_END, /* noexpr */
|
||||
};
|
||||
|
||||
uint16_t type_storep_instr[TYPE_COUNT] = {
|
||||
|
@ -131,11 +131,11 @@ uint16_t type_storep_instr[TYPE_COUNT] = {
|
|||
|
||||
INSTR_STOREP_V, /* variant, should never be accessed */
|
||||
|
||||
AINSTR_END, /* struct */
|
||||
AINSTR_END, /* union */
|
||||
AINSTR_END, /* array */
|
||||
AINSTR_END, /* nil */
|
||||
AINSTR_END, /* noexpr */
|
||||
VINSTR_END, /* struct */
|
||||
VINSTR_END, /* union */
|
||||
VINSTR_END, /* array */
|
||||
VINSTR_END, /* nil */
|
||||
VINSTR_END, /* noexpr */
|
||||
};
|
||||
|
||||
uint16_t type_eq_instr[TYPE_COUNT] = {
|
||||
|
@ -155,11 +155,11 @@ uint16_t type_eq_instr[TYPE_COUNT] = {
|
|||
|
||||
INSTR_EQ_V, /* variant, should never be accessed */
|
||||
|
||||
AINSTR_END, /* struct */
|
||||
AINSTR_END, /* union */
|
||||
AINSTR_END, /* array */
|
||||
AINSTR_END, /* nil */
|
||||
AINSTR_END, /* noexpr */
|
||||
VINSTR_END, /* struct */
|
||||
VINSTR_END, /* union */
|
||||
VINSTR_END, /* array */
|
||||
VINSTR_END, /* nil */
|
||||
VINSTR_END, /* noexpr */
|
||||
};
|
||||
|
||||
uint16_t type_ne_instr[TYPE_COUNT] = {
|
||||
|
@ -179,11 +179,11 @@ uint16_t type_ne_instr[TYPE_COUNT] = {
|
|||
|
||||
INSTR_NE_V, /* variant, should never be accessed */
|
||||
|
||||
AINSTR_END, /* struct */
|
||||
AINSTR_END, /* union */
|
||||
AINSTR_END, /* array */
|
||||
AINSTR_END, /* nil */
|
||||
AINSTR_END, /* noexpr */
|
||||
VINSTR_END, /* struct */
|
||||
VINSTR_END, /* union */
|
||||
VINSTR_END, /* array */
|
||||
VINSTR_END, /* nil */
|
||||
VINSTR_END, /* noexpr */
|
||||
};
|
||||
|
||||
uint16_t type_not_instr[TYPE_COUNT] = {
|
||||
|
@ -203,11 +203,11 @@ uint16_t type_not_instr[TYPE_COUNT] = {
|
|||
|
||||
INSTR_NOT_V, /* variant, should never be accessed */
|
||||
|
||||
AINSTR_END, /* struct */
|
||||
AINSTR_END, /* union */
|
||||
AINSTR_END, /* array */
|
||||
AINSTR_END, /* nil */
|
||||
AINSTR_END, /* noexpr */
|
||||
VINSTR_END, /* struct */
|
||||
VINSTR_END, /* union */
|
||||
VINSTR_END, /* array */
|
||||
VINSTR_END, /* nil */
|
||||
VINSTR_END, /* noexpr */
|
||||
};
|
||||
|
||||
/* protos */
|
||||
|
|
4
parser.c
4
parser.c
|
@ -1101,7 +1101,7 @@ static bool parser_sy_apply_operator(parser_t *parser, shunt *sy)
|
|||
}
|
||||
else
|
||||
assignop = type_storep_instr[exprs[0]->expression.vtype];
|
||||
if (assignop == AINSTR_END || !ast_compare_type(field->expression.next, exprs[1]))
|
||||
if (assignop == VINSTR_END || !ast_compare_type(field->expression.next, exprs[1]))
|
||||
{
|
||||
ast_type_to_string(field->expression.next, ty1, sizeof(ty1));
|
||||
ast_type_to_string(exprs[1], ty2, sizeof(ty2));
|
||||
|
@ -1128,7 +1128,7 @@ static bool parser_sy_apply_operator(parser_t *parser, shunt *sy)
|
|||
assignop = type_store_instr[exprs[0]->expression.vtype];
|
||||
}
|
||||
|
||||
if (assignop == AINSTR_END) {
|
||||
if (assignop == VINSTR_END) {
|
||||
ast_type_to_string(exprs[0], ty1, sizeof(ty1));
|
||||
ast_type_to_string(exprs[1], ty2, sizeof(ty2));
|
||||
compile_error(ctx, "invalid types in assignment: cannot assign %s to %s", ty2, ty1);
|
||||
|
|
Loading…
Reference in a new issue