2 * Copyright (C) 1995-2011 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
33 #include "irgraph_t.h"
35 #include "irgraph_t.h"
45 #include "irbackedge_t.h"
46 #include "iredges_t.h"
51 #define INITIAL_IDX_IRN_MAP_SIZE 1024
54 * Indicates, whether additional data can be registered to graphs.
55 * If set to 1, this is not possible anymore.
57 static int forbid_new_data = 0;
60 * The amount of additional space for custom data to be allocated upon
61 * creating a new graph.
63 static size_t additional_graph_data_size = 0;
65 ir_graph *current_ir_graph;
66 ir_graph *get_current_ir_graph(void)
68 return current_ir_graph;
71 void set_current_ir_graph(ir_graph *graph)
73 current_ir_graph = graph;
76 /** contains the suffix for frame type names */
77 static ident *frame_type_suffix = NULL;
79 /* initialize the IR graph module */
80 void firm_init_irgraph(void)
82 frame_type_suffix = new_id_from_str(FRAME_TP_SUFFIX);
87 * Allocate a new IR graph.
88 * This function respects the registered graph data. The only reason for
89 * this function is, that there are two locations, where graphs are
90 * allocated (new_r_ir_graph, new_const_code_irg).
91 * @return Memory for a new graph.
93 static ir_graph *alloc_graph(void)
96 size_t size = sizeof(ir_graph) + additional_graph_data_size;
97 char *ptr = XMALLOCNZ(char, size);
99 res = (ir_graph *)(ptr + additional_graph_data_size);
100 res->kind = k_ir_graph;
102 /* initialize the idx->node map. */
103 res->idx_irn_map = NEW_ARR_F(ir_node *, INITIAL_IDX_IRN_MAP_SIZE);
104 memset(res->idx_irn_map, 0, INITIAL_IDX_IRN_MAP_SIZE * sizeof(res->idx_irn_map[0]));
110 * Frees an allocated IR graph
112 static void free_graph(ir_graph *irg)
114 char *ptr = (char *)irg;
117 for (i = EDGE_KIND_FIRST; i < EDGE_KIND_LAST; ++i)
118 edges_deactivate_kind(irg, i);
119 DEL_ARR_F(irg->idx_irn_map);
120 free(ptr - additional_graph_data_size);
124 * Set the number of locals for a given graph.
126 * @param irg the graph
127 * @param n_loc number of locals
129 void irg_set_nloc(ir_graph *res, int n_loc)
131 assert(res->phase_state == phase_building);
133 res->n_loc = n_loc + 1; /* number of local variables that are never
134 dereferenced in this graph plus one for
135 the store. This is not the number of
136 parameters to the procedure! */
138 if (res->loc_descriptions) {
139 xfree(res->loc_descriptions);
140 res->loc_descriptions = NULL;
144 /* Allocates a list of nodes:
145 - The start block containing a start node and Proj nodes for its four
146 results (X, M, P, Tuple).
147 - The end block containing an end node. This block is not matured after
148 new_ir_graph as predecessors need to be added to it.
149 - The current block, which is empty and also not matured.
150 Further it allocates several datastructures needed for graph construction
153 ir_graph *new_r_ir_graph(ir_entity *ent, int n_loc)
156 ir_node *first_block;
157 ir_node *end, *start, *start_block, *initial_mem, *projX, *bad;
161 /* inform statistics here, as blocks will be already build on this graph */
162 hook_new_graph(res, ent);
164 /*-- initialized for each graph. --*/
165 res->kind = k_ir_graph;
166 res->obst = XMALLOC(struct obstack);
167 obstack_init(res->obst);
169 res->phase_state = phase_building;
170 irg_set_nloc(res, n_loc);
172 /* descriptions will be allocated on demand */
173 res->loc_descriptions = NULL;
175 res->visited = 0; /* visited flag, for the ir walker */
176 res->block_visited = 0; /* visited flag, for the 'block'-walker */
178 res->extbb_obst = NULL;
180 res->last_node_idx = 0;
185 res->inline_property = irg_inline_any;
186 res->additional_properties = mtp_property_inherited; /* inherited from type */
188 res->irg_pinned_state = op_pin_state_pinned;
189 res->outs_state = outs_none;
190 res->dom_state = dom_none;
191 res->pdom_state = dom_none;
192 res->typeinfo_state = ir_typeinfo_none;
193 set_irp_typeinfo_inconsistent(); /* there is a new graph with typeinfo_none. */
194 res->callee_info_state = irg_callee_info_none;
195 res->loopinfo_state = loopinfo_none;
196 res->class_cast_state = ir_class_casts_transitive;
197 res->extblk_state = ir_extblk_info_none;
198 res->execfreq_state = exec_freq_none;
199 res->fp_model = fp_model_precise;
200 res->entity_usage_state = ir_entity_usage_not_computed;
201 res->mem_disambig_opt = aa_opt_inherited;
203 /*-- Type information for the procedure of the graph --*/
205 set_entity_irg(ent, res);
207 /*-- a class type so that it can contain "inner" methods as in Pascal. --*/
208 res->frame_type = new_type_frame();
210 /* the Anchor node must be created first */
211 res->anchor = new_r_Anchor(res);
213 /*-- Nodes needed in every graph --*/
214 set_irg_end_block (res, new_r_immBlock(res));
215 end = new_r_End(res, 0, NULL);
216 set_irg_end(res, end);
218 start_block = new_r_Block_noopt(res, 0, NULL);
219 set_irg_start_block(res, start_block);
220 bad = new_r_Bad(res);
221 set_irg_bad (res, bad);
222 set_irg_no_mem (res, new_r_NoMem(res));
223 start = new_r_Start(res);
224 set_irg_start (res, start);
226 /* Proj results of start node */
227 projX = new_r_Proj(start, mode_X, pn_Start_X_initial_exec);
228 set_irg_initial_exec (res, projX);
229 set_irg_frame (res, new_r_Proj(start, mode_P_data, pn_Start_P_frame_base));
230 set_irg_args (res, new_r_Proj(start, mode_T, pn_Start_T_args));
231 initial_mem = new_r_Proj(start, mode_M, pn_Start_M);
232 set_irg_initial_mem(res, initial_mem);
234 res->index = get_irp_new_irg_idx();
236 res->graph_nr = get_irp_new_node_nr();
239 set_r_cur_block(res, start_block);
240 set_r_store(res, initial_mem);
242 /*-- Make a block to start with --*/
243 first_block = new_r_immBlock(res);
244 set_r_cur_block(res, first_block);
245 add_immBlock_pred(first_block, projX);
247 res->method_execution_frequency = -1.0;
248 res->estimated_node_count = 0;
253 ir_graph *new_ir_graph(ir_entity *ent, int n_loc)
255 ir_graph *res = new_r_ir_graph(ent, n_loc);
256 add_irp_irg(res); /* remember this graph global. */
260 /* Make a rudimentary IR graph for the constant code.
261 Must look like a correct irg, spare everything else. */
262 ir_graph *new_const_code_irg(void)
264 ir_graph *res = alloc_graph();
271 ir_node *start_block;
274 /* inform statistics here, as blocks will be already build on this graph */
275 hook_new_graph(res, NULL);
277 res->n_loc = 1; /* Only the memory. */
278 res->visited = 0; /* visited flag, for the ir walker */
279 res->block_visited = 0; /* visited flag, for the 'block'-walker */
280 res->obst = XMALLOC(struct obstack);
281 obstack_init(res->obst);
282 res->extbb_obst = NULL;
284 res->last_node_idx = 0;
286 res->phase_state = phase_building;
287 res->irg_pinned_state = op_pin_state_pinned;
288 res->extblk_state = ir_extblk_info_none;
289 res->fp_model = fp_model_precise;
291 /* value table for global value numbering for optimizing use in iropt.c */
294 res->frame_type = NULL;
296 /* the Anchor node must be created first */
297 res->anchor = new_r_Anchor(res);
299 /* -- The end block -- */
300 end_block = new_r_Block_noopt(res, 0, NULL);
301 set_irg_end_block(res, end_block);
302 end = new_r_End(res, 0, NULL);
303 set_irg_end(res, end);
305 /* -- The start block -- */
306 start_block = new_r_Block_noopt(res, 0, NULL);
307 set_irg_start_block(res, start_block);
308 bad = new_r_Bad(res);
309 set_irg_bad(res, bad);
310 no_mem = new_r_NoMem(res);
311 set_irg_no_mem(res, no_mem);
312 start = new_r_Start(res);
313 set_irg_start(res, start);
315 /* Proj results of start node */
316 set_irg_initial_mem(res, new_r_Proj(start, mode_M, pn_Start_M));
317 projX = new_r_Proj(start, mode_X, pn_Start_X_initial_exec);
319 body_block = new_r_Block(res, 1, &projX);
321 set_r_cur_block(res, body_block);
323 /* Set the visited flag high enough that the blocks will never be visited. */
324 set_irn_visited(body_block, -1);
325 set_Block_block_visited(body_block, -1);
326 set_Block_block_visited(start_block, -1);
327 set_irn_visited(start_block, -1);
328 set_irn_visited(bad, -1);
329 set_irn_visited(no_mem, -1);
335 * Pre-Walker: Copies blocks and nodes from the original method graph
336 * to the copied graph.
338 * @param n A node from the original method graph.
339 * @param env The copied graph.
341 static void copy_all_nodes(ir_node *node, void *env)
343 ir_graph *irg = (ir_graph*)env;
344 ir_node *new_node = irn_copy_into_irg(node, irg);
346 set_irn_link(node, new_node);
348 /* fix access to entities on the stack frame */
349 if (is_Sel(new_node)) {
350 ir_entity *ent = get_Sel_entity(new_node);
351 ir_type *tp = get_entity_owner(ent);
353 if (is_frame_type(tp)) {
354 /* replace by the copied entity */
355 ent = (ir_entity*)get_entity_link(ent);
357 assert(is_entity(ent));
358 assert(get_entity_owner(ent) == get_irg_frame_type(irg));
359 set_Sel_entity(new_node, ent);
365 * Post-walker: Set the predecessors of the copied nodes.
366 * The copied nodes are set as link of their original nodes. The links of
367 * "irn" predecessors are the predecessors of copied node.
369 static void rewire(ir_node *irn, void *env)
372 irn_rewire_inputs(irn);
375 static ir_node *get_new_node(const ir_node *old_node)
377 return (ir_node*) get_irn_link(old_node);
381 * Create a new graph that is a copy of a given one.
383 ir_graph *create_irg_copy(ir_graph *irg)
390 res->visited = 0; /* visited flag, for the ir walker */
391 res->block_visited = 0; /* visited flag, for the 'block'-walker */
392 res->obst = XMALLOC(struct obstack);
393 obstack_init(res->obst);
394 res->extbb_obst = NULL;
396 res->last_node_idx = 0;
398 res->phase_state = irg->phase_state;
399 res->irg_pinned_state = irg->irg_pinned_state;
400 res->extblk_state = ir_extblk_info_none;
401 res->fp_model = irg->fp_model;
405 /* clone the frame type here for safety */
406 irp_reserve_resources(irp, IR_RESOURCE_ENTITY_LINK);
407 res->frame_type = clone_frame_type(irg->frame_type);
409 res->phase_state = irg->phase_state;
411 ir_reserve_resources(irg, IR_RESOURCE_IRN_LINK);
413 /* copy all nodes from the graph irg to the new graph res */
414 irg_walk_anchors(irg, copy_all_nodes, rewire, res);
416 /* copy the Anchor node */
417 res->anchor = get_new_node(irg->anchor);
419 /* -- The end block -- */
420 set_irg_end_block (res, get_new_node(get_irg_end_block(irg)));
421 set_irg_end (res, get_new_node(get_irg_end(irg)));
423 /* -- The start block -- */
424 set_irg_start_block(res, get_new_node(get_irg_start_block(irg)));
425 set_irg_bad (res, get_new_node(get_irg_bad(irg)));
426 set_irg_no_mem (res, get_new_node(get_irg_no_mem(irg)));
427 set_irg_start (res, get_new_node(get_irg_start(irg)));
429 /* Proj results of start node */
430 set_irg_initial_mem(res, get_new_node(get_irg_initial_mem(irg)));
432 /* Copy the node count estimation. Would be strange if this
433 is different from the original one. */
434 res->estimated_node_count = irg->estimated_node_count;
436 ir_free_resources(irg, IR_RESOURCE_IRN_LINK);
437 irp_free_resources(irp, IR_RESOURCE_ENTITY_LINK);
442 /* Frees the passed irgraph.
443 Deallocates all nodes in this graph and the ir_graph structure.
444 Sets the field irgraph in the corresponding entity to NULL.
445 Does not remove the irgraph from the list in irprog (requires
446 inefficient search, call remove_irp_irg by hand).
447 Does not free types, entities or modes that are used only by this
448 graph, nor the entity standing for this graph. */
449 void free_ir_graph(ir_graph *irg)
451 assert(is_ir_graph(irg));
453 edges_deactivate(irg);
455 hook_free_graph(irg);
456 if (irg->outs_state != outs_none)
459 free_type(irg->frame_type);
462 set_entity_irg(irg->ent, NULL); /* not set in const code irg */
465 free_End(get_irg_end(irg));
466 obstack_free(irg->obst,NULL);
468 if (irg->loc_descriptions)
469 free(irg->loc_descriptions);
474 /* access routines for all ir_graph attributes:
476 {attr type} get_irg_{attribute name} (ir_graph *irg);
477 void set_irg_{attr name} (ir_graph *irg, {attr type} {attr}); */
479 int (is_ir_graph)(const void *thing)
481 return _is_ir_graph(thing);
485 /* Outputs a unique number for this node */
486 long get_irg_graph_nr(const ir_graph *irg)
488 return irg->graph_nr;
491 long get_irg_graph_nr(const ir_graph *irg)
493 return PTR_TO_INT(irg);
497 int get_irg_idx(const ir_graph *irg)
502 ir_node *(get_idx_irn)(ir_graph *irg, unsigned idx)
504 return _get_idx_irn(irg, idx);
507 ir_node *(get_irg_start_block)(const ir_graph *irg)
509 return _get_irg_start_block(irg);
512 void (set_irg_start_block)(ir_graph *irg, ir_node *node)
514 _set_irg_start_block(irg, node);
517 ir_node *(get_irg_start)(const ir_graph *irg)
519 return _get_irg_start(irg);
522 void (set_irg_start)(ir_graph *irg, ir_node *node)
524 _set_irg_start(irg, node);
527 ir_node *(get_irg_end_block)(const ir_graph *irg)
529 return _get_irg_end_block(irg);
532 void (set_irg_end_block)(ir_graph *irg, ir_node *node)
534 _set_irg_end_block(irg, node);
537 ir_node *(get_irg_end)(const ir_graph *irg)
539 return _get_irg_end(irg);
542 void (set_irg_end)(ir_graph *irg, ir_node *node)
544 _set_irg_end(irg, node);
547 ir_node *(get_irg_initial_exec)(const ir_graph *irg)
549 return _get_irg_initial_exec(irg);
552 void (set_irg_initial_exec)(ir_graph *irg, ir_node *node)
554 _set_irg_initial_exec(irg, node);
557 ir_node *(get_irg_frame)(const ir_graph *irg)
559 return _get_irg_frame(irg);
562 void (set_irg_frame)(ir_graph *irg, ir_node *node)
564 _set_irg_frame(irg, node);
567 ir_node *(get_irg_initial_mem)(const ir_graph *irg)
569 return _get_irg_initial_mem(irg);
572 void (set_irg_initial_mem)(ir_graph *irg, ir_node *node)
574 _set_irg_initial_mem(irg, node);
577 ir_node *(get_irg_args)(const ir_graph *irg)
579 return _get_irg_args(irg);
582 void (set_irg_args)(ir_graph *irg, ir_node *node)
584 _set_irg_args(irg, node);
587 ir_node *(get_irg_bad)(const ir_graph *irg)
589 return _get_irg_bad(irg);
592 void (set_irg_bad)(ir_graph *irg, ir_node *node)
594 _set_irg_bad(irg, node);
597 ir_node *(get_irg_no_mem)(const ir_graph *irg)
599 return _get_irg_no_mem(irg);
602 void (set_irg_no_mem)(ir_graph *irg, ir_node *node)
604 _set_irg_no_mem(irg, node);
607 ir_entity *(get_irg_entity)(const ir_graph *irg)
609 return _get_irg_entity(irg);
612 void (set_irg_entity)(ir_graph *irg, ir_entity *ent)
614 _set_irg_entity(irg, ent);
617 ir_type *(get_irg_frame_type)(ir_graph *irg)
619 return _get_irg_frame_type(irg);
622 void (set_irg_frame_type)(ir_graph *irg, ir_type *ftp)
624 _set_irg_frame_type(irg, ftp);
627 /* Returns the value parameter type of an IR graph. */
628 ir_type *get_irg_value_param_type(ir_graph *irg)
630 ir_entity *ent = get_irg_entity(irg);
631 ir_type *mtp = get_entity_type(ent);
632 return get_method_value_param_type(mtp);
635 int get_irg_n_locs(ir_graph *irg)
637 return irg->n_loc - 1;
640 /* Returns the obstack associated with the graph. */
642 (get_irg_obstack)(const ir_graph *irg) {
643 return _get_irg_obstack(irg);
647 * Returns true if the node n is allocated on the storage of graph irg.
649 * Implementation is GLIBC specific as is uses the internal _obstack_chunk implementation.
651 int node_is_in_irgs_storage(ir_graph *irg, ir_node *n)
653 struct _obstack_chunk *p;
656 * checks weather the ir_node pointer is on the obstack.
657 * A more sophisticated check would test the "whole" ir_node
659 for (p = irg->obst->chunk; p; p = p->prev) {
660 if (((char *)p->contents <= (char *)n) && ((char *)n < (char *)p->limit))
667 irg_phase_state (get_irg_phase_state)(const ir_graph *irg)
669 return _get_irg_phase_state(irg);
672 void (set_irg_phase_state)(ir_graph *irg, irg_phase_state state)
674 _set_irg_phase_state(irg, state);
677 op_pin_state (get_irg_pinned)(const ir_graph *irg)
679 return _get_irg_pinned(irg);
682 irg_outs_state (get_irg_outs_state)(const ir_graph *irg)
684 return _get_irg_outs_state(irg);
687 void (set_irg_outs_inconsistent)(ir_graph *irg)
689 _set_irg_outs_inconsistent(irg);
692 irg_extblk_info_state (get_irg_extblk_state)(const ir_graph *irg)
694 return _get_irg_extblk_state(irg);
697 void (set_irg_extblk_inconsistent)(ir_graph *irg)
699 _set_irg_extblk_inconsistent(irg);
702 irg_dom_state (get_irg_dom_state)(const ir_graph *irg)
704 return _get_irg_dom_state(irg);
707 irg_dom_state (get_irg_postdom_state)(const ir_graph *irg)
709 return _get_irg_postdom_state(irg);
712 void (set_irg_doms_inconsistent)(ir_graph *irg)
714 _set_irg_doms_inconsistent(irg);
717 irg_loopinfo_state (get_irg_loopinfo_state)(const ir_graph *irg)
719 return _get_irg_loopinfo_state(irg);
722 void (set_irg_loopinfo_state)(ir_graph *irg, irg_loopinfo_state s)
724 _set_irg_loopinfo_state(irg, s);
727 void (set_irg_loopinfo_inconsistent)(ir_graph *irg)
729 _set_irg_loopinfo_inconsistent(irg);
732 void set_irp_loopinfo_inconsistent(void)
735 for (i = 0, n = get_irp_n_irgs(); i < n; ++i) {
736 set_irg_loopinfo_inconsistent(get_irp_irg(i));
742 void (set_irg_pinned)(ir_graph *irg, op_pin_state p)
744 _set_irg_pinned(irg, p);
747 irg_callee_info_state (get_irg_callee_info_state)(const ir_graph *irg)
749 return _get_irg_callee_info_state(irg);
752 void (set_irg_callee_info_state)(ir_graph *irg, irg_callee_info_state s)
754 _set_irg_callee_info_state(irg, s);
757 irg_inline_property (get_irg_inline_property)(const ir_graph *irg)
759 return _get_irg_inline_property(irg);
762 void (set_irg_inline_property)(ir_graph *irg, irg_inline_property s)
764 _set_irg_inline_property(irg, s);
767 mtp_additional_properties (get_irg_additional_properties)(const ir_graph *irg)
769 return _get_irg_additional_properties(irg);
772 void (set_irg_additional_properties)(ir_graph *irg, mtp_additional_properties property_mask)
774 _set_irg_additional_properties(irg, property_mask);
777 void (add_irg_additional_properties)(ir_graph *irg, mtp_additional_properties flag)
779 _add_irg_additional_properties(irg, flag);
782 void (set_irg_link)(ir_graph *irg, void *thing)
784 _set_irg_link(irg, thing);
787 void *(get_irg_link)(const ir_graph *irg)
789 return _get_irg_link(irg);
792 ir_visited_t (get_irg_visited)(const ir_graph *irg)
794 return _get_irg_visited(irg);
797 /** maximum visited flag content of all ir_graph visited fields. */
798 static ir_visited_t max_irg_visited = 0;
800 void set_irg_visited(ir_graph *irg, ir_visited_t visited)
802 irg->visited = visited;
803 if (irg->visited > max_irg_visited) {
804 max_irg_visited = irg->visited;
808 void inc_irg_visited(ir_graph *irg)
811 if (irg->visited > max_irg_visited) {
812 max_irg_visited = irg->visited;
816 ir_visited_t get_max_irg_visited(void)
818 return max_irg_visited;
821 void set_max_irg_visited(int val)
823 max_irg_visited = val;
826 ir_visited_t inc_max_irg_visited(void)
830 for (i = 0; i < get_irp_n_irgs(); i++)
831 assert(max_irg_visited >= get_irg_visited(get_irp_irg(i)));
833 return ++max_irg_visited;
836 ir_visited_t (get_irg_block_visited)(const ir_graph *irg)
838 return _get_irg_block_visited(irg);
841 void (set_irg_block_visited)(ir_graph *irg, ir_visited_t visited)
843 _set_irg_block_visited(irg, visited);
846 void (inc_irg_block_visited)(ir_graph *irg)
848 _inc_irg_block_visited(irg);
851 /* Return the floating point model of this graph. */
852 unsigned (get_irg_fp_model)(const ir_graph *irg)
854 return _get_irg_fp_model(irg);
857 /* Sets the floating point model for this graph. */
858 void set_irg_fp_model(ir_graph *irg, unsigned model)
860 irg->fp_model = model;
863 /* set a description for local value n */
864 void set_irg_loc_description(ir_graph *irg, int n, void *description)
866 assert(0 <= n && n < irg->n_loc);
868 if (! irg->loc_descriptions)
869 irg->loc_descriptions = XMALLOCNZ(void*, irg->n_loc);
871 irg->loc_descriptions[n] = description;
874 /* get the description for local value n */
875 void *get_irg_loc_description(ir_graph *irg, int n)
877 assert(0 <= n && n < irg->n_loc);
878 return irg->loc_descriptions ? irg->loc_descriptions[n] : NULL;
881 void irg_register_phase(ir_graph *irg, ir_phase_id id, ir_phase *phase)
883 assert(id <= PHASE_LAST);
884 assert(irg->phases[id] == NULL);
885 irg->phases[id] = phase;
888 void irg_invalidate_phases(ir_graph *irg)
891 for (p = 0; p <= PHASE_LAST; ++p) {
892 ir_phase *phase = irg->phases[p];
897 irg->phases[p] = NULL;
902 void ir_reserve_resources(ir_graph *irg, ir_resources_t resources)
904 assert((resources & ~IR_RESOURCE_LOCAL_MASK) == 0);
905 assert((irg->reserved_resources & resources) == 0);
906 irg->reserved_resources |= resources;
909 void ir_free_resources(ir_graph *irg, ir_resources_t resources)
911 assert((irg->reserved_resources & resources) == resources);
912 irg->reserved_resources &= ~resources;
915 ir_resources_t ir_resources_reserved(const ir_graph *irg)
917 return irg->reserved_resources;
921 /* Returns a estimated node count of the irg. */
922 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)
930 return irg->last_node_idx;
933 /* register additional space in an IR graph */
934 size_t register_additional_graph_data(size_t size)
936 assert(!forbid_new_data && "Too late to register additional node data");
941 return additional_graph_data_size += size;
944 void (set_irg_state)(ir_graph *irg, ir_graph_state_t state)
946 _set_irg_state(irg, state);
949 void (clear_irg_state)(ir_graph *irg, ir_graph_state_t state)
951 _clear_irg_state(irg, state);
954 int (is_irg_state)(const ir_graph *irg, ir_graph_state_t state)
956 return _is_irg_state(irg, state);