libFirm
Array

The array type represents rectangular multi dimensional arrays. More...

Functions

ir_typenew_type_array (size_t n_dims, ir_type *element_type)
 Create a new type array.
ir_typenew_d_type_array (size_t n_dims, ir_type *element_type, type_dbg_info *db)
 Create a new type array with debug information.
size_t get_array_n_dimensions (const ir_type *array)
 Returns the number of array dimensions of this type.
void set_array_bounds_int (ir_type *array, size_t dimension, int lower_bound, int upper_bound)
 Allocates Const nodes of mode_Is for one array dimension.
void set_array_bounds (ir_type *array, size_t dimension, ir_node *lower_bound, ir_node *upper_bound)
 Sets the bounds for one array dimension.
void set_array_lower_bound (ir_type *array, size_t dimension, ir_node *lower_bound)
 Sets the lower bound for one array dimension, i.e.
void set_array_lower_bound_int (ir_type *array, size_t dimension, int lower_bound)
 Allocates Const nodes of mode_Is for the lower bound of an array dimension, i.e.
void set_array_upper_bound (ir_type *array, size_t dimension, ir_node *upper_bound)
 Sets the upper bound for one array dimension, i.e.
void set_array_upper_bound_int (ir_type *array, size_t dimension, int upper_bound)
 Allocates Const nodes of mode_Is for the upper bound of an array dimension, i.e.
int has_array_lower_bound (const ir_type *array, size_t dimension)
 Returns true if lower bound != Unknown.
ir_nodeget_array_lower_bound (const ir_type *array, size_t dimension)
 Returns the lower bound of an array.
long get_array_lower_bound_int (const ir_type *array, size_t dimension)
 Works only if bound is Const node with tarval that can be converted to long.
int has_array_upper_bound (const ir_type *array, size_t dimension)
 returns true if lower bound != Unknown
ir_nodeget_array_upper_bound (const ir_type *array, size_t dimension)
 Returns the upper bound of an array.
long get_array_upper_bound_int (const ir_type *array, size_t dimension)
 Works only if bound is Const node with tarval that can be converted to long.
void set_array_order (ir_type *array, size_t dimension, size_t order)
 Sets an array dimension to a specific order.
size_t get_array_order (const ir_type *array, size_t dimension)
 Returns the order of an array dimension.
size_t find_array_dimension (const ir_type *array, size_t order)
 Find the array dimension that is placed at order order.
void set_array_element_type (ir_type *array, ir_type *tp)
 Sets the array element type.
ir_typeget_array_element_type (const ir_type *array)
 Returns the array element type.
void set_array_element_entity (ir_type *array, ir_entity *ent)
 Sets the array element entity.
ir_entityget_array_element_entity (const ir_type *array)
 Returns the array element entity.
void set_array_variable_size (ir_type *array, int variable_size_flag)
 Sets the array variable size flag.
int is_array_variable_size (const ir_type *array)
 Returns the array variable size flag.
int is_Array_type (const ir_type *array)
 Returns true if a type is an array type.
const tp_opget_tpop_array (void)
 Returns type opcode for array type.

Variables

const tp_optype_array
 This type opcode marks that the corresponding type is an array type.

Detailed Description

The array type represents rectangular multi dimensional arrays.

The constants representing the bounds must be allocated to get_const_code_irg() by setting current_ir_graph accordingly.

Function Documentation

size_t find_array_dimension ( const ir_type array,
size_t  order 
)

Find the array dimension that is placed at order order.

ir_entity* get_array_element_entity ( const ir_type array)

Returns the array element entity.

ir_type* get_array_element_type ( const ir_type array)

Returns the array element type.

ir_node* get_array_lower_bound ( const ir_type array,
size_t  dimension 
)

Returns the lower bound of an array.

long get_array_lower_bound_int ( const ir_type array,
size_t  dimension 
)

Works only if bound is Const node with tarval that can be converted to long.

size_t get_array_n_dimensions ( const ir_type array)

Returns the number of array dimensions of this type.

size_t get_array_order ( const ir_type array,
size_t  dimension 
)

Returns the order of an array dimension.

ir_node* get_array_upper_bound ( const ir_type array,
size_t  dimension 
)

Returns the upper bound of an array.

long get_array_upper_bound_int ( const ir_type array,
size_t  dimension 
)

Works only if bound is Const node with tarval that can be converted to long.

const tp_op* get_tpop_array ( void  )

Returns type opcode for array type.

See Also
type_array
int has_array_lower_bound ( const ir_type array,
size_t  dimension 
)

Returns true if lower bound != Unknown.

int has_array_upper_bound ( const ir_type array,
size_t  dimension 
)

returns true if lower bound != Unknown

int is_Array_type ( const ir_type array)

Returns true if a type is an array type.

int is_array_variable_size ( const ir_type array)

Returns the array variable size flag.

See Also
set_array_variable_size()
ir_type* new_d_type_array ( size_t  n_dims,
ir_type element_type,
type_dbg_info db 
)

Create a new type array with debug information.

Sets n_dimension to dimension and all dimension entries to NULL. Initializes order to the order of the dimensions. The entity for array elements is built automatically. Sets dimension sizes after call to constructor with set_* routines. A legal array type must have at least one dimension set.

ir_type* new_type_array ( size_t  n_dims,
ir_type element_type 
)

Create a new type array.

Sets n_dimension to dimension and all dimension entries to NULL. Initializes order to the order of the dimensions. The entity for array elements is built automatically. Sets dimension sizes after call to constructor with set_* routines.

void set_array_bounds ( ir_type array,
size_t  dimension,
ir_node lower_bound,
ir_node upper_bound 
)

Sets the bounds for one array dimension.

Upper bound in Firm is the element next to the last, i.e. [lower,upper[

void set_array_bounds_int ( ir_type array,
size_t  dimension,
int  lower_bound,
int  upper_bound 
)

Allocates Const nodes of mode_Is for one array dimension.

Upper bound in Firm is the element next to the last, i.e. [lower,upper[

void set_array_element_entity ( ir_type array,
ir_entity ent 
)

Sets the array element entity.

void set_array_element_type ( ir_type array,
ir_type tp 
)

Sets the array element type.

void set_array_lower_bound ( ir_type array,
size_t  dimension,
ir_node lower_bound 
)

Sets the lower bound for one array dimension, i.e.

[lower,upper[

void set_array_lower_bound_int ( ir_type array,
size_t  dimension,
int  lower_bound 
)

Allocates Const nodes of mode_Is for the lower bound of an array dimension, i.e.

[lower,upper[

void set_array_order ( ir_type array,
size_t  dimension,
size_t  order 
)

Sets an array dimension to a specific order.

void set_array_upper_bound ( ir_type array,
size_t  dimension,
ir_node upper_bound 
)

Sets the upper bound for one array dimension, i.e.

[lower,upper[

void set_array_upper_bound_int ( ir_type array,
size_t  dimension,
int  upper_bound 
)

Allocates Const nodes of mode_Is for the upper bound of an array dimension, i.e.

[lower,upper[.

void set_array_variable_size ( ir_type array,
int  variable_size_flag 
)

Sets the array variable size flag.

If this flag is set then no upper/lower bounds need to be set and get_type_size_bytes() returns -1

Variable Documentation

const tp_op* type_array

This type opcode marks that the corresponding type is an array type.

Consequently it contains a list of dimensions (lower and upper bounds) and an element type. This struct is dynamically allocated but constant for the lifetime of the library.

Definition at line 1893 of file typerep.h.