2 * Copyright (C) 1995-2007 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 procedure code.
23 * @author Martin Trapp, Christian Schaefer, Goetz Lindenmaier, Michael Beck
39 #include "irgraph_t.h"
51 #include "iredges_t.h"
55 #define INITIAL_IDX_IRN_MAP_SIZE 1024
58 * Indicates, whether additional data can be registered to graphs.
59 * If set to 1, this is not possible anymore.
61 static int forbid_new_data = 0;
64 * The amount of additional space for custom data to be allocated upon
65 * creating a new graph.
67 static size_t additional_graph_data_size = 0;
69 ir_graph *current_ir_graph;
70 ir_graph *get_current_ir_graph(void) {
71 return current_ir_graph;
73 void set_current_ir_graph(ir_graph *graph) {
74 current_ir_graph = graph;
78 int firm_interprocedural_view = 0;
80 int (get_interprocedural_view)(void) {
81 return _get_interprocedural_view();
84 void (set_interprocedural_view)(int state) {
85 firm_interprocedural_view = state;
87 /* set function vectors for faster access */
89 _get_irn_arity = _get_irn_inter_arity;
90 _get_irn_n = _get_irn_inter_n;
93 _get_irn_arity = _get_irn_intra_arity;
94 _get_irn_n = _get_irn_intra_n;
98 /** contains the suffix for frame type names */
99 static ident *frame_type_suffix = NULL;
101 /* initialize the IR graph module */
102 void firm_init_irgraph(void) {
103 frame_type_suffix = new_id_from_str(FRAME_TP_SUFFIX);
108 * Allocate a new IR graph.
109 * This function respects the registered graph data. The only reason for
110 * this function is, that there are two locations, where graphs are
111 * allocated (new_r_ir_graph, new_const_code_irg).
112 * @return Memory for a new graph.
114 static ir_graph *alloc_graph(void) {
115 size_t size = sizeof(ir_graph) + additional_graph_data_size;
116 char *ptr = xmalloc(size);
117 memset(ptr, 0, size);
119 return (ir_graph *) (ptr + additional_graph_data_size);
123 * Frees an allocated IR graph
125 static void free_graph(ir_graph *irg) {
126 char *ptr = (char *)irg;
127 free(ptr - additional_graph_data_size);
130 #if USE_EXPLICIT_PHI_IN_STACK
131 /* really defined in ircons.c */
132 typedef struct Phi_in_stack Phi_in_stack;
133 Phi_in_stack *new_Phi_in_stack();
134 void free_Phi_in_stack(Phi_in_stack *s);
137 /* Allocates a list of nodes:
138 - The start block containing a start node and Proj nodes for it's four
139 results (X, M, P, Tuple).
140 - The end block containing an end node. This block is not matured after
141 new_ir_graph as predecessors need to be added to it.
142 - The current block, which is empty and also not matured.
143 Further it allocates several datastructures needed for graph construction
147 new_r_ir_graph (ir_entity *ent, int n_loc)
150 ir_node *first_block;
151 ir_node *end, *start, *start_block, *initial_mem, *projX;
154 res->kind = k_ir_graph;
156 //edges_init_graph_kind(res, EDGE_KIND_NORMAL);
157 //edges_init_graph_kind(res, EDGE_KIND_BLOCK);
159 /* initialize the idx->node map. */
160 res->idx_irn_map = NEW_ARR_F(ir_node *, INITIAL_IDX_IRN_MAP_SIZE);
161 memset(res->idx_irn_map, 0, INITIAL_IDX_IRN_MAP_SIZE * sizeof(res->idx_irn_map[0]));
163 /* inform statistics here, as blocks will be already build on this graph */
164 hook_new_graph(res, ent);
166 current_ir_graph = res;
168 /*-- initialized for each graph. --*/
169 if (get_opt_precise_exc_context()) {
170 res->n_loc = n_loc + 1 + 1; /* number of local variables that are never
171 dereferenced in this graph plus one for
172 the store plus one for links to fragile
173 operations. n_loc is not the number of
174 parameters to the procedure! */
177 res->n_loc = n_loc + 1; /* number of local variables that are never
178 dereferenced in this graph plus one for
179 the store. This is not the number of parameters
183 /* descriptions will be allocated on demand */
184 res->loc_descriptions = NULL;
186 res->visited = 0; /* visited flag, for the ir walker */
187 res->block_visited = 0; /* visited flag, for the 'block'-walker */
189 #if USE_EXPLICIT_PHI_IN_STACK
190 res->Phi_in_stack = new_Phi_in_stack(); /* A stack needed for automatic Phi
193 res->kind = k_ir_graph;
194 res->obst = xmalloc (sizeof(*res->obst));
195 obstack_init(res->obst);
196 res->extbb_obst = NULL;
198 res->last_node_idx = 0;
200 res->value_table = new_identities (); /* value table for global value
201 numbering for optimizing use in
205 res->inline_property = irg_inline_any;
206 res->additional_properties = mtp_property_inherited; /* inherited from type */
208 res->phase_state = phase_building;
209 res->irg_pinned_state = op_pin_state_pinned;
210 res->outs_state = outs_none;
211 res->dom_state = dom_none;
212 res->pdom_state = dom_none;
213 res->typeinfo_state = ir_typeinfo_none;
214 set_irp_typeinfo_inconsistent(); /* there is a new graph with typeinfo_none. */
215 res->callee_info_state = irg_callee_info_none;
216 res->loopinfo_state = loopinfo_none;
217 res->class_cast_state = ir_class_casts_transitive;
218 res->extblk_state = ir_extblk_info_none;
219 res->execfreq_state = exec_freq_none;
220 res->fp_model = fp_model_precise;
221 res->adr_taken_state = ir_address_taken_not_computed;
222 res->mem_disambig_opt = aa_opt_inherited;
224 /*-- Type information for the procedure of the graph --*/
226 set_entity_irg(ent, res);
228 /*-- a class type so that it can contain "inner" methods as in Pascal. --*/
229 res->frame_type = new_type_frame(mangle(get_entity_ident(ent), frame_type_suffix));
231 /*-- Nodes needed in every graph --*/
232 set_irg_end_block (res, new_immBlock());
234 set_irg_end (res, end);
235 set_irg_end_reg (res, end);
236 set_irg_end_except(res, end);
238 start_block = new_immBlock();
239 set_irg_start_block(res, start_block);
240 set_irg_bad (res, new_ir_node(NULL, res, start_block, op_Bad, mode_T, 0, NULL));
241 set_irg_no_mem (res, new_ir_node(NULL, res, start_block, op_NoMem, mode_M, 0, NULL));
243 set_irg_start (res, start);
245 /* Proj results of start node */
246 projX = new_Proj(start, mode_X, pn_Start_X_initial_exec);
247 set_irg_frame (res, new_Proj(start, mode_P_data, pn_Start_P_frame_base));
248 set_irg_globals (res, new_Proj(start, mode_P_data, pn_Start_P_globals));
249 set_irg_tls (res, new_Proj(start, mode_P_data, pn_Start_P_tls));
250 set_irg_args (res, new_Proj(start, mode_T, pn_Start_T_args));
251 set_irg_value_param_base(res, new_Proj(start, mode_P_data, pn_Start_P_value_arg_base));
252 initial_mem = new_Proj(start, mode_M, pn_Start_M);
253 set_irg_initial_mem(res, initial_mem);
255 add_immBlock_pred(start_block, projX);
256 set_store(initial_mem);
259 res->graph_nr = get_irp_new_node_nr();
261 res->proj_args = NULL;
264 * The code generation needs it. leave it in now.
265 * Use of this edge is matter of discussion, unresolved. Also possible:
266 * add_immBlock_pred(res->start_block, res->start_block), but invalid typed.
268 mature_immBlock(res->current_block);
270 /*-- Make a block to start with --*/
271 first_block = new_immBlock();
272 add_immBlock_pred(first_block, projX);
274 res->method_execution_frequency = -1;
275 res->estimated_node_count = 0;
282 new_ir_graph(ir_entity *ent, int n_loc)
284 ir_graph *res = new_r_ir_graph(ent, n_loc);
285 add_irp_irg(res); /* remember this graph global. */
289 /* Make a rudimentary IR graph for the constant code.
290 Must look like a correct irg, spare everything else. */
291 ir_graph *new_const_code_irg(void) {
293 ir_node *end, *start_block, *start, *projX;
297 /* initialize the idx->node map. */
298 res->idx_irn_map = NEW_ARR_F(ir_node *, INITIAL_IDX_IRN_MAP_SIZE);
299 memset(res->idx_irn_map, 0, INITIAL_IDX_IRN_MAP_SIZE * sizeof(res->idx_irn_map[0]));
301 /* inform statistics here, as blocks will be already build on this graph */
302 hook_new_graph(res, NULL);
304 current_ir_graph = res;
305 res->n_loc = 1; /* Only the memory. */
306 res->visited = 0; /* visited flag, for the ir walker */
307 res->block_visited = 0; /* visited flag, for the 'block'-walker */
308 #if USE_EXPLICIT_PHI_IN_STACK
309 res->Phi_in_stack = NULL;
311 res->kind = k_ir_graph;
312 res->obst = xmalloc (sizeof(*res->obst));
313 obstack_init (res->obst);
314 res->extbb_obst = NULL;
316 res->last_node_idx = 0;
318 res->phase_state = phase_building;
319 res->irg_pinned_state = op_pin_state_pinned;
320 res->extblk_state = ir_extblk_info_none;
321 res->fp_model = fp_model_precise;
323 res->value_table = new_identities (); /* value table for global value
324 numbering for optimizing use in
327 res->frame_type = NULL;
329 /* -- The end block -- */
330 set_irg_end_block (res, new_immBlock());
332 set_irg_end (res, end);
333 set_irg_end_reg (res, end);
334 set_irg_end_except(res, end);
335 mature_immBlock(get_cur_block()); /* mature the end block */
337 /* -- The start block -- */
338 start_block = new_immBlock();
339 set_irg_start_block(res, start_block);
340 set_irg_bad (res, new_ir_node (NULL, res, start_block, op_Bad, mode_T, 0, NULL));
341 set_irg_no_mem (res, new_ir_node (NULL, res, start_block, op_NoMem, mode_M, 0, NULL));
343 set_irg_start (res, start);
345 /* Proj results of start node */
346 set_irg_initial_mem(res, new_Proj(start, mode_M, pn_Start_M));
347 projX = new_Proj(start, mode_X, pn_Start_X_initial_exec);
348 add_immBlock_pred(start_block, projX);
349 mature_immBlock (start_block); /* mature the start block */
351 add_immBlock_pred(new_immBlock(), projX);
352 mature_immBlock (get_cur_block()); /* mature the 'body' block for expressions */
354 /* Set the visited flag high enough that the blocks will never be visited. */
355 set_irn_visited(get_cur_block(), -1);
356 set_Block_block_visited(get_cur_block(), -1);
357 set_Block_block_visited(start_block, -1);
358 set_irn_visited(start_block, -1);
359 set_irn_visited(get_irg_bad(res), -1);
360 set_irn_visited(get_irg_no_mem(res), -1);
362 res->phase_state = phase_high;
367 /* Defined in iropt.c */
368 void del_identities (pset *value_table);
370 /* Frees the passed irgraph.
371 Deallocates all nodes in this graph and the ir_graph structure.
372 Sets the field irgraph in the corresponding entity to NULL.
373 Does not remove the irgraph from the list in irprog (requires
374 inefficient search, call remove_irp_irg by hand).
375 Does not free types, entities or modes that are used only by this
376 graph, nor the entity standing for this graph. */
377 void free_ir_graph (ir_graph *irg) {
378 assert(is_ir_graph(irg));
380 hook_free_graph(irg);
381 if (irg->outs_state != outs_none) free_irg_outs(irg);
382 if (irg->frame_type) free_type(irg->frame_type);
383 if (irg->value_table) del_identities(irg->value_table);
385 ir_peculiarity pec = get_entity_peculiarity (irg->ent);
386 set_entity_peculiarity (irg->ent, peculiarity_description);
387 set_entity_irg(irg->ent, NULL); /* not set in const code irg */
388 set_entity_peculiarity (irg->ent, pec);
391 free_End(get_irg_end(irg));
392 obstack_free(irg->obst,NULL);
394 #if USE_EXPLICIT_PHI_IN_STACK
395 free_Phi_in_stack(irg->Phi_in_stack);
397 if (irg->loc_descriptions)
398 free(irg->loc_descriptions);
403 /* access routines for all ir_graph attributes:
405 {attr type} get_irg_{attribute name} (ir_graph *irg);
406 void set_irg_{attr name} (ir_graph *irg, {attr type} {attr}); */
409 (is_ir_graph)(const void *thing) {
410 return _is_ir_graph(thing);
413 /* Outputs a unique number for this node */
414 long get_irg_graph_nr(ir_graph *irg) {
417 return irg->graph_nr;
419 return (long)PTR_TO_INT(irg);
424 (get_irg_start_block)(const ir_graph *irg) {
425 return _get_irg_start_block(irg);
429 (set_irg_start_block)(ir_graph *irg, ir_node *node) {
430 _set_irg_start_block(irg, node);
434 (get_irg_start)(const ir_graph *irg) {
435 return _get_irg_start(irg);
439 (set_irg_start)(ir_graph *irg, ir_node *node) {
440 _set_irg_start(irg, node);
444 (get_irg_end_block)(const ir_graph *irg) {
445 return _get_irg_end_block(irg);
449 (set_irg_end_block)(ir_graph *irg, ir_node *node) {
450 _set_irg_end_block(irg, node);
454 (get_irg_end)(const ir_graph *irg) {
455 return _get_irg_end(irg);
459 (set_irg_end)(ir_graph *irg, ir_node *node) {
460 _set_irg_end(irg, node);
464 (get_irg_end_reg)(const ir_graph *irg) {
465 return _get_irg_end_reg(irg);
468 void set_irg_end_reg (ir_graph *irg, ir_node *node) {
469 assert(get_irn_op(node) == op_EndReg || get_irn_op(node) == op_End);
470 irg->anchors[anchor_end_reg] = node;
474 (get_irg_end_except)(const ir_graph *irg) {
475 return _get_irg_end_except(irg);
478 void set_irg_end_except (ir_graph *irg, ir_node *node) {
479 assert(get_irn_op(node) == op_EndExcept || get_irn_op(node) == op_End);
480 irg->anchors[anchor_end_except] = node;
484 (get_irg_frame)(const ir_graph *irg) {
485 return _get_irg_frame(irg);
489 (set_irg_frame)(ir_graph *irg, ir_node *node) {
490 _set_irg_frame(irg, node);
494 (get_irg_globals)(const ir_graph *irg) {
495 return _get_irg_globals(irg);
499 (set_irg_globals)(ir_graph *irg, ir_node *node) {
500 _set_irg_globals(irg, node);
504 (get_irg_tls)(const ir_graph *irg) {
505 return _get_irg_tls(irg);
509 (set_irg_tls)(ir_graph *irg, ir_node *node) {
510 _set_irg_tls(irg, node);
514 (get_irg_initial_mem)(const ir_graph *irg) {
515 return _get_irg_initial_mem(irg);
519 (set_irg_initial_mem)(ir_graph *irg, ir_node *node) {
520 _set_irg_initial_mem(irg, node);
524 (get_irg_args)(const ir_graph *irg) {
525 return _get_irg_args(irg);
529 (set_irg_args)(ir_graph *irg, ir_node *node) {
530 _set_irg_args(irg, node);
534 (get_irg_value_param_base)(const ir_graph *irg) {
535 return _get_irg_value_param_base(irg);
539 (set_irg_value_param_base)(ir_graph *irg, ir_node *node) {
540 _set_irg_value_param_base(irg, node);
544 (get_irg_proj_args) (const ir_graph *irg) {
545 return _get_irg_proj_args (irg);
549 (set_irg_proj_args) (ir_graph *irg, ir_node **nodes) {
550 _set_irg_proj_args (irg, nodes);
554 (get_irg_bad)(const ir_graph *irg) {
555 return _get_irg_bad(irg);
559 (set_irg_bad)(ir_graph *irg, ir_node *node) {
560 _set_irg_bad(irg, node);
564 (get_irg_no_mem)(const ir_graph *irg) {
565 return _get_irg_no_mem(irg);
569 (set_irg_no_mem)(ir_graph *irg, ir_node *node) {
570 _set_irg_no_mem(irg, node);
574 (get_irg_current_block)(const ir_graph *irg) {
575 return _get_irg_current_block(irg);
579 (set_irg_current_block)(ir_graph *irg, ir_node *node) {
580 _set_irg_current_block(irg, node);
584 (get_irg_entity)(const ir_graph *irg) {
585 return _get_irg_entity(irg);
589 (set_irg_entity)(ir_graph *irg, ir_entity *ent) {
590 _set_irg_entity(irg, ent);
594 (get_irg_frame_type)(ir_graph *irg) {
595 return _get_irg_frame_type(irg);
599 (set_irg_frame_type)(ir_graph *irg, ir_type *ftp) {
600 _set_irg_frame_type(irg, ftp);
604 get_irg_n_locs (ir_graph *irg)
606 if (get_opt_precise_exc_context())
607 return irg->n_loc - 1 - 1;
609 return irg->n_loc - 1;
613 set_irg_n_loc (ir_graph *irg, int n_loc)
615 if (get_opt_precise_exc_context())
616 irg->n_loc = n_loc + 1 + 1;
618 irg->n_loc = n_loc + 1;
623 /* Returns the obstack associated with the graph. */
625 (get_irg_obstack)(const ir_graph *irg) {
626 return _get_irg_obstack(irg);
630 * Returns true if the node n is allocated on the storage of graph irg.
632 * Implementation is GLIBC specific as is uses the internal _obstack_chunk implementation.
634 int node_is_in_irgs_storage(ir_graph *irg, ir_node *n)
636 struct _obstack_chunk *p;
639 * checks weather the ir_node pointer is on the obstack.
640 * A more sophisticated check would test the "whole" ir_node
642 for (p = irg->obst->chunk; p; p = p->prev) {
643 if (((char *)p->contents <= (char *)n) && ((char *)n < (char *)p->limit))
651 (get_irg_phase_state)(const ir_graph *irg) {
652 return _get_irg_phase_state(irg);
656 (set_irg_phase_state)(ir_graph *irg, irg_phase_state state) {
657 _set_irg_phase_state(irg, state);
661 (get_irg_pinned)(const ir_graph *irg) {
662 return _get_irg_pinned(irg);
666 (get_irg_outs_state)(const ir_graph *irg) {
667 return _get_irg_outs_state(irg);
671 (set_irg_outs_inconsistent)(ir_graph *irg) {
672 _set_irg_outs_inconsistent(irg);
676 (get_irg_extblk_state)(const ir_graph *irg) {
677 return _get_irg_extblk_state(irg);
681 (set_irg_extblk_inconsistent)(ir_graph *irg) {
682 _set_irg_extblk_inconsistent(irg);
686 (get_irg_dom_state)(const ir_graph *irg) {
687 return _get_irg_dom_state(irg);
691 (get_irg_postdom_state)(const ir_graph *irg) {
692 return _get_irg_postdom_state(irg);
696 (set_irg_doms_inconsistent)(ir_graph *irg) {
697 _set_irg_doms_inconsistent(irg);
701 (get_irg_loopinfo_state)(const ir_graph *irg) {
702 return _get_irg_loopinfo_state(irg);
706 (set_irg_loopinfo_state)(ir_graph *irg, irg_loopinfo_state s) {
707 _set_irg_loopinfo_state(irg, s);
711 (set_irg_loopinfo_inconsistent)(ir_graph *irg) {
712 _set_irg_loopinfo_inconsistent(irg);
715 void set_irp_loopinfo_inconsistent(void) {
716 int i, n_irgs = get_irp_n_irgs();
717 for (i = 0; i < n_irgs; ++i) {
718 set_irg_loopinfo_inconsistent(get_irp_irg(i));
725 (set_irg_pinned)(ir_graph *irg, op_pin_state p) {
726 _set_irg_pinned(irg, p);
729 irg_callee_info_state
730 (get_irg_callee_info_state)(const ir_graph *irg) {
731 return _get_irg_callee_info_state(irg);
735 (set_irg_callee_info_state)(ir_graph *irg, irg_callee_info_state s) {
736 _set_irg_callee_info_state(irg, s);
740 (get_irg_inline_property)(const ir_graph *irg) {
741 return _get_irg_inline_property(irg);
745 (set_irg_inline_property)(ir_graph *irg, irg_inline_property s) {
746 _set_irg_inline_property(irg, s);
750 (get_irg_additional_properties)(const ir_graph *irg) {
751 return _get_irg_additional_properties(irg);
755 (set_irg_additional_properties)(ir_graph *irg, unsigned property_mask) {
756 _set_irg_additional_properties(irg, property_mask);
760 (set_irg_additional_property)(ir_graph *irg, mtp_additional_property flag) {
761 _set_irg_additional_property(irg, flag);
765 (set_irg_link)(ir_graph *irg, void *thing) {
766 _set_irg_link(irg, thing);
770 (get_irg_link)(const ir_graph *irg) {
771 return _get_irg_link(irg);
774 /** maximum visited flag content of all ir_graph visited fields. */
775 static unsigned long max_irg_visited = 0;
778 (get_irg_visited)(const ir_graph *irg) {
779 return _get_irg_visited(irg);
783 set_irg_visited (ir_graph *irg, unsigned long visited)
785 irg->visited = visited;
786 if (irg->visited > max_irg_visited) {
787 max_irg_visited = irg->visited;
792 inc_irg_visited (ir_graph *irg)
794 if (++irg->visited > max_irg_visited) {
795 max_irg_visited = irg->visited;
800 get_max_irg_visited(void)
804 for(i = 0; i < get_irp_n_irgs(); i++)
805 assert(max_irg_visited >= get_irg_visited(get_irp_irg(i)));
807 return max_irg_visited;
810 void set_max_irg_visited(int val) {
811 max_irg_visited = val;
815 inc_max_irg_visited(void)
819 for(i = 0; i < get_irp_n_irgs(); i++)
820 assert(max_irg_visited >= get_irg_visited(get_irp_irg(i)));
823 return max_irg_visited;
827 (get_irg_block_visited)(const ir_graph *irg) {
828 return _get_irg_block_visited(irg);
832 (set_irg_block_visited)(ir_graph *irg, unsigned long visited) {
833 _set_irg_block_visited(irg, visited);
837 (inc_irg_block_visited)(ir_graph *irg) {
838 _inc_irg_block_visited(irg);
841 /* Return the floating point model of this graph. */
842 unsigned (get_irg_fp_model)(const ir_graph *irg) {
843 return _get_irg_fp_model(irg);
846 /* Sets the floating point model for this graph. */
847 void set_irg_fp_model(ir_graph *irg, unsigned model) {
848 irg->fp_model = model;
852 * walker Start->End: places Proj nodes into the same block
853 * as it's predecessors
858 static void normalize_proj_walker(ir_node *n, void *env){
860 ir_node *pred = get_Proj_pred(n);
861 ir_node *block = get_nodes_block(pred);
863 set_nodes_block(n, block);
867 /* move Proj nodes into the same block as its predecessors */
868 void normalize_proj_nodes(ir_graph *irg) {
869 irg_walk_graph(irg, NULL, normalize_proj_walker, NULL);
870 set_irg_outs_inconsistent(irg);
873 /* set a description for local value n */
874 void set_irg_loc_description(ir_graph *irg, int n, void *description) {
875 assert(0 <= n && n < irg->n_loc);
877 if (! irg->loc_descriptions)
878 irg->loc_descriptions = xcalloc(sizeof(*irg->loc_descriptions), irg->n_loc);
880 irg->loc_descriptions[n] = description;
883 /* get the description for local value n */
884 void *get_irg_loc_description(ir_graph *irg, int n) {
885 assert(0 <= n && n < irg->n_loc);
886 return irg->loc_descriptions ? irg->loc_descriptions[n] : NULL;
890 void set_using_block_visited(ir_graph *irg) {
891 assert(irg->using_block_visited == 0);
892 irg->using_block_visited = 1;
895 void clear_using_block_visited(ir_graph *irg) {
896 assert(irg->using_block_visited == 1);
897 irg->using_block_visited = 0;
900 int using_block_visited(const ir_graph *irg) {
901 return irg->using_block_visited;
905 void set_using_visited(ir_graph *irg) {
906 assert(irg->using_visited == 0);
907 irg->using_visited = 1;
910 void clear_using_visited(ir_graph *irg) {
911 assert(irg->using_visited == 1);
912 irg->using_visited = 0;
915 int using_visited(const ir_graph *irg) {
916 return irg->using_visited;
920 void set_using_irn_link(ir_graph *irg) {
921 assert(irg->using_irn_link == 0);
922 irg->using_irn_link = 1;
925 void clear_using_irn_link(ir_graph *irg) {
926 assert(irg->using_irn_link == 1);
927 irg->using_irn_link = 0;
930 int using_irn_link(const ir_graph *irg) {
931 return irg->using_irn_link;
935 /* Returns a estimated node count of the irg. */
936 unsigned (get_irg_estimated_node_cnt)(const ir_graph *irg) {
937 return _get_irg_estimated_node_cnt(irg);
940 /* Returns the last irn index for this graph. */
941 unsigned get_irg_last_idx(const ir_graph *irg) {
942 return irg->last_node_idx;
945 /* register additional space in an IR graph */
946 size_t register_additional_graph_data(size_t size)
948 assert(!forbid_new_data && "Too late to register additional node data");
953 return additional_graph_data_size += size;