3 * File name: ir/tr/typegmod.c
4 * Purpose: Functionality to modify the type graph.
5 * Author: Goetz Lindenmaier
9 * Copyright: (c) 2001-2003 Universität Karlsruhe
10 * Licence: This file protected by GPL - GNU GENERAL PUBLIC LICENSE.
16 # include "typegmod.h"
21 void exchange_types(ir_type *old_type, ir_type *new_type) {
22 /* Deallocate datastructures not directly contained in the
23 old type. We must do this now as it is the latest point
24 where we know the original kind of type.
26 free_type_attrs(old_type);
30 * After exchange_types the type has two entries in the list of
31 all types in irp. So far this is fine for the walker.
32 Maybe it's better to remove the id entry and shrink the list.
33 Does this conflict with the walker? Might a type be left out
35 * Deallocation: if the Id is removed from the list it will eventually
36 disappear in a memory leak. When is impossible to determine so we
37 need to hold it in a separate list for deallocation.
40 /* Exchange the types */
41 old_type->type_op = type_id;
42 old_type->mode = (ir_mode *) new_type;
45 ir_type *skip_tid(ir_type *tp) {
46 /* @@@ implement the self cycle killing trick of skip_id(ir_node *) */
47 while (tp->type_op == type_id)
48 tp = (ir_type *) tp->mode;