Commit 972fde3a authored by Götz Lindenmaier's avatar Götz Lindenmaier
Browse files

unspecified array bounds now represented by "Unknown"

[r1613]
parent e7cd74d0
......@@ -439,9 +439,12 @@ ir_node *copy_const_value(ir_node *n) {
nn = new_SymConst(get_SymConst_type_or_id(n), get_SymConst_kind(n)); break;
case iro_Add:
nn = new_Add(copy_const_value(get_Add_left(n)), copy_const_value(get_Add_right(n)), m); break;
case iro_Unknown:
nn = new_Unknown(); break;
default:
DDMN(n);
assert(0 && "opdope invalid or not implemented");
nn=NULL;
nn = NULL;
break;
}
return nn;
......
......@@ -1050,18 +1050,23 @@ INLINE type *new_type_array (ident *name, int n_dimensions,
type *element_type) {
type *res;
int i;
ir_graph *rem = current_ir_graph;
assert(!is_method_type(element_type));
res = new_type(type_array, NULL, name);
res->attr.aa.n_dimensions = n_dimensions;
res->attr.aa.lower_bound = (ir_node **) xmalloc (sizeof (ir_node *) * n_dimensions);
res->attr.aa.upper_bound = (ir_node **) xmalloc (sizeof (ir_node *) * n_dimensions);
res->attr.aa.order = (int *) xmalloc (sizeof (int) * n_dimensions);
current_ir_graph = get_const_code_irg();
for (i = 0; i < n_dimensions; i++) {
res->attr.aa.lower_bound[i] = NULL;
res->attr.aa.upper_bound[i] = NULL;
res->attr.aa.lower_bound[i] = new_Unknown();
res->attr.aa.upper_bound[i] = new_Unknown();
res->attr.aa.order[i] = i;
}
current_ir_graph = rem;
res->attr.aa.element_type = element_type;
new_entity(res, mangle_u(name, id_from_str("elem_ent", 8)), element_type);
......@@ -1127,10 +1132,18 @@ void set_array_upper_bound_int (type *array, int dimension, int upper_bound) {
new_Const(mode_Iu, new_tarval_from_long (upper_bound, mode_Iu)));
current_ir_graph = rem;
}
int has_array_lower_bound (type *array, int dimension) {
assert(array && (array->type_op == type_array));
return (get_irn_op(array->attr.aa.lower_bound[dimension]) != op_Unknown);
}
ir_node * get_array_lower_bound (type *array, int dimension) {
assert(array && (array->type_op == type_array));
return array->attr.aa.lower_bound[dimension];
}
int has_array_upper_bound (type *array, int dimension) {
assert(array && (array->type_op == type_array));
return (get_irn_op(array->attr.aa.upper_bound[dimension]) != op_Unknown);
}
ir_node * get_array_upper_bound (type *array, int dimension) {
assert(array && (array->type_op == type_array));
return array->attr.aa.upper_bound[dimension];
......
......@@ -648,7 +648,10 @@ void set_array_lower_bound (type *array, int dimension, ir_node *lower_bound);
void set_array_lower_bound_int (type *array, int dimension, int lower_bound);
void set_array_upper_bound (type *array, int dimension, ir_node *upper_bound);
void set_array_upper_bound_int (type *array, int dimension, int lower_bound);
/* returns true is lower bound != Unknown */
int has_array_lower_bound (type *array, int dimension);
ir_node * get_array_lower_bound (type *array, int dimension);
int has_array_upper_bound (type *array, int dimension);
ir_node * get_array_upper_bound (type *array, int dimension);
void set_array_order (type *array, int dimension, int order);
......
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