Commit 59d4f317 authored by yb9976's avatar yb9976
Browse files

Cleanup using C99.

parent 863ceb9d
...@@ -236,15 +236,12 @@ static ir_entity *find_constant_entity(ir_node *ptr) ...@@ -236,15 +236,12 @@ static ir_entity *find_constant_entity(ir_node *ptr)
/* Do not fiddle with polymorphism. */ /* Do not fiddle with polymorphism. */
if (is_Class_type(tp) && if (is_Class_type(tp) &&
((get_entity_n_overwrites(ent) != 0) || (get_entity_n_overwrites(ent) != 0 || get_entity_n_overwrittenby(ent) != 0))
(get_entity_n_overwrittenby(ent) != 0) ) )
return NULL; return NULL;
if (is_Array_type(tp)) { if (is_Array_type(tp)) {
/* check bounds */ /* check bounds */
int i, n; for (int i = 0, n = get_Sel_n_indexs(ptr); i < n; ++i) {
for (i = 0, n = get_Sel_n_indexs(ptr); i < n; ++i) {
ir_node *index = get_Sel_index(ptr, i); ir_node *index = get_Sel_index(ptr, i);
ir_tarval *tv = computed_value(index); ir_tarval *tv = computed_value(index);
...@@ -252,10 +249,10 @@ static ir_entity *find_constant_entity(ir_node *ptr) ...@@ -252,10 +249,10 @@ static ir_entity *find_constant_entity(ir_node *ptr)
if (tv == tarval_bad) if (tv == tarval_bad)
return NULL; return NULL;
ir_node *bound = get_array_lower_bound(tp, i); ir_node *lower = get_array_lower_bound(tp, i);
ir_tarval *tlower = computed_value(bound); ir_tarval *tlower = computed_value(lower);
bound = get_array_upper_bound(tp, i); ir_node *upper = get_array_upper_bound(tp, i);
ir_tarval *tupper = computed_value(bound); ir_tarval *tupper = computed_value(upper);
if (tlower == tarval_bad || tupper == tarval_bad) if (tlower == tarval_bad || tupper == tarval_bad)
return NULL; return NULL;
...@@ -455,13 +452,10 @@ static ir_node *get_base_and_offset(ir_node *ptr, long *pOffset) ...@@ -455,13 +452,10 @@ static ir_node *get_base_and_offset(ir_node *ptr, long *pOffset)
ir_type *tp = get_entity_owner(ent); ir_type *tp = get_entity_owner(ent);
if (is_Array_type(tp)) { if (is_Array_type(tp)) {
int size;
ir_node *index;
/* only one dimensional arrays yet */ /* only one dimensional arrays yet */
if (get_Sel_n_indexs(ptr) != 1) if (get_Sel_n_indexs(ptr) != 1)
break; break;
index = get_Sel_index(ptr, 0); ir_node *index = get_Sel_index(ptr, 0);
if (! is_Const(index)) if (! is_Const(index))
break; break;
...@@ -469,7 +463,7 @@ static ir_node *get_base_and_offset(ir_node *ptr, long *pOffset) ...@@ -469,7 +463,7 @@ static ir_node *get_base_and_offset(ir_node *ptr, long *pOffset)
if (get_type_state(tp) != layout_fixed) if (get_type_state(tp) != layout_fixed)
break; break;
size = get_type_size_bytes(tp); int size = get_type_size_bytes(tp);
offset += size * get_tarval_long(get_Const_tarval(index)); offset += size * get_tarval_long(get_Const_tarval(index));
} else { } else {
if (get_type_state(tp) != layout_fixed) if (get_type_state(tp) != layout_fixed)
...@@ -502,6 +496,7 @@ static int try_load_after_store(ir_node *load, ...@@ -502,6 +496,7 @@ static int try_load_after_store(ir_node *load,
long delta = load_offset - store_offset; long delta = load_offset - store_offset;
ir_node *store_value = get_Store_value(store); ir_node *store_value = get_Store_value(store);
/* Ensure that Load is completely contained in Store. */
if (delta < 0 || delta+load_mode_len > store_mode_len) if (delta < 0 || delta+load_mode_len > store_mode_len)
return 0; return 0;
......
Markdown is supported
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