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"
50 #include "iredges_t.h"
54 #define INITIAL_IDX_IRN_MAP_SIZE 1024
57 * Indicates, whether additional data can be registered to graphs.
58 * If set to 1, this is not possible anymore.
60 static int forbid_new_data = 0;
63 * The amount of additional space for custom data to be allocated upon
64 * creating a new graph.
66 static size_t additional_graph_data_size = 0;
68 ir_graph *current_ir_graph;
69 ir_graph *get_current_ir_graph(void) {
70 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
146 ir_graph *new_r_ir_graph(ir_entity *ent, int n_loc) {
148 ir_node *first_block;
149 ir_node *end, *start, *start_block, *initial_mem, *projX;
152 res->kind = k_ir_graph;
154 //edges_init_graph_kind(res, EDGE_KIND_NORMAL);
155 //edges_init_graph_kind(res, EDGE_KIND_BLOCK);
157 /* initialize the idx->node map. */
158 res->idx_irn_map = NEW_ARR_F(ir_node *, INITIAL_IDX_IRN_MAP_SIZE);
159 memset(res->idx_irn_map, 0, INITIAL_IDX_IRN_MAP_SIZE * sizeof(res->idx_irn_map[0]));
161 /* inform statistics here, as blocks will be already build on this graph */
162 hook_new_graph(res, ent);
164 current_ir_graph = res;
166 /*-- initialized for each graph. --*/
167 if (get_opt_precise_exc_context()) {
168 res->n_loc = n_loc + 1 + 1; /* number of local variables that are never
169 dereferenced in this graph plus one for
170 the store plus one for links to fragile
171 operations. n_loc is not the number of
172 parameters to the procedure! */
174 res->n_loc = n_loc + 1; /* number of local variables that are never
175 dereferenced in this graph plus one for
176 the store. This is not the number of parameters
180 /* descriptions will be allocated on demand */
181 res->loc_descriptions = NULL;
183 res->visited = 0; /* visited flag, for the ir walker */
184 res->block_visited = 0; /* visited flag, for the 'block'-walker */
186 #if USE_EXPLICIT_PHI_IN_STACK
187 res->Phi_in_stack = new_Phi_in_stack(); /* A stack needed for automatic Phi
190 res->kind = k_ir_graph;
191 res->obst = xmalloc (sizeof(*res->obst));
192 obstack_init(res->obst);
193 res->extbb_obst = NULL;
195 res->last_node_idx = 0;
197 res->value_table = new_identities (); /* value table for global value
198 numbering for optimizing use in iropt.c */
201 res->inline_property = irg_inline_any;
202 res->additional_properties = mtp_property_inherited; /* inherited from type */
204 res->phase_state = phase_building;
205 res->irg_pinned_state = op_pin_state_pinned;
206 res->outs_state = outs_none;
207 res->dom_state = dom_none;
208 res->pdom_state = dom_none;
209 res->typeinfo_state = ir_typeinfo_none;
210 set_irp_typeinfo_inconsistent(); /* there is a new graph with typeinfo_none. */
211 res->callee_info_state = irg_callee_info_none;
212 res->loopinfo_state = loopinfo_none;
213 res->class_cast_state = ir_class_casts_transitive;
214 res->extblk_state = ir_extblk_info_none;
215 res->execfreq_state = exec_freq_none;
216 res->fp_model = fp_model_precise;
217 res->adr_taken_state = ir_address_taken_not_computed;
218 res->mem_disambig_opt = aa_opt_inherited;
220 /*-- Type information for the procedure of the graph --*/
222 set_entity_irg(ent, res);
224 /*-- a class type so that it can contain "inner" methods as in Pascal. --*/
225 res->frame_type = new_type_frame(mangle(get_entity_ident(ent), frame_type_suffix));
227 /* the Anchor node must be created first */
228 res->anchor = new_Anchor(res);
230 /*-- Nodes needed in every graph --*/
231 set_irg_end_block (res, new_immBlock());
233 set_irg_end (res, end);
234 set_irg_end_reg (res, end);
235 set_irg_end_except(res, end);
237 start_block = new_immBlock();
238 set_irg_start_block(res, start_block);
239 set_irg_bad (res, new_ir_node(NULL, res, start_block, op_Bad, mode_T, 0, NULL));
240 set_irg_no_mem (res, new_ir_node(NULL, res, start_block, op_NoMem, mode_M, 0, NULL));
242 set_irg_start (res, start);
244 /* Proj results of start node */
245 projX = new_Proj(start, mode_X, pn_Start_X_initial_exec);
246 set_irg_frame (res, new_Proj(start, mode_P_data, pn_Start_P_frame_base));
247 set_irg_globals (res, new_Proj(start, mode_P_data, pn_Start_P_globals));
248 set_irg_tls (res, new_Proj(start, mode_P_data, pn_Start_P_tls));
249 set_irg_args (res, new_Proj(start, mode_T, pn_Start_T_args));
250 set_irg_value_param_base(res, new_Proj(start, mode_P_data, pn_Start_P_value_arg_base));
251 initial_mem = new_Proj(start, mode_M, pn_Start_M);
252 set_irg_initial_mem(res, initial_mem);
254 add_immBlock_pred(start_block, projX);
255 set_store(initial_mem);
258 res->graph_nr = get_irp_new_node_nr();
260 res->proj_args = NULL;
263 * The code generation needs it. leave it in now.
264 * Use of this edge is matter of discussion, unresolved. Also possible:
265 * add_immBlock_pred(res->start_block, res->start_block), but invalid typed.
267 mature_immBlock(res->current_block);
269 /*-- Make a block to start with --*/
270 first_block = new_immBlock();
271 add_immBlock_pred(first_block, projX);
273 res->method_execution_frequency = -1.0;
274 res->estimated_node_count = 0;
281 new_ir_graph(ir_entity *ent, int n_loc) {
282 ir_graph *res = new_r_ir_graph(ent, n_loc);
283 add_irp_irg(res); /* remember this graph global. */
287 /* Make a rudimentary IR graph for the constant code.
288 Must look like a correct irg, spare everything else. */
289 ir_graph *new_const_code_irg(void) {
291 ir_node *end, *start_block, *start, *projX;
295 /* initialize the idx->node map. */
296 res->idx_irn_map = NEW_ARR_F(ir_node *, INITIAL_IDX_IRN_MAP_SIZE);
297 memset(res->idx_irn_map, 0, INITIAL_IDX_IRN_MAP_SIZE * sizeof(res->idx_irn_map[0]));
299 /* inform statistics here, as blocks will be already build on this graph */
300 hook_new_graph(res, NULL);
302 current_ir_graph = res;
303 res->n_loc = 1; /* Only the memory. */
304 res->visited = 0; /* visited flag, for the ir walker */
305 res->block_visited = 0; /* visited flag, for the 'block'-walker */
306 #if USE_EXPLICIT_PHI_IN_STACK
307 res->Phi_in_stack = NULL;
309 res->kind = k_ir_graph;
310 res->obst = xmalloc (sizeof(*res->obst));
311 obstack_init (res->obst);
312 res->extbb_obst = NULL;
314 res->last_node_idx = 0;
316 res->phase_state = phase_building;
317 res->irg_pinned_state = op_pin_state_pinned;
318 res->extblk_state = ir_extblk_info_none;
319 res->fp_model = fp_model_precise;
321 res->value_table = new_identities (); /* value table for global value
322 numbering for optimizing use in
325 res->frame_type = NULL;
327 /* the Anchor node must be created first */
328 res->anchor = new_Anchor(res);
330 /* -- The end block -- */
331 set_irg_end_block (res, new_immBlock());
333 set_irg_end (res, end);
334 set_irg_end_reg (res, end);
335 set_irg_end_except(res, end);
336 mature_immBlock(get_cur_block()); /* mature the end block */
338 /* -- The start block -- */
339 start_block = new_immBlock();
340 set_irg_start_block(res, start_block);
341 set_irg_bad (res, new_ir_node (NULL, res, start_block, op_Bad, mode_T, 0, NULL));
342 set_irg_no_mem (res, new_ir_node (NULL, res, start_block, op_NoMem, mode_M, 0, NULL));
344 set_irg_start (res, start);
346 /* Proj results of start node */
347 set_irg_initial_mem(res, new_Proj(start, mode_M, pn_Start_M));
348 projX = new_Proj(start, mode_X, pn_Start_X_initial_exec);
349 add_immBlock_pred(start_block, projX);
350 mature_immBlock (start_block); /* mature the start block */
352 add_immBlock_pred(new_immBlock(), projX);
353 mature_immBlock (get_cur_block()); /* mature the 'body' block for expressions */
355 /* Set the visited flag high enough that the blocks will never be visited. */
356 set_irn_visited(get_cur_block(), -1);
357 set_Block_block_visited(get_cur_block(), -1);
358 set_Block_block_visited(start_block, -1);
359 set_irn_visited(start_block, -1);
360 set_irn_visited(get_irg_bad(res), -1);
361 set_irn_visited(get_irg_no_mem(res), -1);
363 res->phase_state = phase_high;
368 /* Defined in iropt.c */
369 void del_identities (pset *value_table);
371 /* Frees the passed irgraph.
372 Deallocates all nodes in this graph and the ir_graph structure.
373 Sets the field irgraph in the corresponding entity to NULL.
374 Does not remove the irgraph from the list in irprog (requires
375 inefficient search, call remove_irp_irg by hand).
376 Does not free types, entities or modes that are used only by this
377 graph, nor the entity standing for this graph. */
378 void free_ir_graph (ir_graph *irg) {
379 assert(is_ir_graph(irg));
381 hook_free_graph(irg);
382 if (irg->outs_state != outs_none) free_irg_outs(irg);
383 if (irg->frame_type) free_type(irg->frame_type);
384 if (irg->value_table) del_identities(irg->value_table);
386 ir_peculiarity pec = get_entity_peculiarity (irg->ent);
387 set_entity_peculiarity (irg->ent, peculiarity_description);
388 set_entity_irg(irg->ent, NULL); /* not set in const code irg */
389 set_entity_peculiarity (irg->ent, pec);
392 free_End(get_irg_end(irg));
393 obstack_free(irg->obst,NULL);
395 #if USE_EXPLICIT_PHI_IN_STACK
396 free_Phi_in_stack(irg->Phi_in_stack);
398 if (irg->loc_descriptions)
399 free(irg->loc_descriptions);
404 /* access routines for all ir_graph attributes:
406 {attr type} get_irg_{attribute name} (ir_graph *irg);
407 void set_irg_{attr name} (ir_graph *irg, {attr type} {attr}); */
410 (is_ir_graph)(const void *thing) {
411 return _is_ir_graph(thing);
414 /* Outputs a unique number for this node */
415 long get_irg_graph_nr(ir_graph *irg) {
418 return irg->graph_nr;
420 return (long)PTR_TO_INT(irg);
425 (get_irg_start_block)(const ir_graph *irg) {
426 return _get_irg_start_block(irg);
430 (set_irg_start_block)(ir_graph *irg, ir_node *node) {
431 _set_irg_start_block(irg, node);
435 (get_irg_start)(const ir_graph *irg) {
436 return _get_irg_start(irg);
440 (set_irg_start)(ir_graph *irg, ir_node *node) {
441 _set_irg_start(irg, node);
445 (get_irg_end_block)(const ir_graph *irg) {
446 return _get_irg_end_block(irg);
450 (set_irg_end_block)(ir_graph *irg, ir_node *node) {
451 _set_irg_end_block(irg, node);
455 (get_irg_end)(const ir_graph *irg) {
456 return _get_irg_end(irg);
460 (set_irg_end)(ir_graph *irg, ir_node *node) {
461 _set_irg_end(irg, node);
465 (get_irg_end_reg)(const ir_graph *irg) {
466 return _get_irg_end_reg(irg);
470 (set_irg_end_reg)(ir_graph *irg, ir_node *node) {
471 _set_irg_end_reg(irg, node);
475 (get_irg_end_except)(const ir_graph *irg) {
476 return _get_irg_end_except(irg);
480 (set_irg_end_except)(ir_graph *irg, ir_node *node) {
481 assert(get_irn_op(node) == op_EndExcept || get_irn_op(node) == op_End);
482 _set_irg_end_except(irg, node);
486 (get_irg_frame)(const ir_graph *irg) {
487 return _get_irg_frame(irg);
491 (set_irg_frame)(ir_graph *irg, ir_node *node) {
492 _set_irg_frame(irg, node);
496 (get_irg_globals)(const ir_graph *irg) {
497 return _get_irg_globals(irg);
501 (set_irg_globals)(ir_graph *irg, ir_node *node) {
502 _set_irg_globals(irg, node);
506 (get_irg_tls)(const ir_graph *irg) {
507 return _get_irg_tls(irg);
511 (set_irg_tls)(ir_graph *irg, ir_node *node) {
512 _set_irg_tls(irg, node);
516 (get_irg_initial_mem)(const ir_graph *irg) {
517 return _get_irg_initial_mem(irg);
521 (set_irg_initial_mem)(ir_graph *irg, ir_node *node) {
522 _set_irg_initial_mem(irg, node);
526 (get_irg_args)(const ir_graph *irg) {
527 return _get_irg_args(irg);
531 (set_irg_args)(ir_graph *irg, ir_node *node) {
532 _set_irg_args(irg, node);
536 (get_irg_value_param_base)(const ir_graph *irg) {
537 return _get_irg_value_param_base(irg);
541 (set_irg_value_param_base)(ir_graph *irg, ir_node *node) {
542 _set_irg_value_param_base(irg, node);
546 (get_irg_proj_args) (const ir_graph *irg) {
547 return _get_irg_proj_args (irg);
551 (set_irg_proj_args) (ir_graph *irg, ir_node **nodes) {
552 _set_irg_proj_args (irg, nodes);
556 (get_irg_bad)(const ir_graph *irg) {
557 return _get_irg_bad(irg);
561 (set_irg_bad)(ir_graph *irg, ir_node *node) {
562 _set_irg_bad(irg, node);
566 (get_irg_no_mem)(const ir_graph *irg) {
567 return _get_irg_no_mem(irg);
571 (set_irg_no_mem)(ir_graph *irg, ir_node *node) {
572 _set_irg_no_mem(irg, node);
576 (get_irg_current_block)(const ir_graph *irg) {
577 return _get_irg_current_block(irg);
581 (set_irg_current_block)(ir_graph *irg, ir_node *node) {
582 _set_irg_current_block(irg, node);
586 (get_irg_entity)(const ir_graph *irg) {
587 return _get_irg_entity(irg);
591 (set_irg_entity)(ir_graph *irg, ir_entity *ent) {
592 _set_irg_entity(irg, ent);
596 (get_irg_frame_type)(ir_graph *irg) {
597 return _get_irg_frame_type(irg);
601 (set_irg_frame_type)(ir_graph *irg, ir_type *ftp) {
602 _set_irg_frame_type(irg, ftp);
606 get_irg_n_locs(ir_graph *irg) {
607 if (get_opt_precise_exc_context())
608 return irg->n_loc - 1 - 1;
610 return irg->n_loc - 1;
614 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) {
635 struct _obstack_chunk *p;
638 * checks weather the ir_node pointer is on the obstack.
639 * A more sophisticated check would test the "whole" ir_node
641 for (p = irg->obst->chunk; p; p = p->prev) {
642 if (((char *)p->contents <= (char *)n) && ((char *)n < (char *)p->limit))
650 (get_irg_phase_state)(const ir_graph *irg) {
651 return _get_irg_phase_state(irg);
655 (set_irg_phase_state)(ir_graph *irg, irg_phase_state state) {
656 _set_irg_phase_state(irg, state);
660 (get_irg_pinned)(const ir_graph *irg) {
661 return _get_irg_pinned(irg);
665 (get_irg_outs_state)(const ir_graph *irg) {
666 return _get_irg_outs_state(irg);
670 (set_irg_outs_inconsistent)(ir_graph *irg) {
671 _set_irg_outs_inconsistent(irg);
675 (get_irg_extblk_state)(const ir_graph *irg) {
676 return _get_irg_extblk_state(irg);
680 (set_irg_extblk_inconsistent)(ir_graph *irg) {
681 _set_irg_extblk_inconsistent(irg);
685 (get_irg_dom_state)(const ir_graph *irg) {
686 return _get_irg_dom_state(irg);
690 (get_irg_postdom_state)(const ir_graph *irg) {
691 return _get_irg_postdom_state(irg);
695 (set_irg_doms_inconsistent)(ir_graph *irg) {
696 _set_irg_doms_inconsistent(irg);
700 (get_irg_loopinfo_state)(const ir_graph *irg) {
701 return _get_irg_loopinfo_state(irg);
705 (set_irg_loopinfo_state)(ir_graph *irg, irg_loopinfo_state s) {
706 _set_irg_loopinfo_state(irg, s);
710 (set_irg_loopinfo_inconsistent)(ir_graph *irg) {
711 _set_irg_loopinfo_inconsistent(irg);
714 void set_irp_loopinfo_inconsistent(void) {
716 for (i = get_irp_n_irgs() - 1; i >= 0; --i) {
717 set_irg_loopinfo_inconsistent(get_irp_irg(i));
724 (set_irg_pinned)(ir_graph *irg, op_pin_state p) {
725 _set_irg_pinned(irg, p);
728 irg_callee_info_state
729 (get_irg_callee_info_state)(const ir_graph *irg) {
730 return _get_irg_callee_info_state(irg);
734 (set_irg_callee_info_state)(ir_graph *irg, irg_callee_info_state s) {
735 _set_irg_callee_info_state(irg, s);
739 (get_irg_inline_property)(const ir_graph *irg) {
740 return _get_irg_inline_property(irg);
744 (set_irg_inline_property)(ir_graph *irg, irg_inline_property s) {
745 _set_irg_inline_property(irg, s);
749 (get_irg_additional_properties)(const ir_graph *irg) {
750 return _get_irg_additional_properties(irg);
754 (set_irg_additional_properties)(ir_graph *irg, unsigned property_mask) {
755 _set_irg_additional_properties(irg, property_mask);
759 (set_irg_additional_property)(ir_graph *irg, mtp_additional_property flag) {
760 _set_irg_additional_property(irg, flag);
764 (set_irg_link)(ir_graph *irg, void *thing) {
765 _set_irg_link(irg, thing);
769 (get_irg_link)(const ir_graph *irg) {
770 return _get_irg_link(irg);
773 /** maximum visited flag content of all ir_graph visited fields. */
774 static unsigned long max_irg_visited = 0;
777 (get_irg_visited)(const ir_graph *irg) {
778 return _get_irg_visited(irg);
782 set_irg_visited(ir_graph *irg, unsigned long visited) {
783 irg->visited = visited;
784 if (irg->visited > max_irg_visited) {
785 max_irg_visited = irg->visited;
790 inc_irg_visited(ir_graph *irg) {
791 if (++irg->visited > max_irg_visited) {
792 max_irg_visited = irg->visited;
797 get_max_irg_visited(void) {
800 for(i = 0; i < get_irp_n_irgs(); i++)
801 assert(max_irg_visited >= get_irg_visited(get_irp_irg(i)));
803 return max_irg_visited;
806 void set_max_irg_visited(int val) {
807 max_irg_visited = val;
811 inc_max_irg_visited(void) {
814 for(i = 0; i < get_irp_n_irgs(); i++)
815 assert(max_irg_visited >= get_irg_visited(get_irp_irg(i)));
817 return ++max_irg_visited;
821 (get_irg_block_visited)(const ir_graph *irg) {
822 return _get_irg_block_visited(irg);
826 (set_irg_block_visited)(ir_graph *irg, unsigned long visited) {
827 _set_irg_block_visited(irg, visited);
831 (inc_irg_block_visited)(ir_graph *irg) {
832 _inc_irg_block_visited(irg);
835 /* Return the floating point model of this graph. */
836 unsigned (get_irg_fp_model)(const ir_graph *irg) {
837 return _get_irg_fp_model(irg);
840 /* Sets the floating point model for this graph. */
841 void set_irg_fp_model(ir_graph *irg, unsigned model) {
842 irg->fp_model = model;
846 * walker Start->End: places Proj nodes into the same block
847 * as it's predecessors
852 static void normalize_proj_walker(ir_node *n, void *env) {
855 ir_node *pred = get_Proj_pred(n);
856 ir_node *block = get_nodes_block(pred);
858 set_nodes_block(n, block);
862 /* move Proj nodes into the same block as its predecessors */
863 void normalize_proj_nodes(ir_graph *irg) {
864 irg_walk_graph(irg, NULL, normalize_proj_walker, NULL);
865 set_irg_outs_inconsistent(irg);
868 /* set a description for local value n */
869 void set_irg_loc_description(ir_graph *irg, int n, void *description) {
870 assert(0 <= n && n < irg->n_loc);
872 if (! irg->loc_descriptions)
873 irg->loc_descriptions = xcalloc(sizeof(*irg->loc_descriptions), irg->n_loc);
875 irg->loc_descriptions[n] = description;
878 /* get the description for local value n */
879 void *get_irg_loc_description(ir_graph *irg, int n) {
880 assert(0 <= n && n < irg->n_loc);
881 return irg->loc_descriptions ? irg->loc_descriptions[n] : NULL;
885 void set_using_block_visited(ir_graph *irg) {
886 assert(irg->using_block_visited == 0);
887 irg->using_block_visited = 1;
890 void clear_using_block_visited(ir_graph *irg) {
891 assert(irg->using_block_visited == 1);
892 irg->using_block_visited = 0;
895 int using_block_visited(const ir_graph *irg) {
896 return irg->using_block_visited;
900 void set_using_visited(ir_graph *irg) {
901 assert(irg->using_visited == 0);
902 irg->using_visited = 1;
905 void clear_using_visited(ir_graph *irg) {
906 assert(irg->using_visited == 1);
907 irg->using_visited = 0;
910 int using_visited(const ir_graph *irg) {
911 return irg->using_visited;
915 void set_using_irn_link(ir_graph *irg) {
916 assert(irg->using_irn_link == 0);
917 irg->using_irn_link = 1;
920 void clear_using_irn_link(ir_graph *irg) {
921 assert(irg->using_irn_link == 1);
922 irg->using_irn_link = 0;
925 int using_irn_link(const ir_graph *irg) {
926 return irg->using_irn_link;
930 /* Returns a estimated node count of the irg. */
931 unsigned (get_irg_estimated_node_cnt)(const ir_graph *irg) {
932 return _get_irg_estimated_node_cnt(irg);
935 /* Returns the last irn index for this graph. */
936 unsigned get_irg_last_idx(const ir_graph *irg) {
937 return irg->last_node_idx;
940 /* register additional space in an IR graph */
941 size_t register_additional_graph_data(size_t size) {
942 assert(!forbid_new_data && "Too late to register additional node data");
947 return additional_graph_data_size += size;