*
* Breaking conventions is annoying...
*/
-static bool ir_builder_gen_global(ir_builder *self, ir_value *global, bool islocal, bool defs_only);
+static bool ir_builder_gen_global(ir_builder *self, ir_value *global, bool islocal);
static bool gen_global_field(ir_value *global)
{
vec_push(code_globals, 0);
for (i = 0; i < vec_size(irfun->locals); ++i) {
ir_value_code_setaddr(irfun->locals[i], firstlocal + irfun->locals[i]->code.local);
- if (!ir_builder_gen_global(ir, irfun->locals[i], true, true)) {
+ if (!ir_builder_gen_global(ir, irfun->locals[i], true)) {
irerror(irfun->locals[i]->context, "failed to generate local %s", irfun->locals[i]->name);
return false;
}
}
}
-static bool ir_builder_gen_global(ir_builder *self, ir_value *global, bool islocal, bool defs_only)
+static bool ir_builder_gen_global(ir_builder *self, ir_value *global, bool islocal)
{
size_t i;
int32_t *iptr;
prog_section_def def;
bool pushdef = false;
+ def.type = global->vtype;
+ def.offset = vec_size(code_globals);
+ def.name = 0;
if (opts.g || !islocal)
{
pushdef = true;
- def.type = global->vtype;
- def.offset = vec_size(code_globals);
if (OPTS_OPTIMIZATION(OPTIM_STRIP_CONSTANT_NAMES) &&
(global->name[0] == '#' || global->cvq == CV_CONST))
}
else
def.name = 0;
- if (defs_only) {
+ if (islocal) {
def.offset = ir_value_code_addr(global);
vec_push(code_defs, def);
if (global->vtype == TYPE_VECTOR)
return true;
}
}
- if (defs_only)
+ if (islocal)
return true;
switch (global->vtype)
for (i = 0; i < vec_size(self->globals); ++i)
{
- if (!ir_builder_gen_global(self, self->globals[i], false, false)) {
+ if (!ir_builder_gen_global(self, self->globals[i], false)) {
return false;
}
if (self->globals[i]->vtype == TYPE_FUNCTION) {