static ident *value_params_suffix = NULL;
static ident *value_ress_suffix = NULL;
-void firm_init_type(void)
+void ir_init_type(void)
{
value_params_suffix = new_id_from_str(VALUE_PARAMS_SUFFIX);
value_ress_suffix = new_id_from_str(VALUE_RESS_SUFFIX);
remove_irp_type(firm_unknown_type);
}
+void ir_finish_type(void)
+{
+ if (firm_none_type != NULL) {
+ free_type(firm_none_type);
+ firm_none_type = NULL;
+ }
+ if (firm_code_type != NULL) {
+ free_type(firm_code_type);
+ firm_code_type = NULL;
+ }
+ if (firm_unknown_type != NULL) {
+ free_type(firm_unknown_type);
+ firm_unknown_type = NULL;
+ }
+ value_params_suffix = NULL;
+ value_ress_suffix = NULL;
+}
+
/** the global type visited flag */
ir_visited_t firm_type_visited;
if (clss->attr.ca.subtypes[i] == subtype) {
for (; i < (ARR_LEN (clss->attr.ca.subtypes))-1; i++)
clss->attr.ca.subtypes[i] = clss->attr.ca.subtypes[i+1];
- ARR_SETLEN(ir_entity*, clss->attr.ca.subtypes, ARR_LEN(clss->attr.ca.subtypes) - 1);
+ ARR_SETLEN(ir_type*, clss->attr.ca.subtypes, ARR_LEN(clss->attr.ca.subtypes) - 1);
break;
}
}
if (clss->attr.ca.supertypes[i] == supertype) {
for (; i < (ARR_LEN(clss->attr.ca.supertypes))-1; i++)
clss->attr.ca.supertypes[i] = clss->attr.ca.supertypes[i+1];
- ARR_SETLEN(ir_entity*, clss->attr.ca.supertypes, ARR_LEN(clss->attr.ca.supertypes) - 1);
+ ARR_SETLEN(ir_type*, clss->attr.ca.supertypes, ARR_LEN(clss->attr.ca.supertypes) - 1);
break;
}
}
ir_type *res;
int i;
ir_node *unk;
- ir_graph *rem = current_ir_graph;
+ ir_graph *irg = get_const_code_irg();
assert(!is_Method_type(element_type));
res->attr.aa.upper_bound = XMALLOCNZ(ir_node*, n_dimensions);
res->attr.aa.order = XMALLOCNZ(int, n_dimensions);
- current_ir_graph = get_const_code_irg();
- unk = new_Unknown(mode_Iu);
+ unk = new_r_Unknown(irg, mode_Iu);
for (i = 0; i < n_dimensions; i++) {
res->attr.aa.lower_bound[i] =
res->attr.aa.upper_bound[i] = unk;
res->attr.aa.order[i] = i;
}
- current_ir_graph = rem;
res->attr.aa.element_type = element_type;
res->attr.aa.element_ent
void set_array_bounds_int(ir_type *array, int dimension, int lower_bound,
int upper_bound)
{
- ir_graph *rem = current_ir_graph;
- current_ir_graph = get_const_code_irg();
+ ir_graph *irg = get_const_code_irg();
set_array_bounds(array, dimension,
- new_Const_long(mode_Iu, lower_bound),
- new_Const_long(mode_Iu, upper_bound));
- current_ir_graph = rem;
+ new_r_Const_long(irg, mode_Iu, lower_bound),
+ new_r_Const_long(irg, mode_Iu, upper_bound));
}
void set_array_lower_bound(ir_type *array, int dimension, ir_node *lower_bound)
void set_array_lower_bound_int(ir_type *array, int dimension, int lower_bound)
{
- ir_graph *rem = current_ir_graph;
- current_ir_graph = get_const_code_irg();
+ ir_graph *irg = get_const_code_irg();
set_array_lower_bound(array, dimension,
- new_Const_long(mode_Iu, lower_bound));
- current_ir_graph = rem;
+ new_r_Const_long(irg, mode_Iu, lower_bound));
}
void set_array_upper_bound(ir_type *array, int dimension, ir_node *upper_bound)
void set_array_upper_bound_int(ir_type *array, int dimension, int upper_bound)
{
- ir_graph *rem = current_ir_graph;
- current_ir_graph = get_const_code_irg();
+ ir_graph *irg = get_const_code_irg();
set_array_upper_bound(array, dimension,
- new_Const_long(mode_Iu, upper_bound));
- current_ir_graph = rem;
+ new_r_Const_long(irg, mode_Iu, upper_bound));
}
int has_array_lower_bound(const ir_type *array, int dimension)