libFirm
irprog.h
1 /*
2  * This file is part of libFirm.
3  * Copyright (C) 2012 University of Karlsruhe.
4  */
5 
15 #ifndef FIRM_IR_IRPROG_H
16 #define FIRM_IR_IRPROG_H
17 
18 #include <stddef.h>
19 #include "firm_types.h"
20 #include "irgraph.h"
21 #include "begin.h"
22 
46 typedef enum ir_segment_t {
62 
64 } ir_segment_t;
65 ENUM_COUNTABLE(ir_segment_t)
66 
67 
74 FIRM_API ir_prog *irp;
75 
79 typedef enum irp_resources_t {
91 ENUM_BITSET(irp_resources_t)
92 
93 
100 FIRM_API void irp_reserve_resources(ir_prog *irp, irp_resources_t resources);
102 FIRM_API void irp_free_resources(ir_prog *irp, irp_resources_t resources);
104 FIRM_API irp_resources_t irp_resources_reserved(const ir_prog *irp);
105 
112 FIRM_API ir_prog *get_irp(void);
113 
115 FIRM_API void set_irp(ir_prog *irp);
116 
123 FIRM_API ir_prog *new_ir_prog(const char *name);
124 
127 FIRM_API void free_ir_prog(void);
128 
131 FIRM_API void set_irp_prog_name(ident *name);
132 
134 FIRM_API int irp_prog_name_is_set(void);
135 
137 FIRM_API ident *get_irp_ident(void);
138 
140 FIRM_API const char *get_irp_name(void);
141 
143 FIRM_API ir_graph *get_irp_main_irg(void);
144 
146 FIRM_API void set_irp_main_irg(ir_graph *main_irg);
147 
149 FIRM_API size_t get_irp_last_idx(void);
150 
152 FIRM_API size_t get_irp_n_irgs(void);
153 
155 FIRM_API ir_graph *get_irp_irg(size_t pos);
156 
158 FIRM_API void set_irp_irg(size_t pos, ir_graph *irg);
159 
165 FIRM_API ir_type *get_segment_type(ir_segment_t segment);
166 
171 FIRM_API void set_segment_type(ir_segment_t segment, ir_type *new_type);
172 
178 FIRM_API ir_type *get_glob_type(void);
179 
185 FIRM_API ir_type *get_tls_type(void);
186 
192 FIRM_API ir_entity *ir_get_global(ident *name);
193 
198 FIRM_API size_t get_irp_n_types(void);
199 
204 FIRM_API ir_type *get_irp_type(size_t pos);
205 
210 FIRM_API void set_irp_type(size_t pos, ir_type *typ);
211 
223 FIRM_API ir_graph *get_const_code_irg(void);
224 
231 
233 FIRM_API ir_label_t get_irp_next_label_nr(void);
234 
236 FIRM_API void add_irp_asm(ident *asm_string);
237 
239 FIRM_API size_t get_irp_n_asms(void);
240 
242 FIRM_API ident *get_irp_asm(size_t pos);
243 
246 #include "end.h"
247 
248 #endif
thread local storage segment
Definition: irprog.h:51
const char * get_irp_name(void)
Returns the name of the current irp.
const char ident
Identifier.
Definition: firm_types.h:50
ir_entity * ir_get_global(ident *name)
Returns global entity with name name.
void set_segment_type(ir_segment_t segment, ir_type *new_type)
Changes a segment segment type for the program.
void set_irp(ir_prog *irp)
Sets current irp.
the constructors segment.
Definition: irprog.h:57
type visited field
Definition: irprog.h:87
ir_type * get_irp_type(size_t pos)
Returns the type at position pos in the irp.
irg_callee_info_state get_irp_callee_info_state(void)
Returns callee info state for the whole program.
type link field
Definition: irprog.h:89
ir_type * get_segment_type(ir_segment_t segment)
Returns the type containing the entities for a segment.
void free_ir_prog(void)
Frees all memory used by irp.
ir_graph * get_irp_main_irg(void)
Returns the main routine of the compiled program.
ident * get_irp_asm(size_t pos)
Returns the global asm include at position pos.
void set_irp_callee_info_state(irg_callee_info_state s)
Sets callee info state for the whole program.
ir_graph * get_irp_irg(size_t pos)
Returns the ir graph at position pos in the irp.
struct ir_type ir_type
Type.
Definition: firm_types.h:71
ir_prog * get_irp(void)
Returns the current irp from where everything in the current module can be accessed.
ir_prog * new_ir_prog(const char *name)
Creates a new ir_prog (a module or compilation unit).
size_t get_irp_last_idx(void)
returns the biggest not used irg index number
ir_segment_t
Segment.
Definition: irprog.h:46
ir_type * get_tls_type(void)
Returns the "thread local storage" type of the irp.
irp_resources_t
Resources usable by algorithms modifying the program.
Definition: irprog.h:79
irg_callee_info_state
state: callee_information_state Call nodes contain a list of possible callees.
Definition: irgraph.h:227
struct ir_prog ir_prog
Program.
Definition: firm_types.h:77
void set_irp_main_irg(ir_graph *main_irg)
Sets the main routine of the compiled program.
like constructors, but functions are executed on module exit
Definition: irprog.h:59
entity link field
Definition: irprog.h:84
ir_prog * irp
A variable pointing to the current irp (program or module).
Definition: irprog.h:74
ir_label_t get_irp_next_label_nr(void)
Returns a new, unique label number.
void add_irp_asm(ident *asm_string)
Add a new global asm include.
void set_irp_prog_name(ident *name)
Sets the file name / executable name or the like.
size_t get_irp_n_irgs(void)
Returns the number of ir graphs in the irp.
no resource
Definition: irprog.h:80
void set_irp_type(size_t pos, ir_type *typ)
Overwrites the type at position pos with another type.
"normal" global data
Definition: irprog.h:49
size_t get_irp_n_types(void)
Returns the number of all types in the irp.
irp_resources_t irp_resources_reserved(const ir_prog *irp)
Returns currently reserved whole program resources.
void set_irp_irg(size_t pos, ir_graph *irg)
Sets the ir graph at position pos.
irg link field
Definition: irprog.h:82
struct ir_entity ir_entity
Entity.
Definition: firm_types.h:83
ir_graph * get_const_code_irg(void)
Returns the graph for global constants of the current irp.
ident * get_irp_ident(void)
Returns the name of the current irp.
size_t get_irp_n_asms(void)
Returns the number of global asm includes.
struct ir_graph ir_graph
Procedure Graph.
Definition: firm_types.h:74
void irp_free_resources(ir_prog *irp, irp_resources_t resources)
Frees resources available for a whole program.
java class registry
Definition: irprog.h:61
int irp_prog_name_is_set(void)
Returns true if the user ever set a program name.
void irp_reserve_resources(ir_prog *irp, irp_resources_t resources)
Reserve resources available for a whole program.
ir_type * get_glob_type(void)
Returns the "global" type of the irp.