/*
- * Copyright (C) 1995-2007 University of Karlsruhe. All right reserved.
+ * Copyright (C) 1995-2008 University of Karlsruhe. All right reserved.
*
* This file is part of libFirm.
*
exchange(info->projs[pn_Load_M], mem);
if (info->projs[pn_Load_X_regular])
exchange(info->projs[pn_Load_X_regular], new_r_Jmp(current_ir_graph, get_nodes_block(load)));
- exchange(load, new_Bad());
+ kill_node(load);
reduce_adr_usage(ptr);
}
} /* handle_load_update */
/* try the called entity */
ir_node *ptr = get_Call_ptr(call);
- if (is_SymConst(ptr) && get_SymConst_kind(ptr) == symconst_addr_ent) {
- ir_entity *ent = get_SymConst_entity(ptr);
+ if (is_Global(ptr)) {
+ ir_entity *ent = get_Global_entity(ptr);
prop = get_entity_additional_properties(ent);
}
if (info->projs[pn_Load_res])
exchange(info->projs[pn_Load_res], value);
- exchange(load, new_Bad());
+ kill_node(load);
reduce_adr_usage(ptr);
return res | DF_CHANGED;
}
res |= CF_CHANGED;
}
- exchange(load, new_Bad());
+ kill_node(load);
reduce_adr_usage(ptr);
return res |= DF_CHANGED;
}
get_irn_mode(get_Store_value(pred)),
ptr, load_mode);
/* if the might be an alias, we cannot pass this Store */
- if (rel != no_alias)
+ if (rel != ir_no_alias)
break;
pred = skip_Proj(get_Store_mem(pred));
} else if (is_Load(pred)) {
exchange(info->projs[pn_Load_X_regular], new_r_Jmp(current_ir_graph, get_nodes_block(load)));
res |= CF_CHANGED;
}
- exchange(load, new_Bad());
+ kill_node(load);
reduce_adr_usage(ptr);
return res | DF_CHANGED;
}
if (info->projs[pn_Load_res])
exchange(info->projs[pn_Load_res], new_node);
- exchange(load, new_Bad());
+ kill_node(load);
reduce_adr_usage(ptr);
return res | DF_CHANGED;
}
res |= DF_CHANGED;
}
}
- exchange(load, new_Bad());
+ kill_node(load);
reduce_adr_usage(ptr);
return res;
} else {
exchange(info->projs[pn_Load_res], copy_const_value(get_irn_dbg_info(load), c));
res |= DF_CHANGED;
}
- exchange(load, new_Bad());
+ kill_node(load);
reduce_adr_usage(ptr);
return res;
} else {
get_nodes_MacroBlock(pred) == mblk &&
is_completely_overwritten(get_irn_mode(get_Store_value(pred)), mode)) {
/*
- * a Store after a Store in the same block -- a write after write.
+ * a Store after a Store in the same MacroBlock -- a write after write.
* We may remove the first Store, if it does not have an exception handler.
*
* TODO: What, if both have the same exception handler ???
if (get_Store_volatility(pred) != volatility_is_volatile && !pred_info->projs[pn_Store_X_except]) {
DBG_OPT_WAW(pred, store);
exchange(pred_info->projs[pn_Store_M], get_Store_mem(pred));
- exchange(pred, new_Bad());
+ kill_node(pred);
reduce_adr_usage(ptr);
return DF_CHANGED;
}
} else if (is_Load(pred) && get_Load_ptr(pred) == ptr &&
value == pred_info->projs[pn_Load_res]) {
/*
- * a Store of a value after a Load -- a write after read.
- * We may remove the second Store, if it does not have an exception handler.
+ * a Store of a value just loaded from the same address
+ * -- a write after read.
+ * We may remove the Store, if it does not have an exception
+ * handler.
*/
if (! info->projs[pn_Store_X_except]) {
DBG_OPT_WAR(store, pred);
exchange(info->projs[pn_Store_M], mem);
- exchange(store, new_Bad());
+ kill_node(store);
reduce_adr_usage(ptr);
return DF_CHANGED;
}
get_irn_mode(get_Store_value(pred)),
ptr, mode);
/* if the might be an alias, we cannot pass this Store */
- if (rel != no_alias)
+ if (rel != ir_no_alias)
break;
pred = skip_Proj(get_Store_mem(pred));
} else if (get_irn_op(pred) == op_Load) {
+ ir_alias_relation rel = get_alias_relation(
+ current_ir_graph, get_Load_ptr(pred), get_Load_mode(pred),
+ ptr, mode);
+ if (rel != ir_no_alias)
+ break;
+
pred = skip_Proj(get_Load_mem(pred));
} else {
/* follow only Load chains */
/* follow the memory chain as long as there are only Loads */
INC_MASTER();
+
return follow_Mem_chain_for_Store(store, skip_Proj(mem));
} /* optimize_store */
if (info->projs[pn_Load_res] == NULL || info->projs[pn_Load_X_regular] != NULL || info->projs[pn_Load_X_except] != NULL)
continue;
- /* for now, we can only handle Load(SymConst) */
- if (! is_SymConst(ptr) || get_SymConst_kind(ptr) != symconst_addr_ent)
+ /* for now, we can only handle Load(Global) */
+ if (! is_Global(ptr))
continue;
- ent = get_SymConst_entity(ptr);
+ ent = get_Global_entity(ptr);
load_mode = get_Load_mode(load);
for (other = pscc->head; other != NULL; other = next_other) {
node_entry *ne = get_irn_ne(other, env);
get_irn_mode(get_Store_value(other)),
ptr, load_mode);
/* if the might be an alias, we cannot pass this Store */
- if (rel != no_alias)
+ if (rel != ir_no_alias)
break;
}
/* only pure Calls are allowed here, so ignore them */