typos fixed
[libfirm] / ir / tr / typegmod.c
1 /*
2  * Project:     libFIRM
3  * File name:   ir/tr/typegmod.c
4  * Purpose:     Functionality to modify the type graph.
5  * Author:      Goetz Lindenmaier
6  * Modified by:
7  * Created:
8  * CVS-ID:      $Id$
9  * Copyright:   (c) 2001-2003 Universität Karlsruhe
10  * Licence:     This file protected by GPL -  GNU GENERAL PUBLIC LICENSE.
11  */
12 #ifdef HAVE_CONFIG_H
13 #include "config.h"
14 #endif
15
16 # include "typegmod.h"
17 # include "type_t.h"
18 # include "tpop_t.h"
19 # include "irmode.h"
20
21 INLINE void exchange_types(type *old_type, 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.
25      */
26   free_type_attrs(old_type);
27
28   /* @@@@
29      Things to deal with:
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
34        during the walk?
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.
38   */
39
40   /* Exchange the types */
41   old_type->type_op = type_id;
42   old_type->mode = (ir_mode *) new_type;
43 }
44
45 INLINE type *skip_tid(type *tp) {
46   /* @@@ implement the self cycle killing trick of skip_id(ir_node *) */
47   while (tp->type_op == type_id)
48     tp = (type *) tp->mode;
49   return tp;
50 }