3 * File name: ir/ir/irprog_t.h
4 * Purpose: Entry point to the representation of a whole program 0-- private header.
5 * Author: Goetz Lindenmaier
9 * Copyright: (c) 2000-2003 Universität Karlsruhe
10 * Licence: This file protected by GPL - GNU GENERAL PUBLIC LICENSE.
21 #include "firm_config.h"
26 #include "pseudo_irg.h"
28 #include "firm_common_t.h"
30 #include "irtypeinfo.h"
31 #include "tr_inheritance.h"
33 #include "callgraph.h"
34 #include "field_temperature.h"
35 #include "execution_frequency.h"
42 ident *name; /**< A file name or the like. */
43 ir_graph *main_irg; /**< entry point to the compiled program
44 @@@ or a list, in case we compile a library or the like? */
45 ir_graph **graphs; /**< all graphs in the ir */
46 ir_graph **pseudo_graphs; /**< all pseudo graphs in the ir. See pseudo_irg.c */
47 ir_graph *const_code_irg; /**< This ir graph gives the proper environment
48 to allocate nodes the represent values
49 of constant entities. It is not meant as
51 type *glob_type; /**< global type. Must be a class as it can
52 have fields and procedures. */
53 type **types; /**< all types in the ir */
55 /* -- states of and access to generated information -- */
56 irg_phase_state phase_state; /**< State of construction. */
58 ip_view_state ip_view; /**< State of interprocedural view. */
60 irg_outs_state outs_state; /**< State of out edges of ir nodes. */
61 ir_node **ip_outedges; /**< Huge Array that contains all out edges
62 in interprocedural view. */
63 irg_outs_state trouts_state; /**< State of out edges of type information. */
65 irg_callee_info_state callee_info_state; /**< Validity of callee information.
66 Contains the lowest value or all irgs. */
67 ir_typeinfo_state typeinfo_state; /**< Validity of type information. */
68 inh_transitive_closure_state inh_trans_closure_state; /**< trans closure of inh relations. */
70 irp_callgraph_state callgraph_state; /**< State of the callgraph. */
71 struct ir_loop *outermost_cg_loop; /**< For callgraph analysis: entry point
72 to looptree over callgraph. */
73 int max_callgraph_loop_depth; /**< needed in callgraph. */
74 int max_callgraph_recursion_depth; /**< needed in callgraph. */
75 double max_method_execution_frequency; /**< needed in callgraph. */
76 irp_temperature_state temperature_state; /**< accumulated temperatures computed? */
77 exec_freq_state execfreq_state; /**< State of execution freqency information */
78 loop_nesting_depth_state lnd_state; /**< State of loop nesting depth information. */
79 ir_class_cast_state class_cast_state; /**< kind of cast operations in code. */
82 long max_node_nr; /**< to generate unique numbers for nodes. */
86 void remove_irp_type_from_list (type *typ);
89 __get_glob_type(void) {
91 return irp->glob_type = skip_tid(irp->glob_type);
95 __get_irp_n_irgs(void) {
96 assert (irp && irp->graphs);
97 if (get_visit_pseudo_irgs()) return get_irp_n_allirgs();
98 return (ARR_LEN((irp)->graphs));
101 static INLINE ir_graph *
102 __get_irp_irg(int pos){
103 if (get_visit_pseudo_irgs()) return get_irp_allirg(pos);
104 assert(0 <= pos && pos <= get_irp_n_irgs());
105 return irp->graphs[pos];
110 __get_irp_n_types (void) {
111 assert (irp && irp->types);
112 return (ARR_LEN((irp)->types));
116 __get_irp_type(int pos) {
117 assert (irp && irp->types);
118 /* Don't set the skip_tid result so that no double entries are generated. */
119 return skip_tid(irp->types[pos]);
123 /** Returns a new, unique number to number nodes or the like. */
124 int get_irp_new_node_nr(void);
127 static INLINE ir_graph *
128 __get_const_code_irg(void)
130 return irp->const_code_irg;
133 void set_irp_ip_outedges(ir_node ** ip_outedges);
134 ir_node** get_irp_ip_outedges(void);
136 /** initializes ir_prog. Calls the constructor for an ir_prog. */
137 void init_irprog(void);
139 #define get_irp_n_irgs() __get_irp_n_irgs()
140 #define get_irp_irg(pos) __get_irp_irg(pos)
141 #define get_irp_n_types() __get_irp_n_types()
142 #define get_irp_type(pos) __get_irp_type(pos)
143 #define get_const_code_irg() __get_const_code_irg()
144 #define get_glob_type() __get_glob_type()
146 #endif /* ifndef _IRPROG_T_H_ */