{
if (architecture_modulo_shift == 0)
return 0;
- if (type_size < architecture_modulo_shift)
- return architecture_modulo_shift;
- return type_size;
+ return MAX(type_size, architecture_modulo_shift);
}
static ir_mode *init_atomic_ir_mode(atomic_type_kind_t kind)
switch (entity->kind) {
case ENTITY_VARIABLE:
return entity->declaration.storage_class != STORAGE_CLASS_EXTERN;
+// TODO: alias provides a definition
+// || entity->variable.alias != NULL;
case ENTITY_FUNCTION:
return entity->function.body != NULL;
case ENTITY_PARAMETER:
if ((modifiers & DM_USED) && declaration_is_definition(entity)) {
add_entity_linkage(irentity, IR_LINKAGE_HIDDEN_USER);
}
- if ((modifiers & DM_WEAK) && declaration_is_definition(entity)
- && entity->declaration.storage_class != STORAGE_CLASS_EXTERN) {
+// TODO: i dont understand this logic
+// if ((modifiers & DM_WEAK) && declaration_is_definition(entity)
+// && entity->declaration.storage_class != STORAGE_CLASS_EXTERN) {
+ if (modifiers & DM_WEAK) {
add_entity_linkage(irentity, IR_LINKAGE_WEAK);
}
}
{
assert(entity->kind == ENTITY_VARIABLE);
initializer_t *initializer = entity->variable.initializer;
+ if (entity->variable.alias != NULL) {
+ const namespace_tag_t namespc = (namespace_tag_t)entity->base.namespc;
+ entity_t *a = entity->variable.alias->entity;
+ for (; a != NULL; a = a->base.symbol_next) {
+ if ((namespace_tag_t)a->base.namespc == namespc)
+ break;
+ }
+ assert(a != NULL && a->kind == ENTITY_VARIABLE && a->variable.v.entity != NULL);
+ set_entity_alias(entity->variable.v.entity, a->variable.v.entity);
+ /* prevent usage assumption to be made about aliased variables */
+ add_entity_linkage(a->variable.v.entity, IR_LINKAGE_HIDDEN_USER);
+ }
if (initializer == NULL)
return;
assert(entity->kind == ENTITY_FUNCTION);
ir_entity *function_entity = get_function_entity(entity, current_outer_frame);
+ if (entity->function.alias != NULL) {
+ const namespace_tag_t namespc = (namespace_tag_t)entity->base.namespc;
+ entity_t *a = entity->function.alias->entity;
+ for (; a != NULL; a = a->base.symbol_next) {
+ if ((namespace_tag_t)a->base.namespc == namespc)
+ break;
+ }
+// TODO: or use entitymap
+// ir_entity *a = entitymap_get(&entitymap, entity->function.alias);
+ assert(a != NULL && a->kind == ENTITY_VARIABLE && a->function.irentity != NULL);
+ set_entity_alias(entity->function.irentity, a->function.irentity);
+ /* prevent usage assumption to be made about aliased functions */
+ add_entity_linkage(a->function.irentity, IR_LINKAGE_HIDDEN_USER);
+ }
+
if (entity->function.body == NULL)
return;