"<no-expression>"
};
-size_t type_sizeof_[TYPE_COUNT] = {
+static size_t type_sizeof_[TYPE_COUNT] = {
1, /* TYPE_VOID */
1, /* TYPE_STRING */
1, /* TYPE_FLOAT */
0, /* TYPE_NOESPR */
};
-uint16_t type_store_instr[TYPE_COUNT] = {
+const uint16_t type_store_instr[TYPE_COUNT] = {
INSTR_STORE_F, /* should use I when having integer support */
INSTR_STORE_S,
INSTR_STORE_F,
VINSTR_END, /* noexpr */
};
-uint16_t field_store_instr[TYPE_COUNT] = {
+const uint16_t field_store_instr[TYPE_COUNT] = {
INSTR_STORE_FLD,
INSTR_STORE_FLD,
INSTR_STORE_FLD,
VINSTR_END, /* noexpr */
};
-uint16_t type_storep_instr[TYPE_COUNT] = {
+const uint16_t type_storep_instr[TYPE_COUNT] = {
INSTR_STOREP_F, /* should use I when having integer support */
INSTR_STOREP_S,
INSTR_STOREP_F,
VINSTR_END, /* noexpr */
};
-uint16_t type_eq_instr[TYPE_COUNT] = {
+const uint16_t type_eq_instr[TYPE_COUNT] = {
INSTR_EQ_F, /* should use I when having integer support */
INSTR_EQ_S,
INSTR_EQ_F,
VINSTR_END, /* noexpr */
};
-uint16_t type_ne_instr[TYPE_COUNT] = {
+const uint16_t type_ne_instr[TYPE_COUNT] = {
INSTR_NE_F, /* should use I when having integer support */
INSTR_NE_S,
INSTR_NE_F,
VINSTR_END, /* noexpr */
};
-uint16_t type_not_instr[TYPE_COUNT] = {
+const uint16_t type_not_instr[TYPE_COUNT] = {
INSTR_NOT_F, /* should use I when having integer support */
- INSTR_NOT_S,
+ VINSTR_END, /* not to be used, depends on string related -f flags */
INSTR_NOT_F,
INSTR_NOT_V,
INSTR_NOT_ENT,
return true;
}
-static char *ir_strdup(const char *str)
-{
- if (str && !*str) {
- /* actually dup empty strings */
- char *out = (char*)mem_a(1);
- *out = 0;
- return out;
- }
- return util_strdup(str);
-}
-
bool ir_value_set_string(ir_value *self, const char *str)
{
if (self->vtype != TYPE_STRING)
return false;
- self->constval.vstring = ir_strdup(str);
+ self->constval.vstring = util_strdupe(str);
self->hasvalue = true;
return true;
}
* is doing something wrong.
*/
irerror(self->context, "Invalid entry block for PHI");
- abort();
+ exit(EXIT_FAILURE);
}
pe.value = v;
ir_value *global;
char name[128];
- snprintf(name, sizeof(name), "EXTPARM#%i", (int)(vec_size(ir->extparam_protos)));
+ util_snprintf(name, sizeof(name), "EXTPARM#%i", (int)(vec_size(ir->extparam_protos)));
global = ir_value_var(name, store_global, TYPE_VECTOR);
vec_push(ir->extparam_protos, global);
stmt.o3.s1 = 0;
maxparams = numparams + self->max_varargs;
for (i = numparams; i < maxparams; ++i) {
- if (i <= 8) {
+ if (i < 8) {
stmt.o1.u1 = OFS_PARM0 + 3*i;
stmt.o2.u1 = ir_value_code_addr(self->locals[i]);
code_push_statement(&stmt, self->context.line);
continue;
}
- ext = i - 9;
- if (ext >= vec_size(ir->extparams))
+ ext = i - 8;
+ while (ext >= vec_size(ir->extparams))
ir_gen_extparam(ir);
ep = ir->extparams[ext];
def.offset++;
component[len-1]++;
}
+
+ mem_d(component);
}
static void gen_vector_fields(prog_section_field fld, const char *name)
fld.offset++;
component[len-1]++;
}
+
+ mem_d(component);
}
static bool ir_builder_gen_global(ir_builder *self, ir_value *global, bool islocal)
prog_section_def def;
bool pushdef = opts.optimizeoff;
- printf("STATUS: %s\n", (pushdef) ? "OFF" : "ON");
-
def.type = global->vtype;
def.offset = vec_size(code_globals);
def.name = 0;
}
if (vec_size(f->blocks))
{
- oprintf("%slife passes: %i\n", ind, (int)f->run_id);
+ oprintf("%slife passes: %i\n", ind, (int)f->run_id);
for (i = 0; i < vec_size(f->blocks); ++i) {
ir_block_dump(f->blocks[i], ind, oprintf);
}