From 4996f81640bf331e068763399ed5a0ca8ee9876f Mon Sep 17 00:00:00 2001 From: =?utf8?q?G=C3=B6tz=20Lindenmaier?= Date: Tue, 19 Jun 2001 17:19:43 +0000 Subject: [PATCH] changed bounds of arrays from plain ints to irnode*s. added some comment: undefined variables [r176] --- ir/tr/type.c | 16 ++++++++-------- ir/tr/type.h | 20 ++++++++++++++------ ir/tr/type_t.h | 4 ++-- 3 files changed, 24 insertions(+), 16 deletions(-) diff --git a/ir/tr/type.c b/ir/tr/type.c index 7e85bbdf5..4f527fae5 100644 --- a/ir/tr/type.c +++ b/ir/tr/type.c @@ -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]; } diff --git a/ir/tr/type.h b/ir/tr/type.h index 0d4b05b8c..2556de783 100644 --- a/ir/tr/type.h +++ b/ir/tr/type.h @@ -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); diff --git a/ir/tr/type_t.h b/ir/tr/type_t.h index 61f1ee79e..02d1f7d3f 100644 --- a/ir/tr/type_t.h +++ b/ir/tr/type_t.h @@ -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. */ -- 2.20.1