2 * Copyright (C) 1995-2008 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;
77 #ifdef INTERPROCEDURAL_VIEW
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;
99 /** contains the suffix for frame type names */
100 static ident *frame_type_suffix = NULL;
102 /* initialize the IR graph module */
103 void firm_init_irgraph(void) {
104 frame_type_suffix = new_id_from_str(FRAME_TP_SUFFIX);
109 * Allocate a new IR graph.
110 * This function respects the registered graph data. The only reason for
111 * this function is, that there are two locations, where graphs are
112 * allocated (new_r_ir_graph, new_const_code_irg).
113 * @return Memory for a new graph.
115 static ir_graph *alloc_graph(void) {
116 size_t size = sizeof(ir_graph) + additional_graph_data_size;
117 char *ptr = xmalloc(size);
118 memset(ptr, 0, size);
120 return (ir_graph *) (ptr + additional_graph_data_size);
124 * Frees an allocated IR graph
126 static void free_graph(ir_graph *irg) {
127 char *ptr = (char *)irg;
128 free(ptr - additional_graph_data_size);
131 #if USE_EXPLICIT_PHI_IN_STACK
132 /* really defined in ircons.c */
133 typedef struct Phi_in_stack Phi_in_stack;
134 Phi_in_stack *new_Phi_in_stack();
135 void free_Phi_in_stack(Phi_in_stack *s);
138 /* Allocates a list of nodes:
139 - The start block containing a start node and Proj nodes for it's four
140 results (X, M, P, Tuple).
141 - The end block containing an end node. This block is not matured after
142 new_ir_graph as predecessors need to be added to it.
143 - The current block, which is empty and also not matured.
144 Further it allocates several datastructures needed for graph construction
147 ir_graph *new_r_ir_graph(ir_entity *ent, int n_loc) {
149 ir_node *first_block;
150 ir_node *end, *start, *start_block, *initial_mem, *projX;
153 res->kind = k_ir_graph;
155 //edges_init_graph_kind(res, EDGE_KIND_NORMAL);
156 //edges_init_graph_kind(res, EDGE_KIND_BLOCK);
158 /* initialize the idx->node map. */
159 res->idx_irn_map = NEW_ARR_F(ir_node *, INITIAL_IDX_IRN_MAP_SIZE);
160 memset(res->idx_irn_map, 0, INITIAL_IDX_IRN_MAP_SIZE * sizeof(res->idx_irn_map[0]));
162 /* inform statistics here, as blocks will be already build on this graph */
163 hook_new_graph(res, ent);
165 current_ir_graph = res;
167 /*-- initialized for each graph. --*/
168 if (get_opt_precise_exc_context()) {
169 res->n_loc = n_loc + 1 + 1; /* number of local variables that are never
170 dereferenced in this graph plus one for
171 the store plus one for links to fragile
172 operations. n_loc is not the number of
173 parameters to the procedure! */
175 res->n_loc = n_loc + 1; /* number of local variables that are never
176 dereferenced in this graph plus one for
177 the store. This is not the number of parameters
181 /* descriptions will be allocated on demand */
182 res->loc_descriptions = NULL;
184 res->visited = 0; /* visited flag, for the ir walker */
185 res->block_visited = 0; /* visited flag, for the 'block'-walker */
187 #if USE_EXPLICIT_PHI_IN_STACK
188 res->Phi_in_stack = new_Phi_in_stack(); /* A stack needed for automatic Phi
191 res->kind = k_ir_graph;
192 res->obst = xmalloc (sizeof(*res->obst));
193 obstack_init(res->obst);
194 res->extbb_obst = NULL;
196 res->last_node_idx = 0;
198 res->value_table = new_identities (); /* value table for global value
199 numbering for optimizing use in iropt.c */
202 res->inline_property = irg_inline_any;
203 res->additional_properties = mtp_property_inherited; /* inherited from type */
205 res->phase_state = phase_building;
206 res->irg_pinned_state = op_pin_state_pinned;
207 res->outs_state = outs_none;
208 res->dom_state = dom_none;
209 res->pdom_state = dom_none;
210 res->typeinfo_state = ir_typeinfo_none;
211 set_irp_typeinfo_inconsistent(); /* there is a new graph with typeinfo_none. */
212 res->callee_info_state = irg_callee_info_none;
213 res->loopinfo_state = loopinfo_none;
214 res->class_cast_state = ir_class_casts_transitive;
215 res->extblk_state = ir_extblk_info_none;
216 res->execfreq_state = exec_freq_none;
217 res->fp_model = fp_model_precise;
218 res->adr_taken_state = ir_address_taken_not_computed;
219 res->mem_disambig_opt = aa_opt_inherited;
221 /*-- Type information for the procedure of the graph --*/
223 set_entity_irg(ent, res);
225 /*-- a class type so that it can contain "inner" methods as in Pascal. --*/
226 res->frame_type = new_type_frame(mangle(get_entity_ident(ent), frame_type_suffix));
228 /* the Anchor node must be created first */
229 res->anchor = new_Anchor(res);
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);
258 res->index = get_irp_new_irg_idx();
260 res->graph_nr = get_irp_new_node_nr();
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.0;
275 res->estimated_node_count = 0;
282 new_ir_graph(ir_entity *ent, int n_loc) {
283 ir_graph *res = new_r_ir_graph(ent, n_loc);
284 add_irp_irg(res); /* remember this graph global. */
288 /* Make a rudimentary IR graph for the constant code.
289 Must look like a correct irg, spare everything else. */
290 ir_graph *new_const_code_irg(void) {
292 ir_node *end, *start_block, *start, *projX;
296 /* initialize the idx->node map. */
297 res->idx_irn_map = NEW_ARR_F(ir_node *, INITIAL_IDX_IRN_MAP_SIZE);
298 memset(res->idx_irn_map, 0, INITIAL_IDX_IRN_MAP_SIZE * sizeof(res->idx_irn_map[0]));
300 /* inform statistics here, as blocks will be already build on this graph */
301 hook_new_graph(res, NULL);
303 current_ir_graph = res;
304 res->n_loc = 1; /* Only the memory. */
305 res->visited = 0; /* visited flag, for the ir walker */
306 res->block_visited = 0; /* visited flag, for the 'block'-walker */
307 #if USE_EXPLICIT_PHI_IN_STACK
308 res->Phi_in_stack = NULL;
310 res->kind = k_ir_graph;
311 res->obst = xmalloc (sizeof(*res->obst));
312 obstack_init (res->obst);
313 res->extbb_obst = NULL;
315 res->last_node_idx = 0;
317 res->phase_state = phase_building;
318 res->irg_pinned_state = op_pin_state_pinned;
319 res->extblk_state = ir_extblk_info_none;
320 res->fp_model = fp_model_precise;
322 res->value_table = new_identities (); /* value table for global value
323 numbering for optimizing use in
326 res->frame_type = NULL;
328 /* the Anchor node must be created first */
329 res->anchor = new_Anchor(res);
331 /* -- The end block -- */
332 set_irg_end_block (res, new_immBlock());
334 set_irg_end (res, end);
335 set_irg_end_reg (res, end);
336 set_irg_end_except(res, end);
337 mature_immBlock(get_cur_block()); /* mature the end block */
339 /* -- The start block -- */
340 start_block = new_immBlock();
341 set_irg_start_block(res, start_block);
342 set_irg_bad (res, new_ir_node (NULL, res, start_block, op_Bad, mode_T, 0, NULL));
343 set_irg_no_mem (res, new_ir_node (NULL, res, start_block, op_NoMem, mode_M, 0, NULL));
345 set_irg_start (res, start);
347 /* Proj results of start node */
348 set_irg_initial_mem(res, new_Proj(start, mode_M, pn_Start_M));
349 projX = new_Proj(start, mode_X, pn_Start_X_initial_exec);
350 add_immBlock_pred(start_block, projX);
351 mature_immBlock (start_block); /* mature the start block */
353 add_immBlock_pred(new_immBlock(), projX);
354 mature_immBlock (get_cur_block()); /* mature the 'body' block for expressions */
356 /* Set the visited flag high enough that the blocks will never be visited. */
357 set_irn_visited(get_cur_block(), -1);
358 set_Block_block_visited(get_cur_block(), -1);
359 set_Block_block_visited(start_block, -1);
360 set_irn_visited(start_block, -1);
361 set_irn_visited(get_irg_bad(res), -1);
362 set_irn_visited(get_irg_no_mem(res), -1);
364 res->phase_state = phase_high;
369 /* Defined in iropt.c */
370 void del_identities (pset *value_table);
372 /* Frees the passed irgraph.
373 Deallocates all nodes in this graph and the ir_graph structure.
374 Sets the field irgraph in the corresponding entity to NULL.
375 Does not remove the irgraph from the list in irprog (requires
376 inefficient search, call remove_irp_irg by hand).
377 Does not free types, entities or modes that are used only by this
378 graph, nor the entity standing for this graph. */
379 void free_ir_graph (ir_graph *irg) {
380 assert(is_ir_graph(irg));
382 hook_free_graph(irg);
383 if (irg->outs_state != outs_none) free_irg_outs(irg);
384 if (irg->frame_type) free_type(irg->frame_type);
385 if (irg->value_table) del_identities(irg->value_table);
387 ir_peculiarity pec = get_entity_peculiarity (irg->ent);
388 set_entity_peculiarity (irg->ent, peculiarity_description);
389 set_entity_irg(irg->ent, NULL); /* not set in const code irg */
390 set_entity_peculiarity (irg->ent, pec);
393 free_End(get_irg_end(irg));
394 obstack_free(irg->obst,NULL);
396 #if USE_EXPLICIT_PHI_IN_STACK
397 free_Phi_in_stack(irg->Phi_in_stack);
399 if (irg->loc_descriptions)
400 free(irg->loc_descriptions);
405 /* access routines for all ir_graph attributes:
407 {attr type} get_irg_{attribute name} (ir_graph *irg);
408 void set_irg_{attr name} (ir_graph *irg, {attr type} {attr}); */
411 (is_ir_graph)(const void *thing) {
412 return _is_ir_graph(thing);
416 /* Outputs a unique number for this node */
417 long get_irg_graph_nr(const ir_graph *irg) {
418 return irg->graph_nr;
422 int get_irg_idx(const ir_graph *irg) {
427 (get_irg_start_block)(const ir_graph *irg) {
428 return _get_irg_start_block(irg);
432 (set_irg_start_block)(ir_graph *irg, ir_node *node) {
433 _set_irg_start_block(irg, node);
437 (get_irg_start)(const ir_graph *irg) {
438 return _get_irg_start(irg);
442 (set_irg_start)(ir_graph *irg, ir_node *node) {
443 _set_irg_start(irg, node);
447 (get_irg_end_block)(const ir_graph *irg) {
448 return _get_irg_end_block(irg);
452 (set_irg_end_block)(ir_graph *irg, ir_node *node) {
453 _set_irg_end_block(irg, node);
457 (get_irg_end)(const ir_graph *irg) {
458 return _get_irg_end(irg);
462 (set_irg_end)(ir_graph *irg, ir_node *node) {
463 _set_irg_end(irg, node);
467 (get_irg_end_reg)(const ir_graph *irg) {
468 return _get_irg_end_reg(irg);
472 (set_irg_end_reg)(ir_graph *irg, ir_node *node) {
473 _set_irg_end_reg(irg, node);
477 (get_irg_end_except)(const ir_graph *irg) {
478 return _get_irg_end_except(irg);
482 (set_irg_end_except)(ir_graph *irg, ir_node *node) {
483 assert(get_irn_op(node) == op_EndExcept || get_irn_op(node) == op_End);
484 _set_irg_end_except(irg, node);
488 (get_irg_frame)(const ir_graph *irg) {
489 return _get_irg_frame(irg);
493 (set_irg_frame)(ir_graph *irg, ir_node *node) {
494 _set_irg_frame(irg, node);
498 (get_irg_globals)(const ir_graph *irg) {
499 return _get_irg_globals(irg);
503 (set_irg_globals)(ir_graph *irg, ir_node *node) {
504 _set_irg_globals(irg, node);
508 (get_irg_tls)(const ir_graph *irg) {
509 return _get_irg_tls(irg);
513 (set_irg_tls)(ir_graph *irg, ir_node *node) {
514 _set_irg_tls(irg, node);
518 (get_irg_initial_mem)(const ir_graph *irg) {
519 return _get_irg_initial_mem(irg);
523 (set_irg_initial_mem)(ir_graph *irg, ir_node *node) {
524 _set_irg_initial_mem(irg, node);
528 (get_irg_args)(const ir_graph *irg) {
529 return _get_irg_args(irg);
533 (set_irg_args)(ir_graph *irg, ir_node *node) {
534 _set_irg_args(irg, node);
538 (get_irg_value_param_base)(const ir_graph *irg) {
539 return _get_irg_value_param_base(irg);
543 (set_irg_value_param_base)(ir_graph *irg, ir_node *node) {
544 _set_irg_value_param_base(irg, node);
548 (get_irg_bad)(const ir_graph *irg) {
549 return _get_irg_bad(irg);
553 (set_irg_bad)(ir_graph *irg, ir_node *node) {
554 _set_irg_bad(irg, node);
558 (get_irg_no_mem)(const ir_graph *irg) {
559 return _get_irg_no_mem(irg);
563 (set_irg_no_mem)(ir_graph *irg, ir_node *node) {
564 _set_irg_no_mem(irg, node);
568 (get_irg_current_block)(const ir_graph *irg) {
569 return _get_irg_current_block(irg);
573 (set_irg_current_block)(ir_graph *irg, ir_node *node) {
574 _set_irg_current_block(irg, node);
578 (get_irg_entity)(const ir_graph *irg) {
579 return _get_irg_entity(irg);
583 (set_irg_entity)(ir_graph *irg, ir_entity *ent) {
584 _set_irg_entity(irg, ent);
588 (get_irg_frame_type)(ir_graph *irg) {
589 return _get_irg_frame_type(irg);
593 (set_irg_frame_type)(ir_graph *irg, ir_type *ftp) {
594 _set_irg_frame_type(irg, ftp);
598 get_irg_n_locs(ir_graph *irg) {
599 if (get_opt_precise_exc_context())
600 return irg->n_loc - 1 - 1;
602 return irg->n_loc - 1;
606 set_irg_n_loc(ir_graph *irg, int n_loc) {
607 if (get_opt_precise_exc_context())
608 irg->n_loc = n_loc + 1 + 1;
610 irg->n_loc = n_loc + 1;
615 /* Returns the obstack associated with the graph. */
617 (get_irg_obstack)(const ir_graph *irg) {
618 return _get_irg_obstack(irg);
622 * Returns true if the node n is allocated on the storage of graph irg.
624 * Implementation is GLIBC specific as is uses the internal _obstack_chunk implementation.
626 int node_is_in_irgs_storage(ir_graph *irg, ir_node *n) {
627 struct _obstack_chunk *p;
630 * checks weather the ir_node pointer is on the obstack.
631 * A more sophisticated check would test the "whole" ir_node
633 for (p = irg->obst->chunk; p; p = p->prev) {
634 if (((char *)p->contents <= (char *)n) && ((char *)n < (char *)p->limit))
642 (get_irg_phase_state)(const ir_graph *irg) {
643 return _get_irg_phase_state(irg);
647 (set_irg_phase_state)(ir_graph *irg, irg_phase_state state) {
648 _set_irg_phase_state(irg, state);
652 (get_irg_pinned)(const ir_graph *irg) {
653 return _get_irg_pinned(irg);
657 (get_irg_outs_state)(const ir_graph *irg) {
658 return _get_irg_outs_state(irg);
662 (set_irg_outs_inconsistent)(ir_graph *irg) {
663 _set_irg_outs_inconsistent(irg);
667 (get_irg_extblk_state)(const ir_graph *irg) {
668 return _get_irg_extblk_state(irg);
672 (set_irg_extblk_inconsistent)(ir_graph *irg) {
673 _set_irg_extblk_inconsistent(irg);
677 (get_irg_dom_state)(const ir_graph *irg) {
678 return _get_irg_dom_state(irg);
682 (get_irg_postdom_state)(const ir_graph *irg) {
683 return _get_irg_postdom_state(irg);
687 (set_irg_doms_inconsistent)(ir_graph *irg) {
688 _set_irg_doms_inconsistent(irg);
692 (get_irg_loopinfo_state)(const ir_graph *irg) {
693 return _get_irg_loopinfo_state(irg);
697 (set_irg_loopinfo_state)(ir_graph *irg, irg_loopinfo_state s) {
698 _set_irg_loopinfo_state(irg, s);
702 (set_irg_loopinfo_inconsistent)(ir_graph *irg) {
703 _set_irg_loopinfo_inconsistent(irg);
706 void set_irp_loopinfo_inconsistent(void) {
708 for (i = get_irp_n_irgs() - 1; i >= 0; --i) {
709 set_irg_loopinfo_inconsistent(get_irp_irg(i));
716 (set_irg_pinned)(ir_graph *irg, op_pin_state p) {
717 _set_irg_pinned(irg, p);
720 irg_callee_info_state
721 (get_irg_callee_info_state)(const ir_graph *irg) {
722 return _get_irg_callee_info_state(irg);
726 (set_irg_callee_info_state)(ir_graph *irg, irg_callee_info_state s) {
727 _set_irg_callee_info_state(irg, s);
731 (get_irg_inline_property)(const ir_graph *irg) {
732 return _get_irg_inline_property(irg);
736 (set_irg_inline_property)(ir_graph *irg, irg_inline_property s) {
737 _set_irg_inline_property(irg, s);
741 (get_irg_additional_properties)(const ir_graph *irg) {
742 return _get_irg_additional_properties(irg);
746 (set_irg_additional_properties)(ir_graph *irg, unsigned property_mask) {
747 _set_irg_additional_properties(irg, property_mask);
751 (set_irg_additional_property)(ir_graph *irg, mtp_additional_property flag) {
752 _set_irg_additional_property(irg, flag);
756 (set_irg_link)(ir_graph *irg, void *thing) {
757 _set_irg_link(irg, thing);
761 (get_irg_link)(const ir_graph *irg) {
762 return _get_irg_link(irg);
765 /** maximum visited flag content of all ir_graph visited fields. */
766 static unsigned long max_irg_visited = 0;
769 (get_irg_visited)(const ir_graph *irg) {
770 return _get_irg_visited(irg);
774 set_irg_visited(ir_graph *irg, unsigned long visited) {
775 irg->visited = visited;
776 if (irg->visited > max_irg_visited) {
777 max_irg_visited = irg->visited;
782 inc_irg_visited(ir_graph *irg) {
783 if (++irg->visited > max_irg_visited) {
784 max_irg_visited = irg->visited;
789 get_max_irg_visited(void) {
792 for(i = 0; i < get_irp_n_irgs(); i++)
793 assert(max_irg_visited >= get_irg_visited(get_irp_irg(i)));
795 return max_irg_visited;
798 void set_max_irg_visited(int val) {
799 max_irg_visited = val;
803 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)));
809 return ++max_irg_visited;
813 (get_irg_block_visited)(const ir_graph *irg) {
814 return _get_irg_block_visited(irg);
818 (set_irg_block_visited)(ir_graph *irg, unsigned long visited) {
819 _set_irg_block_visited(irg, visited);
823 (inc_irg_block_visited)(ir_graph *irg) {
824 _inc_irg_block_visited(irg);
827 /* Return the floating point model of this graph. */
828 unsigned (get_irg_fp_model)(const ir_graph *irg) {
829 return _get_irg_fp_model(irg);
832 /* Sets the floating point model for this graph. */
833 void set_irg_fp_model(ir_graph *irg, unsigned model) {
834 irg->fp_model = model;
838 * walker Start->End: places Proj nodes into the same block
839 * as it's predecessors
844 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) {
934 assert(!forbid_new_data && "Too late to register additional node data");
939 return additional_graph_data_size += size;