/*
- * Copyright (C) 2012
+ * Copyright (C) 2012, 2013
* Wolfgang Bumiller
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
"union",
"array",
- "nil"
+ "nil",
+ "<no-expression>"
};
size_t type_sizeof_[TYPE_COUNT] = {
0, /* TYPE_UNION */
0, /* TYPE_ARRAY */
0, /* TYPE_NIL */
+ 0, /* TYPE_NOESPR */
};
uint16_t type_store_instr[TYPE_COUNT] = {
AINSTR_END, /* union */
AINSTR_END, /* array */
AINSTR_END, /* nil */
+ AINSTR_END, /* noexpr */
};
uint16_t field_store_instr[TYPE_COUNT] = {
AINSTR_END, /* union */
AINSTR_END, /* array */
AINSTR_END, /* nil */
+ AINSTR_END, /* noexpr */
};
uint16_t type_storep_instr[TYPE_COUNT] = {
AINSTR_END, /* union */
AINSTR_END, /* array */
AINSTR_END, /* nil */
+ AINSTR_END, /* noexpr */
};
uint16_t type_eq_instr[TYPE_COUNT] = {
AINSTR_END, /* union */
AINSTR_END, /* array */
AINSTR_END, /* nil */
+ AINSTR_END, /* noexpr */
};
uint16_t type_ne_instr[TYPE_COUNT] = {
AINSTR_END, /* union */
AINSTR_END, /* array */
AINSTR_END, /* nil */
+ AINSTR_END, /* noexpr */
};
uint16_t type_not_instr[TYPE_COUNT] = {
AINSTR_END, /* union */
AINSTR_END, /* array */
AINSTR_END, /* nil */
+ AINSTR_END, /* noexpr */
};
/* protos */
if (param->vtype == TYPE_FIELD)
stmt.opcode = field_store_instr[param->fieldtype];
+ else if (param->vtype == TYPE_NIL)
+ stmt.opcode = INSTR_STORE_V;
else
stmt.opcode = type_store_instr[param->vtype];
stmt.o1.u1 = ir_value_code_addr(param);
if (param->vtype == TYPE_FIELD)
stmt.opcode = field_store_instr[param->fieldtype];
+ else if (param->vtype == TYPE_NIL)
+ stmt.opcode = INSTR_STORE_V;
else
stmt.opcode = type_store_instr[param->vtype];
stmt.o1.u1 = ir_value_code_addr(param);
}
}
+ /* generate nil */
+ ir_value_code_setaddr(self->nil, vec_size(code_globals));
+ vec_push(code_globals, 0);
+ vec_push(code_globals, 0);
+ vec_push(code_globals, 0);
+
/* generate global temps */
self->first_common_globaltemp = vec_size(code_globals);
for (i = 0; i < self->max_globaltemps; ++i) {