Commit 3bd57592 authored by Michael Beck's avatar Michael Beck
Browse files

- simplify the code, check atomic entities for reinterpret casts

[r22100]
parent 1e7ccff0
......@@ -1071,6 +1071,7 @@ static unsigned optimize_load(ir_node *load)
}
if (variability_constant == get_entity_variability(ent)) {
ir_node *c = NULL;
if (is_atomic_entity(ent)) {
/* Might not be atomic after
lowering of Sels. In this
......@@ -1079,27 +1080,8 @@ static unsigned optimize_load(ir_node *load)
/* more simpler case: we load the content of a constant value:
* replace it by the constant itself
*/
/* no memory */
if (info->projs[pn_Load_M]) {
exchange(info->projs[pn_Load_M], mem);
res |= DF_CHANGED;
}
/* no result :-) */
if (info->projs[pn_Load_res]) {
if (is_atomic_entity(ent)) {
ir_node *c = copy_const_value(get_irn_dbg_info(load), get_atomic_ent_value(ent));
DBG_OPT_RC(load, c);
exchange(info->projs[pn_Load_res], c);
res |= DF_CHANGED;
}
}
kill_node(load);
reduce_adr_usage(ptr);
return res;
c = get_atomic_ent_value(ent);
} else {
ir_node *c = NULL;
if (ent->has_initializer) {
/* new style initializer */
c = find_compound_ent_value(ptr);
......@@ -1114,6 +1096,7 @@ static unsigned optimize_load(ir_node *load)
free_compound_graph_path(path);
}
}
}
if (c != NULL) {
/* check, if the mode matches OR can be easily converted info */
ir_mode *c_mode = get_irn_mode(c);
......@@ -1149,16 +1132,6 @@ static unsigned optimize_load(ir_node *load)
kill_node(load);
reduce_adr_usage(ptr);
return res;
} else {
/* We can not determine a correct access path. E.g., in jack, we load
a byte from an object to generate an exception. Happens in test program
Reflectiontest.
printf(">>>>>>>>>>>>> Found access to constant entity %s in function %s\n", get_entity_name(ent),
get_entity_name(get_irg_entity(current_ir_graph)));
ir_printf(" load: %+F\n", load);
ir_printf(" ptr: %+F\n", ptr);
*/
}
}
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment