3 * File name: ir/ir/irgraph.c
4 * Purpose: Entry point to the representation of procedure code.
5 * Author: Martin Trapp, Christian Schaefer
6 * Modified by: Goetz Lindenmaier, Michael Beck
9 * Copyright: (c) 1998-2007 Universität Karlsruhe
10 * Licence: This file protected by GPL - GNU GENERAL PUBLIC LICENSE.
26 #include "irgraph_t.h"
38 #include "iredges_t.h"
42 #define INITIAL_IDX_IRN_MAP_SIZE 1024
45 * Indicates, whether additional data can be registered to graphs.
46 * If set to 1, this is not possible anymore.
48 static int forbid_new_data = 0;
51 * The amount of additional space for custom data to be allocated upon
52 * creating a new graph.
54 static size_t additional_graph_data_size = 0;
56 ir_graph *current_ir_graph;
57 ir_graph *get_current_ir_graph(void) {
58 return current_ir_graph;
60 void set_current_ir_graph(ir_graph *graph) {
61 current_ir_graph = graph;
65 int firm_interprocedural_view = 0;
67 int (get_interprocedural_view)(void) {
68 return _get_interprocedural_view();
71 void (set_interprocedural_view)(int state) {
72 firm_interprocedural_view = state;
74 /* set function vectors for faster access */
76 _get_irn_arity = _get_irn_inter_arity;
77 _get_irn_n = _get_irn_inter_n;
80 _get_irn_arity = _get_irn_intra_arity;
81 _get_irn_n = _get_irn_intra_n;
85 /** contains the suffix for frame type names */
86 static ident *frame_type_suffix = NULL;
88 /* initialize the IR graph module */
89 void firm_init_irgraph(void) {
90 frame_type_suffix = new_id_from_str(FRAME_TP_SUFFIX);
95 * Allocate a new IR graph.
96 * This function respects the registered graph data. The only reason for
97 * this function is, that there are two locations, where graphs are
98 * allocated (new_r_ir_graph, new_const_code_irg).
99 * @return Memory for a new graph.
101 static ir_graph *alloc_graph(void) {
102 size_t size = sizeof(ir_graph) + additional_graph_data_size;
103 char *ptr = xmalloc(size);
104 memset(ptr, 0, size);
106 return (ir_graph *) (ptr + additional_graph_data_size);
110 * Frees an allocated IR graph
112 static void free_graph(ir_graph *irg) {
113 char *ptr = (char *)irg;
114 free(ptr - additional_graph_data_size);
117 #if USE_EXPLICIT_PHI_IN_STACK
118 /* really defined in ircons.c */
119 typedef struct Phi_in_stack Phi_in_stack;
120 Phi_in_stack *new_Phi_in_stack();
121 void free_Phi_in_stack(Phi_in_stack *s);
124 /* Allocates a list of nodes:
125 - The start block containing a start node and Proj nodes for it's four
126 results (X, M, P, Tuple).
127 - The end block containing an end node. This block is not matured after
128 new_ir_graph as predecessors need to be added to it.
129 - The current block, which is empty and also not matured.
130 Further it allocates several datastructures needed for graph construction
134 new_r_ir_graph (ir_entity *ent, int n_loc)
137 ir_node *first_block;
138 ir_node *end, *start, *start_block, *initial_mem, *projX;
141 res->kind = k_ir_graph;
143 //edges_init_graph_kind(res, EDGE_KIND_NORMAL);
144 //edges_init_graph_kind(res, EDGE_KIND_BLOCK);
146 /* initialize the idx->node map. */
147 res->idx_irn_map = NEW_ARR_F(ir_node *, INITIAL_IDX_IRN_MAP_SIZE);
148 memset(res->idx_irn_map, 0, INITIAL_IDX_IRN_MAP_SIZE * sizeof(res->idx_irn_map[0]));
150 /* inform statistics here, as blocks will be already build on this graph */
151 hook_new_graph(res, ent);
153 current_ir_graph = res;
155 /*-- initialized for each graph. --*/
156 if (get_opt_precise_exc_context()) {
157 res->n_loc = n_loc + 1 + 1; /* number of local variables that are never
158 dereferenced in this graph plus one for
159 the store plus one for links to fragile
160 operations. n_loc is not the number of
161 parameters to the procedure! */
164 res->n_loc = n_loc + 1; /* number of local variables that are never
165 dereferenced in this graph plus one for
166 the store. This is not the number of parameters
170 /* descriptions will be allocated on demand */
171 res->loc_descriptions = NULL;
173 res->visited = 0; /* visited flag, for the ir walker */
174 res->block_visited = 0; /* visited flag, for the 'block'-walker */
176 #if USE_EXPLICIT_PHI_IN_STACK
177 res->Phi_in_stack = new_Phi_in_stack(); /* A stack needed for automatic Phi
180 res->kind = k_ir_graph;
181 res->obst = xmalloc (sizeof(*res->obst));
182 obstack_init(res->obst);
183 res->extbb_obst = NULL;
185 res->last_node_idx = 0;
187 res->value_table = new_identities (); /* value table for global value
188 numbering for optimizing use in
192 res->inline_property = irg_inline_any;
193 res->additional_properties = mtp_property_inherited; /* inherited from type */
195 res->phase_state = phase_building;
196 res->irg_pinned_state = op_pin_state_pinned;
197 res->outs_state = outs_none;
198 res->dom_state = dom_none;
199 res->pdom_state = dom_none;
200 res->typeinfo_state = ir_typeinfo_none;
201 set_irp_typeinfo_inconsistent(); /* there is a new graph with typeinfo_none. */
202 res->callee_info_state = irg_callee_info_none;
203 res->loopinfo_state = loopinfo_none;
204 res->class_cast_state = ir_class_casts_transitive;
205 res->extblk_state = ir_extblk_info_none;
206 res->execfreq_state = exec_freq_none;
207 res->fp_model = fp_model_precise;
208 res->adr_taken_state = ir_address_taken_not_computed;
209 res->mem_disambig_opt = aa_opt_inherited;
211 /*-- Type information for the procedure of the graph --*/
213 set_entity_irg(ent, res);
215 /*-- a class type so that it can contain "inner" methods as in Pascal. --*/
216 res->frame_type = new_type_frame(mangle(get_entity_ident(ent), frame_type_suffix));
218 /*-- Nodes needed in every graph --*/
219 set_irg_end_block (res, new_immBlock());
221 set_irg_end (res, end);
222 set_irg_end_reg (res, end);
223 set_irg_end_except(res, end);
225 start_block = new_immBlock();
226 set_irg_start_block(res, start_block);
227 set_irg_bad (res, new_ir_node(NULL, res, start_block, op_Bad, mode_T, 0, NULL));
228 set_irg_no_mem (res, new_ir_node(NULL, res, start_block, op_NoMem, mode_M, 0, NULL));
230 set_irg_start (res, start);
232 /* Proj results of start node */
233 projX = new_Proj(start, mode_X, pn_Start_X_initial_exec);
234 set_irg_frame (res, new_Proj(start, mode_P_data, pn_Start_P_frame_base));
235 set_irg_globals (res, new_Proj(start, mode_P_data, pn_Start_P_globals));
236 set_irg_tls (res, new_Proj(start, mode_P_data, pn_Start_P_tls));
237 set_irg_args (res, new_Proj(start, mode_T, pn_Start_T_args));
238 set_irg_value_param_base(res, new_Proj(start, mode_P_data, pn_Start_P_value_arg_base));
239 initial_mem = new_Proj(start, mode_M, pn_Start_M);
240 set_irg_initial_mem(res, initial_mem);
242 add_immBlock_pred(start_block, projX);
243 set_store(initial_mem);
246 res->graph_nr = get_irp_new_node_nr();
248 res->proj_args = NULL;
251 * The code generation needs it. leave it in now.
252 * Use of this edge is matter of discussion, unresolved. Also possible:
253 * add_immBlock_pred(res->start_block, res->start_block), but invalid typed.
255 mature_immBlock(res->current_block);
257 /*-- Make a block to start with --*/
258 first_block = new_immBlock();
259 add_immBlock_pred(first_block, projX);
261 res->method_execution_frequency = -1;
262 res->estimated_node_count = 0;
269 new_ir_graph(ir_entity *ent, int n_loc)
271 ir_graph *res = new_r_ir_graph(ent, n_loc);
272 add_irp_irg(res); /* remember this graph global. */
276 /* Make a rudimentary IR graph for the constant code.
277 Must look like a correct irg, spare everything else. */
278 ir_graph *new_const_code_irg(void) {
280 ir_node *end, *start_block, *start, *projX;
284 /* initialize the idx->node map. */
285 res->idx_irn_map = NEW_ARR_F(ir_node *, INITIAL_IDX_IRN_MAP_SIZE);
286 memset(res->idx_irn_map, 0, INITIAL_IDX_IRN_MAP_SIZE * sizeof(res->idx_irn_map[0]));
288 /* inform statistics here, as blocks will be already build on this graph */
289 hook_new_graph(res, NULL);
291 current_ir_graph = res;
292 res->n_loc = 1; /* Only the memory. */
293 res->visited = 0; /* visited flag, for the ir walker */
294 res->block_visited = 0; /* visited flag, for the 'block'-walker */
295 #if USE_EXPLICIT_PHI_IN_STACK
296 res->Phi_in_stack = NULL;
298 res->kind = k_ir_graph;
299 res->obst = xmalloc (sizeof(*res->obst));
300 obstack_init (res->obst);
301 res->extbb_obst = NULL;
303 res->last_node_idx = 0;
305 res->phase_state = phase_building;
306 res->irg_pinned_state = op_pin_state_pinned;
307 res->extblk_state = ir_extblk_info_none;
308 res->fp_model = fp_model_precise;
310 res->value_table = new_identities (); /* value table for global value
311 numbering for optimizing use in
314 res->frame_type = NULL;
316 /* -- The end block -- */
317 set_irg_end_block (res, new_immBlock());
319 set_irg_end (res, end);
320 set_irg_end_reg (res, end);
321 set_irg_end_except(res, end);
322 mature_immBlock(get_cur_block()); /* mature the end block */
324 /* -- The start block -- */
325 start_block = new_immBlock();
326 set_irg_start_block(res, start_block);
327 set_irg_bad (res, new_ir_node (NULL, res, start_block, op_Bad, mode_T, 0, NULL));
328 set_irg_no_mem (res, new_ir_node (NULL, res, start_block, op_NoMem, mode_M, 0, NULL));
330 set_irg_start (res, start);
332 /* Proj results of start node */
333 set_irg_initial_mem(res, new_Proj(start, mode_M, pn_Start_M));
334 projX = new_Proj(start, mode_X, pn_Start_X_initial_exec);
335 add_immBlock_pred(start_block, projX);
336 mature_immBlock (start_block); /* mature the start block */
338 add_immBlock_pred(new_immBlock(), projX);
339 mature_immBlock (get_cur_block()); /* mature the 'body' block for expressions */
341 /* Set the visited flag high enough that the blocks will never be visited. */
342 set_irn_visited(get_cur_block(), -1);
343 set_Block_block_visited(get_cur_block(), -1);
344 set_Block_block_visited(start_block, -1);
345 set_irn_visited(start_block, -1);
346 set_irn_visited(get_irg_bad(res), -1);
347 set_irn_visited(get_irg_no_mem(res), -1);
349 res->phase_state = phase_high;
354 /* Defined in iropt.c */
355 void del_identities (pset *value_table);
357 /* Frees the passed irgraph.
358 Deallocates all nodes in this graph and the ir_graph structure.
359 Sets the field irgraph in the corresponding entity to NULL.
360 Does not remove the irgraph from the list in irprog (requires
361 inefficient search, call remove_irp_irg by hand).
362 Does not free types, entities or modes that are used only by this
363 graph, nor the entity standing for this graph. */
364 void free_ir_graph (ir_graph *irg) {
365 assert(is_ir_graph(irg));
367 hook_free_graph(irg);
368 if (irg->outs_state != outs_none) free_irg_outs(irg);
369 if (irg->frame_type) free_type(irg->frame_type);
370 if (irg->value_table) del_identities(irg->value_table);
372 ir_peculiarity pec = get_entity_peculiarity (irg->ent);
373 set_entity_peculiarity (irg->ent, peculiarity_description);
374 set_entity_irg(irg->ent, NULL); /* not set in const code irg */
375 set_entity_peculiarity (irg->ent, pec);
378 free_End(get_irg_end(irg));
379 obstack_free(irg->obst,NULL);
381 #if USE_EXPLICIT_PHI_IN_STACK
382 free_Phi_in_stack(irg->Phi_in_stack);
384 if (irg->loc_descriptions)
385 free(irg->loc_descriptions);
390 /* access routines for all ir_graph attributes:
392 {attr type} get_irg_{attribute name} (ir_graph *irg);
393 void set_irg_{attr name} (ir_graph *irg, {attr type} {attr}); */
396 (is_ir_graph)(const void *thing) {
397 return _is_ir_graph(thing);
400 /* Outputs a unique number for this node */
401 long get_irg_graph_nr(ir_graph *irg) {
404 return irg->graph_nr;
406 return (long)PTR_TO_INT(irg);
411 (get_irg_start_block)(const ir_graph *irg) {
412 return _get_irg_start_block(irg);
416 (set_irg_start_block)(ir_graph *irg, ir_node *node) {
417 _set_irg_start_block(irg, node);
421 (get_irg_start)(const ir_graph *irg) {
422 return _get_irg_start(irg);
426 (set_irg_start)(ir_graph *irg, ir_node *node) {
427 _set_irg_start(irg, node);
431 (get_irg_end_block)(const ir_graph *irg) {
432 return _get_irg_end_block(irg);
436 (set_irg_end_block)(ir_graph *irg, ir_node *node) {
437 _set_irg_end_block(irg, node);
441 (get_irg_end)(const ir_graph *irg) {
442 return _get_irg_end(irg);
446 (set_irg_end)(ir_graph *irg, ir_node *node) {
447 _set_irg_end(irg, node);
451 (get_irg_end_reg)(const ir_graph *irg) {
452 return _get_irg_end_reg(irg);
455 void set_irg_end_reg (ir_graph *irg, ir_node *node) {
456 assert(get_irn_op(node) == op_EndReg || get_irn_op(node) == op_End);
457 irg->anchors[anchor_end_reg] = node;
461 (get_irg_end_except)(const ir_graph *irg) {
462 return _get_irg_end_except(irg);
465 void set_irg_end_except (ir_graph *irg, ir_node *node) {
466 assert(get_irn_op(node) == op_EndExcept || get_irn_op(node) == op_End);
467 irg->anchors[anchor_end_except] = node;
471 (get_irg_frame)(const ir_graph *irg) {
472 return _get_irg_frame(irg);
476 (set_irg_frame)(ir_graph *irg, ir_node *node) {
477 _set_irg_frame(irg, node);
481 (get_irg_globals)(const ir_graph *irg) {
482 return _get_irg_globals(irg);
486 (set_irg_globals)(ir_graph *irg, ir_node *node) {
487 _set_irg_globals(irg, node);
491 (get_irg_tls)(const ir_graph *irg) {
492 return _get_irg_tls(irg);
496 (set_irg_tls)(ir_graph *irg, ir_node *node) {
497 _set_irg_tls(irg, node);
501 (get_irg_initial_mem)(const ir_graph *irg) {
502 return _get_irg_initial_mem(irg);
506 (set_irg_initial_mem)(ir_graph *irg, ir_node *node) {
507 _set_irg_initial_mem(irg, node);
511 (get_irg_args)(const ir_graph *irg) {
512 return _get_irg_args(irg);
516 (set_irg_args)(ir_graph *irg, ir_node *node) {
517 _set_irg_args(irg, node);
521 (get_irg_value_param_base)(const ir_graph *irg) {
522 return _get_irg_value_param_base(irg);
526 (set_irg_value_param_base)(ir_graph *irg, ir_node *node) {
527 _set_irg_value_param_base(irg, node);
531 (get_irg_proj_args) (const ir_graph *irg) {
532 return _get_irg_proj_args (irg);
536 (set_irg_proj_args) (ir_graph *irg, ir_node **nodes) {
537 _set_irg_proj_args (irg, nodes);
541 (get_irg_bad)(const ir_graph *irg) {
542 return _get_irg_bad(irg);
546 (set_irg_bad)(ir_graph *irg, ir_node *node) {
547 _set_irg_bad(irg, node);
551 (get_irg_no_mem)(const ir_graph *irg) {
552 return _get_irg_no_mem(irg);
556 (set_irg_no_mem)(ir_graph *irg, ir_node *node) {
557 _set_irg_no_mem(irg, node);
561 (get_irg_current_block)(const ir_graph *irg) {
562 return _get_irg_current_block(irg);
566 (set_irg_current_block)(ir_graph *irg, ir_node *node) {
567 _set_irg_current_block(irg, node);
571 (get_irg_entity)(const ir_graph *irg) {
572 return _get_irg_entity(irg);
576 (set_irg_entity)(ir_graph *irg, ir_entity *ent) {
577 _set_irg_entity(irg, ent);
581 (get_irg_frame_type)(ir_graph *irg) {
582 return _get_irg_frame_type(irg);
586 (set_irg_frame_type)(ir_graph *irg, ir_type *ftp) {
587 _set_irg_frame_type(irg, ftp);
591 get_irg_n_locs (ir_graph *irg)
593 if (get_opt_precise_exc_context())
594 return irg->n_loc - 1 - 1;
596 return irg->n_loc - 1;
600 set_irg_n_loc (ir_graph *irg, int n_loc)
602 if (get_opt_precise_exc_context())
603 irg->n_loc = n_loc + 1 + 1;
605 irg->n_loc = n_loc + 1;
610 /* Returns the obstack associated with the graph. */
612 (get_irg_obstack)(const ir_graph *irg) {
613 return _get_irg_obstack(irg);
617 * Returns true if the node n is allocated on the storage of graph irg.
619 * Implementation is GLIBC specific as is uses the internal _obstack_chunk implementation.
621 int node_is_in_irgs_storage(ir_graph *irg, ir_node *n)
623 struct _obstack_chunk *p;
626 * checks weather the ir_node pointer is on the obstack.
627 * A more sophisticated check would test the "whole" ir_node
629 for (p = irg->obst->chunk; p; p = p->prev) {
630 if (((char *)p->contents <= (char *)n) && ((char *)n < (char *)p->limit))
638 (get_irg_phase_state)(const ir_graph *irg) {
639 return _get_irg_phase_state(irg);
643 (set_irg_phase_state)(ir_graph *irg, irg_phase_state state) {
644 _set_irg_phase_state(irg, state);
648 (get_irg_pinned)(const ir_graph *irg) {
649 return _get_irg_pinned(irg);
653 (get_irg_outs_state)(const ir_graph *irg) {
654 return _get_irg_outs_state(irg);
658 (set_irg_outs_inconsistent)(ir_graph *irg) {
659 _set_irg_outs_inconsistent(irg);
663 (get_irg_extblk_state)(const ir_graph *irg) {
664 return _get_irg_extblk_state(irg);
668 (set_irg_extblk_inconsistent)(ir_graph *irg) {
669 _set_irg_extblk_inconsistent(irg);
673 (get_irg_dom_state)(const ir_graph *irg) {
674 return _get_irg_dom_state(irg);
678 (get_irg_postdom_state)(const ir_graph *irg) {
679 return _get_irg_postdom_state(irg);
683 (set_irg_doms_inconsistent)(ir_graph *irg) {
684 _set_irg_doms_inconsistent(irg);
688 (get_irg_loopinfo_state)(const ir_graph *irg) {
689 return _get_irg_loopinfo_state(irg);
693 (set_irg_loopinfo_state)(ir_graph *irg, irg_loopinfo_state s) {
694 _set_irg_loopinfo_state(irg, s);
698 (set_irg_loopinfo_inconsistent)(ir_graph *irg) {
699 _set_irg_loopinfo_inconsistent(irg);
702 void set_irp_loopinfo_inconsistent(void) {
703 int i, n_irgs = get_irp_n_irgs();
704 for (i = 0; i < n_irgs; ++i) {
705 set_irg_loopinfo_inconsistent(get_irp_irg(i));
712 (set_irg_pinned)(ir_graph *irg, op_pin_state p) {
713 _set_irg_pinned(irg, p);
716 irg_callee_info_state
717 (get_irg_callee_info_state)(const ir_graph *irg) {
718 return _get_irg_callee_info_state(irg);
722 (set_irg_callee_info_state)(ir_graph *irg, irg_callee_info_state s) {
723 _set_irg_callee_info_state(irg, s);
727 (get_irg_inline_property)(const ir_graph *irg) {
728 return _get_irg_inline_property(irg);
732 (set_irg_inline_property)(ir_graph *irg, irg_inline_property s) {
733 _set_irg_inline_property(irg, s);
737 (get_irg_additional_properties)(const ir_graph *irg) {
738 return _get_irg_additional_properties(irg);
742 (set_irg_additional_properties)(ir_graph *irg, unsigned property_mask) {
743 _set_irg_additional_properties(irg, property_mask);
747 (set_irg_additional_property)(ir_graph *irg, mtp_additional_property flag) {
748 _set_irg_additional_property(irg, flag);
752 (set_irg_link)(ir_graph *irg, void *thing) {
753 _set_irg_link(irg, thing);
757 (get_irg_link)(const ir_graph *irg) {
758 return _get_irg_link(irg);
761 /** maximum visited flag content of all ir_graph visited fields. */
762 static unsigned long max_irg_visited = 0;
765 (get_irg_visited)(const ir_graph *irg) {
766 return _get_irg_visited(irg);
770 set_irg_visited (ir_graph *irg, unsigned long visited)
772 irg->visited = visited;
773 if (irg->visited > max_irg_visited) {
774 max_irg_visited = irg->visited;
779 inc_irg_visited (ir_graph *irg)
781 if (++irg->visited > max_irg_visited) {
782 max_irg_visited = irg->visited;
787 get_max_irg_visited(void)
791 for(i = 0; i < get_irp_n_irgs(); i++)
792 assert(max_irg_visited >= get_irg_visited(get_irp_irg(i)));
794 return max_irg_visited;
797 void set_max_irg_visited(int val) {
798 max_irg_visited = val;
802 inc_max_irg_visited(void)
806 for(i = 0; i < get_irp_n_irgs(); i++)
807 assert(max_irg_visited >= get_irg_visited(get_irp_irg(i)));
810 return max_irg_visited;
814 (get_irg_block_visited)(const ir_graph *irg) {
815 return _get_irg_block_visited(irg);
819 (set_irg_block_visited)(ir_graph *irg, unsigned long visited) {
820 _set_irg_block_visited(irg, visited);
824 (inc_irg_block_visited)(ir_graph *irg) {
825 _inc_irg_block_visited(irg);
828 /* Return the floating point model of this graph. */
829 unsigned (get_irg_fp_model)(const ir_graph *irg) {
830 return _get_irg_fp_model(irg);
833 /* Sets the floating point model for this graph. */
834 void set_irg_fp_model(ir_graph *irg, unsigned model) {
835 irg->fp_model = model;
839 * walker Start->End: places Proj nodes into the same block
840 * as it's predecessors
845 static void normalize_proj_walker(ir_node *n, void *env){
847 ir_node *pred = get_Proj_pred(n);
848 ir_node *block = get_nodes_block(pred);
850 set_nodes_block(n, block);
854 /* move Proj nodes into the same block as its predecessors */
855 void normalize_proj_nodes(ir_graph *irg) {
856 irg_walk_graph(irg, NULL, normalize_proj_walker, NULL);
857 set_irg_outs_inconsistent(irg);
860 /* set a description for local value n */
861 void set_irg_loc_description(ir_graph *irg, int n, void *description) {
862 assert(0 <= n && n < irg->n_loc);
864 if (! irg->loc_descriptions)
865 irg->loc_descriptions = xcalloc(sizeof(*irg->loc_descriptions), irg->n_loc);
867 irg->loc_descriptions[n] = description;
870 /* get the description for local value n */
871 void *get_irg_loc_description(ir_graph *irg, int n) {
872 assert(0 <= n && n < irg->n_loc);
873 return irg->loc_descriptions ? irg->loc_descriptions[n] : NULL;
877 void set_using_block_visited(ir_graph *irg) {
878 assert(irg->using_block_visited == 0);
879 irg->using_block_visited = 1;
882 void clear_using_block_visited(ir_graph *irg) {
883 assert(irg->using_block_visited == 1);
884 irg->using_block_visited = 0;
887 int using_block_visited(const ir_graph *irg) {
888 return irg->using_block_visited;
892 void set_using_visited(ir_graph *irg) {
893 assert(irg->using_visited == 0);
894 irg->using_visited = 1;
897 void clear_using_visited(ir_graph *irg) {
898 assert(irg->using_visited == 1);
899 irg->using_visited = 0;
902 int using_visited(const ir_graph *irg) {
903 return irg->using_visited;
907 void set_using_irn_link(ir_graph *irg) {
908 assert(irg->using_irn_link == 0);
909 irg->using_irn_link = 1;
912 void clear_using_irn_link(ir_graph *irg) {
913 assert(irg->using_irn_link == 1);
914 irg->using_irn_link = 0;
917 int using_irn_link(const ir_graph *irg) {
918 return irg->using_irn_link;
922 /* Returns a estimated node count of the irg. */
923 unsigned (get_irg_estimated_node_cnt)(const ir_graph *irg) {
924 return _get_irg_estimated_node_cnt(irg);
927 /* Returns the last irn index for this graph. */
928 unsigned get_irg_last_idx(const ir_graph *irg) {
929 return irg->last_node_idx;
932 /* register additional space in an IR graph */
933 size_t register_additional_graph_data(size_t size)
935 assert(!forbid_new_data && "Too late to register additional node data");
940 return additional_graph_data_size += size;