X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Ftr%2Ftype.c;h=478844961fc541df249174426a84d7f5de188abd;hb=ca42e4ac671c49f7ba8e9dfffd805abf49b2c733;hp=30a9bf442ea1890b831b74b37ae01dafe8a2dc85;hpb=0064ee54b41c007b5d33b557d053e602ac3be2cc;p=libfirm diff --git a/ir/tr/type.c b/ir/tr/type.c index 30a9bf442..478844961 100644 --- a/ir/tr/type.c +++ b/ir/tr/type.c @@ -85,7 +85,7 @@ ir_type *get_unknown_type(void) 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); @@ -106,6 +106,24 @@ void firm_init_type(void) 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; @@ -889,7 +907,7 @@ void remove_class_subtype(ir_type *clss, ir_type *subtype) 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; } } @@ -945,7 +963,7 @@ void remove_class_supertype(ir_type *clss, ir_type *supertype) 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; } } @@ -1620,7 +1638,7 @@ ir_type *new_d_type_array(int n_dimensions, ir_type *element_type, 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)); @@ -1630,14 +1648,12 @@ ir_type *new_d_type_array(int n_dimensions, ir_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 @@ -1694,12 +1710,10 @@ void set_array_bounds(ir_type *array, int dimension, ir_node *lower_bound, 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) @@ -1711,11 +1725,9 @@ 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) @@ -1727,11 +1739,9 @@ 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)