Make prefixes for most (hopefully all) enum values. Means change your code, I/F has...
[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
13 # include "typegmod.h"
14 # include "type_t.h"
15 # include "tpop_t.h"
16 # include "irmode.h"
17
18 INLINE void exchange_types(type *old_type, type *new_type) {
19   /* Deallocate datastructures not directly contained in the
20      old type.  We must do this now as it is the latest point
21      where we know the original kind of type.
22      */
23   free_type_attrs(old_type);
24
25   /* @@@@
26      Things to deal with:
27      * After exchange_types the type has two entries in the list of
28        all types in irp.  So far this is fine for the walker.
29        Maybe it's better to remove the id entry and shrink the list.
30        Does this conflict with the walker?  Might a type be left out
31        during the walk?
32      * Deallocation:  if the Id is removed from the list it will eventualle
33        disappear in a memory leak.  When is impossible to determine so we
34        need to hold it in a seperate list for deallocation.
35   */
36
37   /* Exchange the types */
38   old_type->type_op = type_id;
39   old_type->mode = (ir_mode *) new_type;
40 }
41
42 INLINE type *skip_tid(type *tp) {
43   /* @@@ implement the self cycle killing trick of skip_id(ir_node *) */
44   while (tp->type_op == type_id)
45     tp = (type *) tp->mode;
46   return tp;
47 }