Commit a9e6ff2a authored by Matthias Braun's avatar Matthias Braun
Browse files

load-after-load and load-after-store with different mode was implemented in a...

load-after-load and load-after-store with different mode was implemented in a little-endian way, disable on big-endian (until we have a real implementation)
parent 58145b34
...@@ -746,17 +746,26 @@ static void reduce_adr_usage(ir_node *ptr) ...@@ -746,17 +746,26 @@ static void reduce_adr_usage(ir_node *ptr)
*/ */
static int can_use_stored_value(ir_mode *old_mode, ir_mode *new_mode) static int can_use_stored_value(ir_mode *old_mode, ir_mode *new_mode)
{ {
unsigned old_size;
unsigned new_size;
if (old_mode == new_mode) if (old_mode == new_mode)
return 1; return true;
old_size = get_mode_size_bits(old_mode);
new_size = get_mode_size_bits(new_mode);
/* if both modes are two-complement ones, we can always convert the /* if both modes are two-complement ones, we can always convert the
Stored value into the needed one. */ Stored value into the needed one. (on big endian machines we currently
if (get_mode_size_bits(old_mode) >= get_mode_size_bits(new_mode) && only support this for modes of same size) */
if (old_size >= new_size &&
get_mode_arithmetic(old_mode) == irma_twos_complement && get_mode_arithmetic(old_mode) == irma_twos_complement &&
get_mode_arithmetic(new_mode) == irma_twos_complement) get_mode_arithmetic(new_mode) == irma_twos_complement &&
return 1; (!be_get_backend_param()->byte_order_big_endian
return 0; || old_size == new_size)) {
} /* can_use_stored_value */ return true;
}
return false;
}
/** /**
* Check whether a Call is at least pure, ie. does only read memory. * Check whether a Call is at least pure, ie. does only read memory.
...@@ -867,7 +876,10 @@ static int try_load_after_store(ir_node *load, ...@@ -867,7 +876,10 @@ static int try_load_after_store(ir_node *load,
store_value = get_Store_value(store); store_value = get_Store_value(store);
if (delta != 0 || store_mode != load_mode) { if (delta != 0 || store_mode != load_mode) {
if (delta < 0 || delta + load_mode_len > store_mode_len) /* TODO: implement for big-endian */
if (delta < 0 || delta + load_mode_len > store_mode_len
|| (be_get_backend_param()->byte_order_big_endian
&& load_mode_len != store_mode_len))
return 0; return 0;
if (get_mode_arithmetic(store_mode) != irma_twos_complement || if (get_mode_arithmetic(store_mode) != irma_twos_complement ||
...@@ -880,7 +892,6 @@ static int try_load_after_store(ir_node *load, ...@@ -880,7 +892,6 @@ static int try_load_after_store(ir_node *load,
ir_node *cnst; ir_node *cnst;
ir_graph *irg = get_irn_irg(load); ir_graph *irg = get_irn_irg(load);
/* FIXME: only true for little endian */
cnst = new_r_Const_long(irg, mode_Iu, delta * 8); cnst = new_r_Const_long(irg, mode_Iu, delta * 8);
store_value = new_r_Shr(get_nodes_block(load), store_value = new_r_Shr(get_nodes_block(load),
store_value, cnst, store_mode); store_value, cnst, store_mode);
...@@ -976,6 +987,9 @@ static unsigned follow_Mem_chain(ir_node *load, ir_node *curr) ...@@ -976,6 +987,9 @@ static unsigned follow_Mem_chain(ir_node *load, ir_node *curr)
* Here, there is no need to check if the previous Load has an * Here, there is no need to check if the previous Load has an
* exception hander because they would have exact the same * exception hander because they would have exact the same
* exception... * exception...
*
* TODO: implement load-after-load with different mode for big
* endian
*/ */
if (info->projs[pn_Load_X_except] == NULL if (info->projs[pn_Load_X_except] == NULL
|| get_nodes_block(load) == get_nodes_block(pred)) { || get_nodes_block(load) == get_nodes_block(pred)) {
......
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