libFirm 1.20
libfirm/irprog.h
Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 1995-2008 University of Karlsruhe.  All right reserved.
00003  *
00004  * This file is part of libFirm.
00005  *
00006  * This file may be distributed and/or modified under the terms of the
00007  * GNU General Public License version 2 as published by the Free Software
00008  * Foundation and appearing in the file LICENSE.GPL included in the
00009  * packaging of this file.
00010  *
00011  * Licensees holding valid libFirm Professional Edition licenses may use
00012  * this file in accordance with the libFirm Commercial License.
00013  * Agreement provided with the Software.
00014  *
00015  * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00016  * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
00017  * PURPOSE.
00018  */
00019 
00029 #ifndef FIRM_IR_IRPROG_H
00030 #define FIRM_IR_IRPROG_H
00031 
00032 #include <stddef.h>
00033 #include "firm_types.h"
00034 #include "irgraph.h"
00035 #include "begin.h"
00036 
00060 typedef enum ir_segment_t {
00061     IR_SEGMENT_FIRST,
00063     IR_SEGMENT_GLOBAL = IR_SEGMENT_FIRST,
00065     IR_SEGMENT_THREAD_LOCAL,
00071     IR_SEGMENT_CONSTRUCTORS,
00073     IR_SEGMENT_DESTRUCTORS,
00074 
00075     IR_SEGMENT_LAST = IR_SEGMENT_DESTRUCTORS
00076 } ir_segment_t;
00077 ENUM_COUNTABLE(ir_segment_t)
00078 
00079 
00086 FIRM_API ir_prog *irp;
00087 
00091 typedef enum irp_resources_t {
00092     IRP_RESOURCE_NONE         = 0,      
00094     IRP_RESOURCE_IRG_LINK     = 1 << 0,
00096     IRP_RESOURCE_ENTITY_LINK  = 1 << 1,
00099     IRP_RESOURCE_TYPE_VISITED = 1 << 2,
00101     IRP_RESOURCE_TYPE_LINK    = 1 << 3,
00102 } irp_resources_t;
00103 ENUM_BITSET(irp_resources_t)
00104 
00105 #ifndef NDEBUG
00106 
00113 FIRM_API void irp_reserve_resources(ir_prog *irp, irp_resources_t resources);
00115 FIRM_API void irp_free_resources(ir_prog *irp, irp_resources_t resources);
00117 FIRM_API irp_resources_t irp_resources_reserved(const ir_prog *irp);
00118 #else
00119 #define irp_reserve_resources(irp, resources) (void)0
00120 #define irp_free_resources(irp, resources)    (void)0
00121 #define irp_resources_reserved(irp)           0
00122 #endif
00123 
00130 FIRM_API ir_prog *get_irp(void);
00131 
00133 FIRM_API void set_irp(ir_prog *irp);
00134 
00141 FIRM_API ir_prog *new_ir_prog(const char *name);
00142 
00145 FIRM_API void free_ir_prog(void);
00146 
00149 FIRM_API void set_irp_prog_name(ident *name);
00150 
00152 FIRM_API int irp_prog_name_is_set(void);
00153 
00155 FIRM_API ident *get_irp_ident(void);
00156 
00158 FIRM_API const char *get_irp_name(void);
00159 
00161 FIRM_API ir_graph *get_irp_main_irg(void);
00162 
00164 FIRM_API void set_irp_main_irg(ir_graph *main_irg);
00165 
00167 FIRM_API void add_irp_irg(ir_graph *irg);
00168 
00171 FIRM_API void remove_irp_irg_from_list(ir_graph *irg);
00174 FIRM_API void remove_irp_irg(ir_graph *irg);
00175 
00177 FIRM_API size_t get_irp_last_idx(void);
00178 
00180 FIRM_API size_t get_irp_n_irgs(void);
00181 
00183 FIRM_API ir_graph *get_irp_irg(size_t pos);
00184 
00186 FIRM_API void set_irp_irg(size_t pos, ir_graph *irg);
00187 
00193 FIRM_API ir_type *get_segment_type(ir_segment_t segment);
00194 
00199 FIRM_API void set_segment_type(ir_segment_t segment, ir_type *new_type);
00200 
00206 FIRM_API ir_type *get_glob_type(void);
00207 
00213 FIRM_API ir_type *get_tls_type(void);
00214 
00219 FIRM_API size_t get_irp_n_types(void);
00220 
00225 FIRM_API ir_type *get_irp_type(size_t pos);
00226 
00231 FIRM_API void set_irp_type(size_t pos, ir_type *typ);
00232 
00244 FIRM_API ir_graph *get_const_code_irg(void);
00245 
00254 FIRM_API irg_phase_state get_irp_phase_state(void);
00256 FIRM_API void set_irp_phase_state(irg_phase_state s);
00257 
00266 FIRM_API ir_prog_pass_t *set_irp_phase_state_pass(const char *name,
00267                                                   irg_phase_state state);
00268 
00271 FIRM_API irg_callee_info_state get_irp_callee_info_state(void);
00274 FIRM_API void set_irp_callee_info_state(irg_callee_info_state s);
00275 
00277 FIRM_API ir_label_t get_irp_next_label_nr(void);
00278 
00280 FIRM_API void add_irp_asm(ident *asm_string);
00281 
00283 FIRM_API size_t get_irp_n_asms(void);
00284 
00286 FIRM_API ident *get_irp_asm(size_t pos);
00287 
00289 FIRM_API int get_irp_optimization_dumps(void);
00290 
00292 FIRM_API void enable_irp_optimization_dumps(void);
00293 
00296 #include "end.h"
00297 
00298 #endif