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 * File name: ir/ir/irgraph.c
23 * Purpose: Entry point to the representation of procedure code.
24 * Author: Martin Trapp, Christian Schaefer
25 * Modified by: Goetz Lindenmaier, Michael Beck
28 * Copyright: (c) 1998-2007 Universität Karlsruhe
44 #include "irgraph_t.h"
56 #include "iredges_t.h"
60 #define INITIAL_IDX_IRN_MAP_SIZE 1024
63 * Indicates, whether additional data can be registered to graphs.
64 * If set to 1, this is not possible anymore.
66 static int forbid_new_data = 0;
69 * The amount of additional space for custom data to be allocated upon
70 * creating a new graph.
72 static size_t additional_graph_data_size = 0;
74 ir_graph *current_ir_graph;
75 ir_graph *get_current_ir_graph(void) {
76 return current_ir_graph;
78 void set_current_ir_graph(ir_graph *graph) {
79 current_ir_graph = graph;
83 int firm_interprocedural_view = 0;
85 int (get_interprocedural_view)(void) {
86 return _get_interprocedural_view();
89 void (set_interprocedural_view)(int state) {
90 firm_interprocedural_view = state;
92 /* set function vectors for faster access */
94 _get_irn_arity = _get_irn_inter_arity;
95 _get_irn_n = _get_irn_inter_n;
98 _get_irn_arity = _get_irn_intra_arity;
99 _get_irn_n = _get_irn_intra_n;
103 /** contains the suffix for frame type names */
104 static ident *frame_type_suffix = NULL;
106 /* initialize the IR graph module */
107 void firm_init_irgraph(void) {
108 frame_type_suffix = new_id_from_str(FRAME_TP_SUFFIX);
113 * Allocate a new IR graph.
114 * This function respects the registered graph data. The only reason for
115 * this function is, that there are two locations, where graphs are
116 * allocated (new_r_ir_graph, new_const_code_irg).
117 * @return Memory for a new graph.
119 static ir_graph *alloc_graph(void) {
120 size_t size = sizeof(ir_graph) + additional_graph_data_size;
121 char *ptr = xmalloc(size);
122 memset(ptr, 0, size);
124 return (ir_graph *) (ptr + additional_graph_data_size);
128 * Frees an allocated IR graph
130 static void free_graph(ir_graph *irg) {
131 char *ptr = (char *)irg;
132 free(ptr - additional_graph_data_size);
135 #if USE_EXPLICIT_PHI_IN_STACK
136 /* really defined in ircons.c */
137 typedef struct Phi_in_stack Phi_in_stack;
138 Phi_in_stack *new_Phi_in_stack();
139 void free_Phi_in_stack(Phi_in_stack *s);
142 /* Allocates a list of nodes:
143 - The start block containing a start node and Proj nodes for it's four
144 results (X, M, P, Tuple).
145 - The end block containing an end node. This block is not matured after
146 new_ir_graph as predecessors need to be added to it.
147 - The current block, which is empty and also not matured.
148 Further it allocates several datastructures needed for graph construction
152 new_r_ir_graph (ir_entity *ent, int n_loc)
155 ir_node *first_block;
156 ir_node *end, *start, *start_block, *initial_mem, *projX;
159 res->kind = k_ir_graph;
161 //edges_init_graph_kind(res, EDGE_KIND_NORMAL);
162 //edges_init_graph_kind(res, EDGE_KIND_BLOCK);
164 /* initialize the idx->node map. */
165 res->idx_irn_map = NEW_ARR_F(ir_node *, INITIAL_IDX_IRN_MAP_SIZE);
166 memset(res->idx_irn_map, 0, INITIAL_IDX_IRN_MAP_SIZE * sizeof(res->idx_irn_map[0]));
168 /* inform statistics here, as blocks will be already build on this graph */
169 hook_new_graph(res, ent);
171 current_ir_graph = res;
173 /*-- initialized for each graph. --*/
174 if (get_opt_precise_exc_context()) {
175 res->n_loc = n_loc + 1 + 1; /* number of local variables that are never
176 dereferenced in this graph plus one for
177 the store plus one for links to fragile
178 operations. n_loc is not the number of
179 parameters to the procedure! */
182 res->n_loc = n_loc + 1; /* number of local variables that are never
183 dereferenced in this graph plus one for
184 the store. This is not the number of parameters
188 /* descriptions will be allocated on demand */
189 res->loc_descriptions = NULL;
191 res->visited = 0; /* visited flag, for the ir walker */
192 res->block_visited = 0; /* visited flag, for the 'block'-walker */
194 #if USE_EXPLICIT_PHI_IN_STACK
195 res->Phi_in_stack = new_Phi_in_stack(); /* A stack needed for automatic Phi
198 res->kind = k_ir_graph;
199 res->obst = xmalloc (sizeof(*res->obst));
200 obstack_init(res->obst);
201 res->extbb_obst = NULL;
203 res->last_node_idx = 0;
205 res->value_table = new_identities (); /* value table for global value
206 numbering for optimizing use in
210 res->inline_property = irg_inline_any;
211 res->additional_properties = mtp_property_inherited; /* inherited from type */
213 res->phase_state = phase_building;
214 res->irg_pinned_state = op_pin_state_pinned;
215 res->outs_state = outs_none;
216 res->dom_state = dom_none;
217 res->pdom_state = dom_none;
218 res->typeinfo_state = ir_typeinfo_none;
219 set_irp_typeinfo_inconsistent(); /* there is a new graph with typeinfo_none. */
220 res->callee_info_state = irg_callee_info_none;
221 res->loopinfo_state = loopinfo_none;
222 res->class_cast_state = ir_class_casts_transitive;
223 res->extblk_state = ir_extblk_info_none;
224 res->execfreq_state = exec_freq_none;
225 res->fp_model = fp_model_precise;
226 res->adr_taken_state = ir_address_taken_not_computed;
227 res->mem_disambig_opt = aa_opt_inherited;
229 /*-- Type information for the procedure of the graph --*/
231 set_entity_irg(ent, res);
233 /*-- a class type so that it can contain "inner" methods as in Pascal. --*/
234 res->frame_type = new_type_frame(mangle(get_entity_ident(ent), frame_type_suffix));
236 /*-- Nodes needed in every graph --*/
237 set_irg_end_block (res, new_immBlock());
239 set_irg_end (res, end);
240 set_irg_end_reg (res, end);
241 set_irg_end_except(res, end);
243 start_block = new_immBlock();
244 set_irg_start_block(res, start_block);
245 set_irg_bad (res, new_ir_node(NULL, res, start_block, op_Bad, mode_T, 0, NULL));
246 set_irg_no_mem (res, new_ir_node(NULL, res, start_block, op_NoMem, mode_M, 0, NULL));
248 set_irg_start (res, start);
250 /* Proj results of start node */
251 projX = new_Proj(start, mode_X, pn_Start_X_initial_exec);
252 set_irg_frame (res, new_Proj(start, mode_P_data, pn_Start_P_frame_base));
253 set_irg_globals (res, new_Proj(start, mode_P_data, pn_Start_P_globals));
254 set_irg_tls (res, new_Proj(start, mode_P_data, pn_Start_P_tls));
255 set_irg_args (res, new_Proj(start, mode_T, pn_Start_T_args));
256 set_irg_value_param_base(res, new_Proj(start, mode_P_data, pn_Start_P_value_arg_base));
257 initial_mem = new_Proj(start, mode_M, pn_Start_M);
258 set_irg_initial_mem(res, initial_mem);
260 add_immBlock_pred(start_block, projX);
261 set_store(initial_mem);
264 res->graph_nr = get_irp_new_node_nr();
266 res->proj_args = NULL;
269 * The code generation needs it. leave it in now.
270 * Use of this edge is matter of discussion, unresolved. Also possible:
271 * add_immBlock_pred(res->start_block, res->start_block), but invalid typed.
273 mature_immBlock(res->current_block);
275 /*-- Make a block to start with --*/
276 first_block = new_immBlock();
277 add_immBlock_pred(first_block, projX);
279 res->method_execution_frequency = -1;
280 res->estimated_node_count = 0;
287 new_ir_graph(ir_entity *ent, int n_loc)
289 ir_graph *res = new_r_ir_graph(ent, n_loc);
290 add_irp_irg(res); /* remember this graph global. */
294 /* Make a rudimentary IR graph for the constant code.
295 Must look like a correct irg, spare everything else. */
296 ir_graph *new_const_code_irg(void) {
298 ir_node *end, *start_block, *start, *projX;
302 /* initialize the idx->node map. */
303 res->idx_irn_map = NEW_ARR_F(ir_node *, INITIAL_IDX_IRN_MAP_SIZE);
304 memset(res->idx_irn_map, 0, INITIAL_IDX_IRN_MAP_SIZE * sizeof(res->idx_irn_map[0]));
306 /* inform statistics here, as blocks will be already build on this graph */
307 hook_new_graph(res, NULL);
309 current_ir_graph = res;
310 res->n_loc = 1; /* Only the memory. */
311 res->visited = 0; /* visited flag, for the ir walker */
312 res->block_visited = 0; /* visited flag, for the 'block'-walker */
313 #if USE_EXPLICIT_PHI_IN_STACK
314 res->Phi_in_stack = NULL;
316 res->kind = k_ir_graph;
317 res->obst = xmalloc (sizeof(*res->obst));
318 obstack_init (res->obst);
319 res->extbb_obst = NULL;
321 res->last_node_idx = 0;
323 res->phase_state = phase_building;
324 res->irg_pinned_state = op_pin_state_pinned;
325 res->extblk_state = ir_extblk_info_none;
326 res->fp_model = fp_model_precise;
328 res->value_table = new_identities (); /* value table for global value
329 numbering for optimizing use in
332 res->frame_type = NULL;
334 /* -- The end block -- */
335 set_irg_end_block (res, new_immBlock());
337 set_irg_end (res, end);
338 set_irg_end_reg (res, end);
339 set_irg_end_except(res, end);
340 mature_immBlock(get_cur_block()); /* mature the end block */
342 /* -- The start block -- */
343 start_block = new_immBlock();
344 set_irg_start_block(res, start_block);
345 set_irg_bad (res, new_ir_node (NULL, res, start_block, op_Bad, mode_T, 0, NULL));
346 set_irg_no_mem (res, new_ir_node (NULL, res, start_block, op_NoMem, mode_M, 0, NULL));
348 set_irg_start (res, start);
350 /* Proj results of start node */
351 set_irg_initial_mem(res, new_Proj(start, mode_M, pn_Start_M));
352 projX = new_Proj(start, mode_X, pn_Start_X_initial_exec);
353 add_immBlock_pred(start_block, projX);
354 mature_immBlock (start_block); /* mature the start block */
356 add_immBlock_pred(new_immBlock(), projX);
357 mature_immBlock (get_cur_block()); /* mature the 'body' block for expressions */
359 /* Set the visited flag high enough that the blocks will never be visited. */
360 set_irn_visited(get_cur_block(), -1);
361 set_Block_block_visited(get_cur_block(), -1);
362 set_Block_block_visited(start_block, -1);
363 set_irn_visited(start_block, -1);
364 set_irn_visited(get_irg_bad(res), -1);
365 set_irn_visited(get_irg_no_mem(res), -1);
367 res->phase_state = phase_high;
372 /* Defined in iropt.c */
373 void del_identities (pset *value_table);
375 /* Frees the passed irgraph.
376 Deallocates all nodes in this graph and the ir_graph structure.
377 Sets the field irgraph in the corresponding entity to NULL.
378 Does not remove the irgraph from the list in irprog (requires
379 inefficient search, call remove_irp_irg by hand).
380 Does not free types, entities or modes that are used only by this
381 graph, nor the entity standing for this graph. */
382 void free_ir_graph (ir_graph *irg) {
383 assert(is_ir_graph(irg));
385 hook_free_graph(irg);
386 if (irg->outs_state != outs_none) free_irg_outs(irg);
387 if (irg->frame_type) free_type(irg->frame_type);
388 if (irg->value_table) del_identities(irg->value_table);
390 ir_peculiarity pec = get_entity_peculiarity (irg->ent);
391 set_entity_peculiarity (irg->ent, peculiarity_description);
392 set_entity_irg(irg->ent, NULL); /* not set in const code irg */
393 set_entity_peculiarity (irg->ent, pec);
396 free_End(get_irg_end(irg));
397 obstack_free(irg->obst,NULL);
399 #if USE_EXPLICIT_PHI_IN_STACK
400 free_Phi_in_stack(irg->Phi_in_stack);
402 if (irg->loc_descriptions)
403 free(irg->loc_descriptions);
408 /* access routines for all ir_graph attributes:
410 {attr type} get_irg_{attribute name} (ir_graph *irg);
411 void set_irg_{attr name} (ir_graph *irg, {attr type} {attr}); */
414 (is_ir_graph)(const void *thing) {
415 return _is_ir_graph(thing);
418 /* Outputs a unique number for this node */
419 long get_irg_graph_nr(ir_graph *irg) {
422 return irg->graph_nr;
424 return (long)PTR_TO_INT(irg);
429 (get_irg_start_block)(const ir_graph *irg) {
430 return _get_irg_start_block(irg);
434 (set_irg_start_block)(ir_graph *irg, ir_node *node) {
435 _set_irg_start_block(irg, node);
439 (get_irg_start)(const ir_graph *irg) {
440 return _get_irg_start(irg);
444 (set_irg_start)(ir_graph *irg, ir_node *node) {
445 _set_irg_start(irg, node);
449 (get_irg_end_block)(const ir_graph *irg) {
450 return _get_irg_end_block(irg);
454 (set_irg_end_block)(ir_graph *irg, ir_node *node) {
455 _set_irg_end_block(irg, node);
459 (get_irg_end)(const ir_graph *irg) {
460 return _get_irg_end(irg);
464 (set_irg_end)(ir_graph *irg, ir_node *node) {
465 _set_irg_end(irg, node);
469 (get_irg_end_reg)(const ir_graph *irg) {
470 return _get_irg_end_reg(irg);
473 void set_irg_end_reg (ir_graph *irg, ir_node *node) {
474 assert(get_irn_op(node) == op_EndReg || get_irn_op(node) == op_End);
475 irg->anchors[anchor_end_reg] = node;
479 (get_irg_end_except)(const ir_graph *irg) {
480 return _get_irg_end_except(irg);
483 void set_irg_end_except (ir_graph *irg, ir_node *node) {
484 assert(get_irn_op(node) == op_EndExcept || get_irn_op(node) == op_End);
485 irg->anchors[anchor_end_except] = node;
489 (get_irg_frame)(const ir_graph *irg) {
490 return _get_irg_frame(irg);
494 (set_irg_frame)(ir_graph *irg, ir_node *node) {
495 _set_irg_frame(irg, node);
499 (get_irg_globals)(const ir_graph *irg) {
500 return _get_irg_globals(irg);
504 (set_irg_globals)(ir_graph *irg, ir_node *node) {
505 _set_irg_globals(irg, node);
509 (get_irg_tls)(const ir_graph *irg) {
510 return _get_irg_tls(irg);
514 (set_irg_tls)(ir_graph *irg, ir_node *node) {
515 _set_irg_tls(irg, node);
519 (get_irg_initial_mem)(const ir_graph *irg) {
520 return _get_irg_initial_mem(irg);
524 (set_irg_initial_mem)(ir_graph *irg, ir_node *node) {
525 _set_irg_initial_mem(irg, node);
529 (get_irg_args)(const ir_graph *irg) {
530 return _get_irg_args(irg);
534 (set_irg_args)(ir_graph *irg, ir_node *node) {
535 _set_irg_args(irg, node);
539 (get_irg_value_param_base)(const ir_graph *irg) {
540 return _get_irg_value_param_base(irg);
544 (set_irg_value_param_base)(ir_graph *irg, ir_node *node) {
545 _set_irg_value_param_base(irg, node);
549 (get_irg_proj_args) (const ir_graph *irg) {
550 return _get_irg_proj_args (irg);
554 (set_irg_proj_args) (ir_graph *irg, ir_node **nodes) {
555 _set_irg_proj_args (irg, nodes);
559 (get_irg_bad)(const ir_graph *irg) {
560 return _get_irg_bad(irg);
564 (set_irg_bad)(ir_graph *irg, ir_node *node) {
565 _set_irg_bad(irg, node);
569 (get_irg_no_mem)(const ir_graph *irg) {
570 return _get_irg_no_mem(irg);
574 (set_irg_no_mem)(ir_graph *irg, ir_node *node) {
575 _set_irg_no_mem(irg, node);
579 (get_irg_current_block)(const ir_graph *irg) {
580 return _get_irg_current_block(irg);
584 (set_irg_current_block)(ir_graph *irg, ir_node *node) {
585 _set_irg_current_block(irg, node);
589 (get_irg_entity)(const ir_graph *irg) {
590 return _get_irg_entity(irg);
594 (set_irg_entity)(ir_graph *irg, ir_entity *ent) {
595 _set_irg_entity(irg, ent);
599 (get_irg_frame_type)(ir_graph *irg) {
600 return _get_irg_frame_type(irg);
604 (set_irg_frame_type)(ir_graph *irg, ir_type *ftp) {
605 _set_irg_frame_type(irg, ftp);
609 get_irg_n_locs (ir_graph *irg)
611 if (get_opt_precise_exc_context())
612 return irg->n_loc - 1 - 1;
614 return irg->n_loc - 1;
618 set_irg_n_loc (ir_graph *irg, int n_loc)
620 if (get_opt_precise_exc_context())
621 irg->n_loc = n_loc + 1 + 1;
623 irg->n_loc = n_loc + 1;
628 /* Returns the obstack associated with the graph. */
630 (get_irg_obstack)(const ir_graph *irg) {
631 return _get_irg_obstack(irg);
635 * Returns true if the node n is allocated on the storage of graph irg.
637 * Implementation is GLIBC specific as is uses the internal _obstack_chunk implementation.
639 int node_is_in_irgs_storage(ir_graph *irg, ir_node *n)
641 struct _obstack_chunk *p;
644 * checks weather the ir_node pointer is on the obstack.
645 * A more sophisticated check would test the "whole" ir_node
647 for (p = irg->obst->chunk; p; p = p->prev) {
648 if (((char *)p->contents <= (char *)n) && ((char *)n < (char *)p->limit))
656 (get_irg_phase_state)(const ir_graph *irg) {
657 return _get_irg_phase_state(irg);
661 (set_irg_phase_state)(ir_graph *irg, irg_phase_state state) {
662 _set_irg_phase_state(irg, state);
666 (get_irg_pinned)(const ir_graph *irg) {
667 return _get_irg_pinned(irg);
671 (get_irg_outs_state)(const ir_graph *irg) {
672 return _get_irg_outs_state(irg);
676 (set_irg_outs_inconsistent)(ir_graph *irg) {
677 _set_irg_outs_inconsistent(irg);
681 (get_irg_extblk_state)(const ir_graph *irg) {
682 return _get_irg_extblk_state(irg);
686 (set_irg_extblk_inconsistent)(ir_graph *irg) {
687 _set_irg_extblk_inconsistent(irg);
691 (get_irg_dom_state)(const ir_graph *irg) {
692 return _get_irg_dom_state(irg);
696 (get_irg_postdom_state)(const ir_graph *irg) {
697 return _get_irg_postdom_state(irg);
701 (set_irg_doms_inconsistent)(ir_graph *irg) {
702 _set_irg_doms_inconsistent(irg);
706 (get_irg_loopinfo_state)(const ir_graph *irg) {
707 return _get_irg_loopinfo_state(irg);
711 (set_irg_loopinfo_state)(ir_graph *irg, irg_loopinfo_state s) {
712 _set_irg_loopinfo_state(irg, s);
716 (set_irg_loopinfo_inconsistent)(ir_graph *irg) {
717 _set_irg_loopinfo_inconsistent(irg);
720 void set_irp_loopinfo_inconsistent(void) {
721 int i, n_irgs = get_irp_n_irgs();
722 for (i = 0; i < n_irgs; ++i) {
723 set_irg_loopinfo_inconsistent(get_irp_irg(i));
730 (set_irg_pinned)(ir_graph *irg, op_pin_state p) {
731 _set_irg_pinned(irg, p);
734 irg_callee_info_state
735 (get_irg_callee_info_state)(const ir_graph *irg) {
736 return _get_irg_callee_info_state(irg);
740 (set_irg_callee_info_state)(ir_graph *irg, irg_callee_info_state s) {
741 _set_irg_callee_info_state(irg, s);
745 (get_irg_inline_property)(const ir_graph *irg) {
746 return _get_irg_inline_property(irg);
750 (set_irg_inline_property)(ir_graph *irg, irg_inline_property s) {
751 _set_irg_inline_property(irg, s);
755 (get_irg_additional_properties)(const ir_graph *irg) {
756 return _get_irg_additional_properties(irg);
760 (set_irg_additional_properties)(ir_graph *irg, unsigned property_mask) {
761 _set_irg_additional_properties(irg, property_mask);
765 (set_irg_additional_property)(ir_graph *irg, mtp_additional_property flag) {
766 _set_irg_additional_property(irg, flag);
770 (set_irg_link)(ir_graph *irg, void *thing) {
771 _set_irg_link(irg, thing);
775 (get_irg_link)(const ir_graph *irg) {
776 return _get_irg_link(irg);
779 /** maximum visited flag content of all ir_graph visited fields. */
780 static unsigned long max_irg_visited = 0;
783 (get_irg_visited)(const ir_graph *irg) {
784 return _get_irg_visited(irg);
788 set_irg_visited (ir_graph *irg, unsigned long visited)
790 irg->visited = visited;
791 if (irg->visited > max_irg_visited) {
792 max_irg_visited = irg->visited;
797 inc_irg_visited (ir_graph *irg)
799 if (++irg->visited > max_irg_visited) {
800 max_irg_visited = irg->visited;
805 get_max_irg_visited(void)
809 for(i = 0; i < get_irp_n_irgs(); i++)
810 assert(max_irg_visited >= get_irg_visited(get_irp_irg(i)));
812 return max_irg_visited;
815 void set_max_irg_visited(int val) {
816 max_irg_visited = val;
820 inc_max_irg_visited(void)
824 for(i = 0; i < get_irp_n_irgs(); i++)
825 assert(max_irg_visited >= get_irg_visited(get_irp_irg(i)));
828 return max_irg_visited;
832 (get_irg_block_visited)(const ir_graph *irg) {
833 return _get_irg_block_visited(irg);
837 (set_irg_block_visited)(ir_graph *irg, unsigned long visited) {
838 _set_irg_block_visited(irg, visited);
842 (inc_irg_block_visited)(ir_graph *irg) {
843 _inc_irg_block_visited(irg);
846 /* Return the floating point model of this graph. */
847 unsigned (get_irg_fp_model)(const ir_graph *irg) {
848 return _get_irg_fp_model(irg);
851 /* Sets the floating point model for this graph. */
852 void set_irg_fp_model(ir_graph *irg, unsigned model) {
853 irg->fp_model = model;
857 * walker Start->End: places Proj nodes into the same block
858 * as it's predecessors
863 static void normalize_proj_walker(ir_node *n, void *env){
865 ir_node *pred = get_Proj_pred(n);
866 ir_node *block = get_nodes_block(pred);
868 set_nodes_block(n, block);
872 /* move Proj nodes into the same block as its predecessors */
873 void normalize_proj_nodes(ir_graph *irg) {
874 irg_walk_graph(irg, NULL, normalize_proj_walker, NULL);
875 set_irg_outs_inconsistent(irg);
878 /* set a description for local value n */
879 void set_irg_loc_description(ir_graph *irg, int n, void *description) {
880 assert(0 <= n && n < irg->n_loc);
882 if (! irg->loc_descriptions)
883 irg->loc_descriptions = xcalloc(sizeof(*irg->loc_descriptions), irg->n_loc);
885 irg->loc_descriptions[n] = description;
888 /* get the description for local value n */
889 void *get_irg_loc_description(ir_graph *irg, int n) {
890 assert(0 <= n && n < irg->n_loc);
891 return irg->loc_descriptions ? irg->loc_descriptions[n] : NULL;
895 void set_using_block_visited(ir_graph *irg) {
896 assert(irg->using_block_visited == 0);
897 irg->using_block_visited = 1;
900 void clear_using_block_visited(ir_graph *irg) {
901 assert(irg->using_block_visited == 1);
902 irg->using_block_visited = 0;
905 int using_block_visited(const ir_graph *irg) {
906 return irg->using_block_visited;
910 void set_using_visited(ir_graph *irg) {
911 assert(irg->using_visited == 0);
912 irg->using_visited = 1;
915 void clear_using_visited(ir_graph *irg) {
916 assert(irg->using_visited == 1);
917 irg->using_visited = 0;
920 int using_visited(const ir_graph *irg) {
921 return irg->using_visited;
925 void set_using_irn_link(ir_graph *irg) {
926 assert(irg->using_irn_link == 0);
927 irg->using_irn_link = 1;
930 void clear_using_irn_link(ir_graph *irg) {
931 assert(irg->using_irn_link == 1);
932 irg->using_irn_link = 0;
935 int using_irn_link(const ir_graph *irg) {
936 return irg->using_irn_link;
940 /* Returns a estimated node count of the irg. */
941 unsigned (get_irg_estimated_node_cnt)(const ir_graph *irg) {
942 return _get_irg_estimated_node_cnt(irg);
945 /* Returns the last irn index for this graph. */
946 unsigned get_irg_last_idx(const ir_graph *irg) {
947 return irg->last_node_idx;
950 /* register additional space in an IR graph */
951 size_t register_additional_graph_data(size_t size)
953 assert(!forbid_new_data && "Too late to register additional node data");
958 return additional_graph_data_size += size;