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.
26 #include "pseudo_irg.h"
28 #include "firm_common_t.h"
31 #include "callgraph.h"
38 ident *name; /**< A file name or the like. */
39 ir_graph *main_irg; /**< entry point to the compiled program
40 @@@ or a list, in case we compile a library or the like? */
41 ir_graph **graphs; /**< all graphs in the ir */
42 ir_graph **pseudo_graphs; /**< all pseudo graphs in the ir. See pseudo_irg.c */
43 ir_graph *const_code_irg; /**< This ir graph gives the proper environment
44 to allocate nodes the represent values
45 of constant entities. It is not meant as
47 type *glob_type; /**< global type. Must be a class as it can
48 have fields and procedures. */
49 type **types; /**< all types in the ir */
51 /* -- states of and access to generated information -- */
53 ip_view_state ip_view; /**< State of interprocedural view. */
55 irg_outs_state outs_state; /**< Out edges. */
56 ir_node **ip_outedges; /**< Huge Array that contains all out edges
57 in interprocedural view. */
59 irg_callee_info_state callee_info_state; /**< Validity of callee information.
60 Contains the lowest value or all irgs. */
63 irp_callgraph_state callgraph_state; /**< State of the callgraph. */
64 struct ir_loop *outermost_cg_loop; /**< For callgraph analysis: entry point
65 to looptree over callgraph. */
66 int max_callgraph_loop_depth;
67 int max_callgraph_recursion_depth;
70 long max_node_nr; /**< to generate unique numbers for nodes. */
74 INLINE void remove_irp_type_from_list (type *typ);
77 __get_glob_type(void) {
79 return irp->glob_type = skip_tid(irp->glob_type);
83 __get_irp_n_irgs(void) {
84 assert (irp && irp->graphs);
85 if (get_visit_pseudo_irgs()) return get_irp_n_allirgs();
86 return (ARR_LEN((irp)->graphs));
89 static INLINE ir_graph *
90 __get_irp_irg(int pos){
91 if (get_visit_pseudo_irgs()) return get_irp_allirg(pos);
92 assert(0 <= pos && pos <= get_irp_n_irgs());
93 return irp->graphs[pos];
98 __get_irp_n_types (void) {
99 assert (irp && irp->types);
100 return (ARR_LEN((irp)->types));
104 __get_irp_type(int pos) {
105 assert (irp && irp->types);
106 /* Don't set the skip_tid result so that no double entries are generated. */
107 return skip_tid(irp->types[pos]);
111 /** Returns a new, unique number to number nodes or the like. */
112 int get_irp_new_node_nr(void);
115 static INLINE ir_graph *
116 __get_const_code_irg(void)
118 return irp->const_code_irg;
121 void set_irp_ip_outedges(ir_node ** ip_outedges);
122 ir_node** get_irp_ip_outedges(void);
124 /** initializes ir_prog. Calls the constructor for an ir_prog. */
125 void init_irprog(void);
127 #define get_irp_n_irgs() __get_irp_n_irgs()
128 #define get_irp_irg(pos) __get_irp_irg(pos)
129 #define get_irp_n_types() __get_irp_n_types()
130 #define get_irp_type(pos) __get_irp_type(pos)
131 #define get_const_code_irg() __get_const_code_irg()
132 #define get_glob_type() __get_glob_type()
134 #endif /* ifndef _IRPROG_T_H_ */