self->constval.vfunc->ir_func = func;
self->ir_v = func->value;
+ if (self->expression.flags & AST_FLAG_INCLUDE_DEF)
+ self->ir_v->flags |= IR_FLAG_INCLUDE_DEF;
/* The function is filled later on ast_function_codegen... */
return true;
}
v->unique_life = true;
v->locked = true;
array->ir_v = self->ir_v = v;
+ if (self->expression.flags & AST_FLAG_INCLUDE_DEF)
+ self->ir_v->flags |= IR_FLAG_INCLUDE_DEF;
namelen = strlen(self->name);
name = (char*)mem_a(namelen + 16);
array->ir_values[ai]->context = ast_ctx(self);
array->ir_values[ai]->unique_life = true;
array->ir_values[ai]->locked = true;
+ if (self->expression.flags & AST_FLAG_INCLUDE_DEF)
+ self->ir_values[ai]->flags |= IR_FLAG_INCLUDE_DEF;
}
mem_d(name);
}
return false;
v->context = ast_ctx(self);
self->ir_v = v;
+ if (self->expression.flags & AST_FLAG_INCLUDE_DEF)
+ self->ir_v->flags |= IR_FLAG_INCLUDE_DEF;
}
return true;
}
v->context = ast_ctx(self);
v->unique_life = true;
v->locked = true;
+ if (self->expression.flags & AST_FLAG_INCLUDE_DEF)
+ v->flags |= IR_FLAG_INCLUDE_DEF;
namelen = strlen(self->name);
name = (char*)mem_a(namelen + 16);
self->ir_values[ai]->context = ast_ctx(self);
self->ir_values[ai]->unique_life = true;
self->ir_values[ai]->locked = true;
+ if (self->expression.flags & AST_FLAG_INCLUDE_DEF)
+ self->ir_values[ai]->flags |= IR_FLAG_INCLUDE_DEF;
}
mem_d(name);
}
/* link us to the ir_value */
v->cvq = self->cvq;
self->ir_v = v;
+ if (self->expression.flags & AST_FLAG_INCLUDE_DEF)
+ self->ir_v->flags |= IR_FLAG_INCLUDE_DEF;
return true;
error: /* clean up */
#define AST_FLAG_INLINE (1<<2)
#define AST_FLAG_INITIALIZED (1<<3)
#define AST_FLAG_DEPRECATED (1<<4)
+#define AST_FLAG_INCLUDE_DEF (1<<5)
#define AST_FLAG_TYPE_MASK (AST_FLAG_VARIADIC | AST_FLAG_NORETURN)
/* Value
self->fieldtype = TYPE_VOID;
self->outtype = TYPE_VOID;
self->store = storetype;
+ self->flags = 0;
self->reads = NULL;
self->writes = NULL;
pushdef = true;
if (OPTS_OPTIMIZATION(OPTIM_STRIP_CONSTANT_NAMES) &&
+ !(global->flags & IR_FLAG_INCLUDE_DEF) &&
(global->name[0] == '#' || global->cvq == CV_CONST))
{
pushdef = false;
int outtype;
/* 'const' vs 'var' qualifier */
int cvq;
+ uint32_t flags;
struct ir_instr_s **reads;
struct ir_instr_s **writes;
#define IR_FLAG_HAS_ARRAYS (1<<1)
#define IR_FLAG_HAS_UNINITIALIZED (1<<2)
#define IR_FLAG_HAS_GOTO (1<<3)
+#define IR_FLAG_INCLUDE_DEF (1<<4)
#define IR_FLAG_MASK_NO_OVERLAP (IR_FLAG_HAS_ARRAYS | IR_FLAG_HAS_UNINITIALIZED)
ir_function* ir_function_new(struct ir_builder_s *owner, int returntype);