fixed doxygen comments, removed initialization for description entities
[libfirm] / ir / ana / irtypeinfo.h
1 /**
2  *
3  * @file irtypeinfo.h
4  *
5  * Project:     libFIRM
6  * File name:   ir/ana/irtypeinfo.h
7  * Purpose:     Data structure to hold type information for nodes.
8  * Author:      Goetz Lindenmaier
9  * Modified by:
10  * Created:     28.8.2003
11  * CVS-ID:      $Id$
12  * Copyright:   (c) 2003 Universität Karlsruhe
13  * Licence:     This file protected by GPL -  GNU GENERAL PUBLIC LICENSE.
14  *
15  * Data structure to hold type information for nodes.
16  *
17  * This module defines a field "type" of type "type *" for each ir node.
18  * It defines a flag for irgraphs to mark whether the type info of the
19  * graph is valid.  Further it defines an auxiliary type "init_type".
20  *
21  */
22
23
24 # ifndef _IRTYPEINFO_H_
25 # define _IRTYPEINFO_H_
26
27 # include "irgraph.h"
28 # include "irnode.h"
29 # include "type.h"
30
31 /* ------------ Auxiliary type. --------------------------------------- */
32
33 /** An auxiliary type used to express that a field is uninitialized.
34  *
35  *  This auxiliary type expresses that a field is uninitialized.  The
36  *  variable is set by init_irtypeinfo.  The type is freed by
37  *  free_irtypeinfo.
38  */
39 extern type *initial_type;
40
41
42
43 /* ------------ Initializing this module. ----------------------------- */
44
45 /** Initializes the type information module.
46  *
47  *  Initializes the type information module.
48  *  Generates a type "init_type" and sets the type of all nodes to this type.
49  *  Calling set/get_irn_type is invalid before calling init. Requires memory
50  *  in the order of MIN(<calls to set_irn_type>, #irnodes).
51  */
52 void init_irtypeinfo(void);
53 void free_irtypeinfo(void);
54
55 /* ------------ Irgraph state handling. ------------------------------- */
56
57 typedef enum {
58   irg_typeinfo_none,         /**< No typeinfo computed, calls to set/get_irn_type
59                                   are invalid. */
60   irg_typeinfo_consistent,   /**< Type info valid, calls to set/get_irn_type return
61                                   the proper type. */
62   irg_typeinfo_inconsistent  /**< Type info can be accessed, but it can be invalid
63                                   because of other transformations. */
64 } irg_typeinfo_state;
65
66 void               set_irg_typeinfo_state(ir_graph *irg, irg_typeinfo_state s);
67 irg_typeinfo_state get_irg_typeinfo_state(ir_graph *irg);
68
69 /* ------------ Irnode type information. ------------------------------ */
70
71 /** Accessing the type information.
72  *
73  * These routines only work properly if the ir_graph is in state
74  * irg_typeinfo_consistent or irg_typeinfo_inconsistent.  They
75  * assume current_ir_graph set properly.
76  */
77 type *get_irn_type(ir_node *n);
78 void  set_irn_type(ir_node *n, type *tp);
79
80 #endif /* _IRTYPEINFO_H_ */