Remove the unused facility to register space /in front of/ a node.
[libfirm] / ir / ir / irprog_t.h
1 /*
2  * Copyright (C) 1995-2008 University of Karlsruhe.  All right reserved.
3  *
4  * This file is part of libFirm.
5  *
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.
10  *
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.
14  *
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
17  * PURPOSE.
18  */
19
20 /**
21  * @file
22  * @brief    Entry point to the representation of a whole program 0-- private header.
23  * @author   Goetz Lindenmaier
24  * @date     2000
25  */
26 #ifndef FIRM_IR_IRPROG_T_H
27 #define FIRM_IR_IRPROG_T_H
28
29 #include "irprog.h"
30 #include "irtypes.h"
31 #include "irtypeinfo.h"
32 #include "irmemory.h"
33
34 #include "callgraph.h"
35
36 #include "array.h"
37
38 /* inline functions */
39 static inline ir_type *get_segment_type_(ir_segment_t segment)
40 {
41         assert(segment <= IR_SEGMENT_LAST);
42         return irp->segment_types[segment];
43 }
44
45 static inline ir_type *get_glob_type_(void)
46 {
47         return get_segment_type_(IR_SEGMENT_GLOBAL);
48 }
49
50 static inline ir_type *get_tls_type_(void)
51 {
52         return get_segment_type_(IR_SEGMENT_THREAD_LOCAL);
53 }
54
55 static inline size_t get_irp_n_irgs_(void)
56 {
57         assert(irp && irp->graphs);
58         return ARR_LEN(irp->graphs);
59 }
60
61 static inline ir_graph *get_irp_irg_(size_t pos)
62 {
63         assert(pos < ARR_LEN(irp->graphs));
64         return irp->graphs[pos];
65 }
66
67 static inline size_t get_irp_n_types_(void)
68 {
69         assert(irp && irp->types);
70         return ARR_LEN(irp->types);
71 }
72
73 static inline ir_type *get_irp_type_(size_t pos)
74 {
75         assert(irp->types);
76         assert(pos < ARR_LEN(irp->types));
77         /* Don't set the skip_tid result so that no double entries are generated. */
78         return irp->types[pos];
79 }
80
81 /** Returns a new, unique number to number nodes or the like. */
82 static inline long get_irp_new_node_nr(void)
83 {
84         assert(irp);
85         return irp->max_node_nr++;
86 }
87
88 static inline size_t get_irp_new_irg_idx(void)
89 {
90         assert(irp);
91         return irp->max_irg_idx++;
92 }
93
94 static inline ir_graph *get_const_code_irg_(void)
95 {
96         return irp->const_code_irg;
97 }
98
99 /** Returns a new, unique label number. */
100 static inline ir_label_t get_irp_next_label_nr_(void)
101 {
102         assert(irp);
103         return ++irp->last_label_nr;
104 }
105
106 void      set_irp_ip_outedges(ir_node ** ip_outedges);
107 ir_node** get_irp_ip_outedges(void);
108
109 /** initializes ir_prog. Constructs only the basic lists */
110 void init_irprog_1(void);
111
112 /** Completes ir_prog. */
113 void init_irprog_2(void);
114
115 /** Adds type to the list of types in irp. */
116 void add_irp_type(ir_type *typ);
117
118 /** Removes type from the list of types, deallocates it and
119     shrinks the list by one. */
120 void remove_irp_type(ir_type *typ);
121
122 /* Inline functions. */
123 #define get_irp_n_irgs()                 get_irp_n_irgs_()
124 #define get_irp_irg(pos)                 get_irp_irg_(pos)
125 #define get_irp_n_types()                get_irp_n_types_()
126 #define get_irp_type(pos)                get_irp_type_(pos)
127 #define get_const_code_irg()             get_const_code_irg_()
128 #define get_segment_type(s)              get_segment_type_(s)
129 #define get_glob_type()                  get_glob_type_()
130 #define get_tls_type()                   get_tls_type_()
131 #define get_irp_next_label_nr()          get_irp_next_label_nr_()
132
133 #endif