Commit 4996f816 authored by Götz Lindenmaier's avatar Götz Lindenmaier
Browse files

changed bounds of arrays from plain ints to irnode*s.

added some comment: undefined variables

[r176]
parent abff8b3b
......@@ -362,8 +362,8 @@ type *new_type_array (ident *name, int n_dimensions,
type *res;
res = new_type(type_array, NULL, name);
res->attr.aa.n_dimensions = n_dimensions;
res->attr.aa.lower_bound = (int *) xmalloc (sizeof (int) * n_dimensions);
res->attr.aa.upper_bound = (int *) xmalloc (sizeof (int) * 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.element_type = element_type;
new_entity(res, name, element_type);
return res;
......@@ -374,25 +374,25 @@ int get_array_n_dimensions (type *array) {
assert(array && (array->type_op == type_array));
return array->attr.aa.n_dimensions;
}
void set_array_bounds (type *array, int dimension, int lower_bound,
int upper_bound) {
void set_array_bounds (type *array, int dimension, ir_node * lower_bound,
ir_node * upper_bound) {
assert(array && (array->type_op == type_array));
array->attr.aa.lower_bound[dimension] = lower_bound;
array->attr.aa.upper_bound[dimension] = upper_bound;
}
void set_array_lower_bound (type *array, int dimension, int lower_bound) {
void set_array_lower_bound (type *array, int dimension, ir_node * lower_bound) {
assert(array && (array->type_op == type_array));
array->attr.aa.lower_bound[dimension] = lower_bound;
}
void set_array_upper_bound (type *array, int dimension, int upper_bound) {
void set_array_upper_bound (type *array, int dimension, ir_node * upper_bound) {
assert(array && (array->type_op == type_array));
array->attr.aa.upper_bound[dimension] = upper_bound;
}
int get_array_lower_bound (type *array, int dimension) {
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 get_array_upper_bound (type *array, int dimension) {
ir_node * get_array_upper_bound (type *array, int dimension) {
assert(array && (array->type_op == type_array));
return array->attr.aa.upper_bound[dimension];
}
......
......@@ -42,6 +42,11 @@
typedef struct entity entity;
#endif
#ifndef _IR_NODE_TYPEDEF_
#define _IR_NODE_TYPEDEF_
typedef struct ir_node ir_node;
#endif
/****s* type/type
*
* NAME
......@@ -310,6 +315,9 @@ void set_union_delim_nameid (type *uni, int pos, ident *id);
* *element_type The type of the array elements.
* *element_ent An entity for the array elements to be used for
* element selection with Sel.
* @@@ Do we need several entities? One might want
* to select a dimension and not a single element in
* case of multidim arrays.
* SOURCE
*/
/* create a new type array --
......@@ -320,12 +328,12 @@ type *new_type_array (ident *name, int n_dimensions,
/* manipulate private fields of array type */
int get_array_n_dimensions (type *array);
void set_array_bounds (type *array, int dimension, int lower_bound,
int upper_bound);
void set_array_lower_bound (type *array, int dimension, int lower_bound);
void set_array_upper_bound (type *array, int dimension, int upper_bound);
int get_array_lower_bound (type *array, int dimension);
int get_array_upper_bound (type *array, int dimension);
void set_array_bounds (type *array, int dimension, ir_node *lower_bound,
ir_node *upper_bound);
void set_array_lower_bound (type *array, int dimension, ir_node *lower_bound);
void set_array_upper_bound (type *array, int dimension, ir_node *upper_bound);
ir_node * get_array_lower_bound (type *array, int dimension);
ir_node * get_array_upper_bound (type *array, int dimension);
void set_array_element_type (type *array, type *type);
type *get_array_element_type (type *array);
......
......@@ -52,8 +52,8 @@ typedef struct {
typedef struct {
int n_dimensions; /* Number of array dimensions. */
int *lower_bound; /* Lower bounds of dimensions. Usually all 0. */
int *upper_bound; /* Upper bounds or dimensions. */
ir_node **lower_bound; /* Lower bounds of dimensions. Usually all 0. */
ir_node **upper_bound; /* Upper bounds or dimensions. */
type *element_type; /* The type of the array elements. */
entity *element_ent; /* Entity for the array elements, to be used for
element selection with Sel. */
......
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