libFirm 1.20
|
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 00025 #ifndef FIRM_IR_IRGRAPH_H 00026 #define FIRM_IR_IRGRAPH_H 00027 00028 #include <stddef.h> 00029 00030 #include "firm_types.h" 00031 #include "begin.h" 00032 00149 FIRM_API ir_graph *new_ir_graph(ir_entity *ent, int n_loc); 00150 00159 FIRM_API void free_ir_graph(ir_graph *irg); 00160 00169 FIRM_API int is_ir_graph(const void *thing); 00170 00172 FIRM_API ir_entity *get_irg_entity(const ir_graph *irg); 00174 FIRM_API void set_irg_entity(ir_graph *irg, ir_entity *ent); 00175 00177 FIRM_API ir_type *get_irg_frame_type(ir_graph *irg); 00179 FIRM_API void set_irg_frame_type(ir_graph *irg, ir_type *ftp); 00180 00182 FIRM_API ir_node *get_irg_start_block(const ir_graph *irg); 00184 FIRM_API void set_irg_start_block(ir_graph *irg, ir_node *node); 00185 00187 FIRM_API ir_node *get_irg_start(const ir_graph *irg); 00189 FIRM_API void set_irg_start(ir_graph *irg, ir_node *node); 00190 00192 FIRM_API ir_node *get_irg_end_block(const ir_graph *irg); 00194 FIRM_API void set_irg_end_block(ir_graph *irg, ir_node *node); 00195 00197 FIRM_API ir_node *get_irg_end(const ir_graph *irg); 00199 FIRM_API void set_irg_end(ir_graph *irg, ir_node *node); 00200 00203 FIRM_API ir_node *get_irg_initial_exec(const ir_graph *irg); 00205 FIRM_API void set_irg_initial_exec(ir_graph *irg, ir_node *node); 00206 00208 FIRM_API ir_node *get_irg_frame(const ir_graph *irg); 00210 FIRM_API void set_irg_frame(ir_graph *irg, ir_node *node); 00211 00213 FIRM_API ir_node *get_irg_initial_mem(const ir_graph *irg); 00215 FIRM_API void set_irg_initial_mem(ir_graph *irg, ir_node *node); 00216 00218 FIRM_API ir_node *get_irg_args(const ir_graph *irg); 00220 FIRM_API void set_irg_args(ir_graph *irg, ir_node *node); 00221 00223 FIRM_API ir_node *get_irg_no_mem(const ir_graph *irg); 00225 FIRM_API void set_irg_no_mem(ir_graph *irg, ir_node *node); 00226 00228 FIRM_API int get_irg_n_locs(ir_graph *irg); 00229 00231 FIRM_API long get_irg_graph_nr(const ir_graph *irg); 00232 00238 FIRM_API size_t get_irg_idx(const ir_graph *irg); 00239 00249 FIRM_API ir_node *get_idx_irn(const ir_graph *irg, unsigned idx); 00250 00251 00270 typedef enum { 00271 phase_building, 00272 phase_high, 00273 phase_low, 00274 phase_backend 00275 } irg_phase_state; 00276 00278 FIRM_API irg_phase_state get_irg_phase_state(const ir_graph *irg); 00279 00281 FIRM_API void set_irg_phase_state(ir_graph *irg, irg_phase_state state); 00282 00290 FIRM_API op_pin_state get_irg_pinned(const ir_graph *irg); 00291 00299 typedef enum { 00300 irg_callee_info_none, 00301 irg_callee_info_consistent, 00302 irg_callee_info_inconsistent 00303 } irg_callee_info_state; 00304 00306 FIRM_API irg_callee_info_state get_irg_callee_info_state(const ir_graph *irg); 00307 00309 FIRM_API void set_irg_callee_info_state(ir_graph *irg, irg_callee_info_state s); 00310 00314 typedef enum { 00315 irg_inline_any, 00316 irg_inline_forbidden, 00317 irg_inline_recomended, 00318 irg_inline_forced, 00319 irg_inline_forced_no_body 00321 } irg_inline_property; 00322 00324 FIRM_API irg_inline_property get_irg_inline_property(const ir_graph *irg); 00326 FIRM_API void set_irg_inline_property(ir_graph *irg, irg_inline_property s); 00327 00336 FIRM_API mtp_additional_properties get_irg_additional_properties(const ir_graph *irg); 00337 00339 FIRM_API void set_irg_additional_properties(ir_graph *irg, 00340 mtp_additional_properties property_mask); 00341 00343 FIRM_API void add_irg_additional_properties(ir_graph *irg, 00344 mtp_additional_properties flag); 00345 00347 FIRM_API void set_irg_link(ir_graph *irg, void *thing); 00349 FIRM_API void *get_irg_link(const ir_graph *irg); 00350 00353 FIRM_API void inc_irg_visited(ir_graph *irg); 00356 FIRM_API ir_visited_t get_irg_visited(const ir_graph *irg); 00359 FIRM_API void set_irg_visited(ir_graph *irg, ir_visited_t i); 00362 FIRM_API ir_visited_t get_max_irg_visited(void); 00365 FIRM_API void set_max_irg_visited(int val); 00368 FIRM_API ir_visited_t inc_max_irg_visited(void); 00369 00372 FIRM_API void inc_irg_block_visited(ir_graph *irg); 00375 FIRM_API ir_visited_t get_irg_block_visited(const ir_graph *irg); 00378 FIRM_API void set_irg_block_visited(ir_graph *irg, ir_visited_t i); 00379 00385 typedef enum ir_resources_t { 00386 IR_RESOURCE_NONE = 0, 00387 IR_RESOURCE_BLOCK_VISITED = 1 << 0, 00388 IR_RESOURCE_BLOCK_MARK = 1 << 1, 00389 IR_RESOURCE_IRN_VISITED = 1 << 2, 00390 IR_RESOURCE_IRN_LINK = 1 << 3, 00391 IR_RESOURCE_LOOP_LINK = 1 << 4, 00392 IR_RESOURCE_PHI_LIST = 1 << 5 00393 } ir_resources_t; 00394 ENUM_BITSET(ir_resources_t) 00395 00396 #ifndef NDEBUG 00397 00404 FIRM_API void ir_reserve_resources(ir_graph *irg, ir_resources_t resources); 00406 FIRM_API void ir_free_resources(ir_graph *irg, ir_resources_t resources); 00408 FIRM_API ir_resources_t ir_resources_reserved(const ir_graph *irg); 00409 #else 00410 #define ir_reserve_resources(irg,resources) (void)0 00411 #define ir_free_resources(irg,resources) (void)0 00412 #define ir_resources_reserved(irg) 0 00413 #endif 00414 00421 typedef enum { 00425 IR_GRAPH_STATE_ARCH_DEP = 1U << 0, 00430 IR_GRAPH_STATE_MODEB_LOWERED = 1U << 1, 00436 IR_GRAPH_STATE_NORMALISATION2 = 1U << 2, 00443 IR_GRAPH_STATE_IMPLICIT_BITFIELD_MASKING = 1U << 3, 00449 IR_GRAPH_STATE_OPTIMIZE_UNREACHABLE_CODE = 1U << 4, 00451 IR_GRAPH_STATE_NO_CRITICAL_EDGES = 1U << 5, 00453 IR_GRAPH_STATE_NO_BADS = 1U << 6, 00459 IR_GRAPH_STATE_NO_UNREACHABLE_CODE = 1U << 7, 00461 IR_GRAPH_STATE_ONE_RETURN = 1U << 8, 00463 IR_GRAPH_STATE_CONSISTENT_DOMINANCE = 1U << 9, 00465 IR_GRAPH_STATE_CONSISTENT_POSTDOMINANCE = 1U << 10, 00470 IR_GRAPH_STATE_CONSISTENT_OUT_EDGES = 1U << 11, 00472 IR_GRAPH_STATE_CONSISTENT_OUTS = 1U << 12, 00474 IR_GRAPH_STATE_CONSISTENT_LOOPINFO = 1U << 13, 00476 IR_GRAPH_STATE_CONSISTENT_ENTITY_USAGE = 1U << 14, 00478 IR_GRAPH_STATE_VALID_EXTENDED_BLOCKS = 1U << 15, 00480 IR_GRAPH_STATE_MANY_RETURNS = 1U << 16, 00481 } ir_graph_state_t; 00482 ENUM_BITSET(ir_graph_state_t) 00483 00484 00485 FIRM_API void set_irg_state(ir_graph *irg, ir_graph_state_t state); 00487 FIRM_API void clear_irg_state(ir_graph *irg, ir_graph_state_t state); 00489 FIRM_API int is_irg_state(const ir_graph *irg, ir_graph_state_t state); 00490 00492 FIRM_API void set_irg_loc_description(ir_graph *irg, int n, void *description); 00493 00495 FIRM_API void *get_irg_loc_description(ir_graph *irg, int n); 00496 00500 FIRM_API unsigned get_irg_estimated_node_cnt(const ir_graph *irg); 00501 00503 FIRM_API unsigned get_irg_last_idx(const ir_graph *irg); 00504 00506 FIRM_API unsigned get_irg_fp_model(const ir_graph *irg); 00507 00509 FIRM_API void set_irg_fp_model(ir_graph *irg, unsigned model); 00510 00520 #define get_irg_data(graph,type,off) \ 00521 (assert(off > 0 && "Invalid graph data offset"), (type *) ((char *) (graph) - (off))) 00522 00529 #define get_irg_data_base(data,off) \ 00530 (assert(off > 0 && "Invalid graph data offset"), (ir_graph *) ((char *) (data) + (off))) 00531 00539 FIRM_API size_t register_additional_graph_data(size_t size); 00540 00543 #include "end.h" 00544 00545 #endif