X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Ftr%2Ftypegmod.c;h=a3cf5e1f436b19ce6769d01d8b7522c5b63db90b;hb=58278afc9917d9fc28ae5a4def6e1d9e53d7179f;hp=d6138fc1168d4828b6f78f4a3ea3f903abdcaabf;hpb=c87d9219afb181191457710f479696a47299451a;p=libfirm diff --git a/ir/tr/typegmod.c b/ir/tr/typegmod.c index d6138fc11..a3cf5e1f4 100644 --- a/ir/tr/typegmod.c +++ b/ir/tr/typegmod.c @@ -5,30 +5,38 @@ ** */ +/* $Id$ */ + # include "typegmod_t.h" # include "type_t.h" # include "tpop_t.h" # include "irmode.h" -inline void exchange_types(type *old_type, type *new_type) { - int i; +INLINE void exchange_types(type *old_type, type *new_type) { /* Deallocate datastructures not directly contained in the - old type */ - /* @@@@ */ - - /* Remove old type from type list. Will this confuscate the - iterators? */ - /* @@@ */ + old type. We must do this now as it is the latest point + where we know the original kind of type. + */ + free_type_attrs(old_type); - /* Ev. add to a list of id types for later deallocation. */ - /* @@@ */ + /* @@@@ + Things to deal with: + * After exchange_types the type has two entries in the list of + all types in irp. So far this is fine for the walker. + Maybe it's better to remove the id entry and shrink the list. + Does this conflict with the walker? Might a type be left out + during the walk? + * Deallocation: if the Id is removed from the list it will eventualle + disappear in a memory leak. When is impossible to determine so we + need to hold it in a seperate list for deallocation. + */ /* Exchange the types */ old_type->type_op = type_id; old_type->mode = (ir_mode *) new_type; } -inline type *skip_tid(type *tp) { +INLINE type *skip_tid(type *tp) { while (tp->type_op == type_id) tp = (type *) tp->mode; return tp;