2 * Copyright (C) 1995-2008 University of Karlsruhe. All right reserved.
4 * This file is part of libFirm.
6 * This file may be distributed and/or modified under the terms of the
7 * GNU General Public License version 2 as published by the Free Software
8 * Foundation and appearing in the file LICENSE.GPL included in the
9 * packaging of this file.
11 * Licensees holding valid libFirm Professional Edition licenses may use
12 * this file in accordance with the libFirm Commercial License.
13 * Agreement provided with the Software.
15 * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
16 * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * @brief Entry point to the representation of a whole program 0-- private header.
23 * @author Goetz Lindenmaier
27 #ifndef FIRM_IR_IRPROG_T_H
28 #define FIRM_IR_IRPROG_T_H
30 #include "firm_config.h"
33 #include "pseudo_irg.h"
35 #include "firm_common_t.h"
36 #include "irtypeinfo.h"
39 #include "callgraph.h"
40 #include "field_temperature.h"
41 #include "execution_frequency.h"
45 /** Adds mode to the list of modes in irp. */
46 void add_irp_mode(ir_mode *mode);
48 /* INLINE functions */
50 static INLINE ir_type *
51 _get_glob_type(void) {
53 return irp->glob_type = skip_tid(irp->glob_type);
56 static INLINE ir_type *
59 return irp->tls_type = skip_tid(irp->tls_type);
62 static INLINE ir_type *
63 _get_constructors_type(void) {
65 return irp->constructors_type = skip_tid(irp->constructors_type);
69 _get_irp_n_irgs(void) {
70 assert (irp && irp->graphs);
71 if (get_visit_pseudo_irgs()) return get_irp_n_allirgs();
72 return ARR_LEN(irp->graphs);
75 static INLINE ir_graph *
76 _get_irp_irg(int pos){
77 if (get_visit_pseudo_irgs()) return get_irp_allirg(pos);
78 assert(0 <= pos && pos <= _get_irp_n_irgs());
79 return irp->graphs[pos];
84 _get_irp_n_types(void) {
85 assert (irp && irp->types);
86 return ARR_LEN(irp->types);
89 static INLINE ir_type *
90 _get_irp_type(int pos) {
91 assert (irp && irp->types);
92 /* Don't set the skip_tid result so that no double entries are generated. */
93 return skip_tid(irp->types[pos]);
97 _get_irp_n_modes(void) {
98 assert (irp && irp->modes);
99 return ARR_LEN(irp->modes);
102 static INLINE ir_mode *
103 _get_irp_mode(int pos) {
104 assert (irp && irp->modes);
105 return irp->modes[pos];
109 _get_irp_n_opcodes(void) {
110 assert (irp && irp->opcodes);
111 return ARR_LEN(irp->opcodes);
114 static INLINE ir_op *
115 _get_irp_opcode(int pos) {
116 assert (irp && irp->opcodes);
117 return irp->opcodes[pos];
121 /** Returns a new, unique number to number nodes or the like. */
123 get_irp_new_node_nr(void) {
125 return irp->max_node_nr++;
127 #endif /* DEBUG_libfirm */
130 get_irp_new_irg_idx(void) {
132 return irp->max_irg_idx++;
135 static INLINE ir_graph *
136 _get_const_code_irg(void) {
137 return irp->const_code_irg;
140 /** Returns a new, unique exception region number. */
141 static INLINE ir_exc_region_t
142 _get_irp_next_region_nr(void) {
144 return ++irp->last_region_nr;
147 /** Returns a new, unique label number. */
148 static INLINE ir_label_t
149 _get_irp_next_label_nr(void) {
151 return ++irp->last_label_nr;
154 void set_irp_ip_outedges(ir_node ** ip_outedges);
155 ir_node** get_irp_ip_outedges(void);
157 /** initializes ir_prog. Constructs only the basic lists */
158 void init_irprog_1(void);
160 /** Completes ir_prog. */
161 void init_irprog_2(void);
163 /* Inline functions. */
164 #define get_irp_n_irgs() _get_irp_n_irgs()
165 #define get_irp_irg(pos) _get_irp_irg(pos)
166 #define get_irp_n_types() _get_irp_n_types()
167 #define get_irp_type(pos) _get_irp_type(pos)
168 #define get_irp_n_modes() _get_irp_n_modes()
169 #define get_irp_mode(pos) _get_irp_mode(pos)
170 #define get_irp_n_opcodes() _get_irp_n_opcodes()
171 #define get_irp_opcode(pos) _get_irp_opcode(pos)
172 #define get_const_code_irg() _get_const_code_irg()
173 #define get_glob_type() _get_glob_type()
174 #define get_tls_type() _get_tls_type()
175 #define get_constructors_type() _get_constructors_type()
176 #define get_irp_next_region_nr() _get_irp_next_region_nr()
177 #define get_irp_next_label_nr() _get_irp_next_label_nr()