6 * File name: ir/ana/irtypeinfo.h
7 * Purpose: Data structure to hold type information for nodes.
8 * Author: Goetz Lindenmaier
12 * Copyright: (c) 2003 Universität Karlsruhe
13 * Licence: This file protected by GPL - GNU GENERAL PUBLIC LICENSE.
15 * Data structure to hold type information for nodes.
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".
24 # ifndef _IRTYPEINFO_H_
25 # define _IRTYPEINFO_H_
31 /* ------------ Auxiliary type. --------------------------------------- */
33 /** An auxiliary type used to express that a field is uninitialized.
35 * This auxiliary type expresses that a field is uninitialized. The
36 * variable is set by init_irtypeinfo. The type is freed by
39 extern type *initial_type;
43 /* ------------ Initializing this module. ----------------------------- */
45 /** Initializes the type information module.
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).
52 void init_irtypeinfo(void);
53 void free_irtypeinfo(void);
55 /* ------------ Irgraph state handling. ------------------------------- */
58 irg_typeinfo_none, /**< No typeinfo computed, calls to set/get_irn_type
60 irg_typeinfo_consistent, /**< Type info valid, calls to set/get_irn_type return
62 irg_typeinfo_inconsistent /**< Type info can be accessed, but it can be invalid
63 because of other transformations. */
66 void set_irg_typeinfo_state(ir_graph *irg, irg_typeinfo_state s);
67 irg_typeinfo_state get_irg_typeinfo_state(ir_graph *irg);
69 /* ------------ Irnode type information. ------------------------------ */
71 /** Accessing the type information.
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.
77 type *get_irn_type(ir_node *n);
78 void set_irn_type(ir_node *n, type *tp);
80 #endif /* _IRTYPEINFO_H_ */