perform end/first block mature in libfirm
[libfirm] / ir / ir / irgraph.c
1 /*
2  * Copyright (C) 1995-2011 University of Karlsruhe.  All right reserved.
3  *
4  * This file is part of libFirm.
5  *
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.
10  *
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.
14  *
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
17  * PURPOSE.
18  */
19
20 /**
21  * @file
22  * @brief    Entry point to the representation of procedure code.
23  * @author   Martin Trapp, Christian Schaefer, Goetz Lindenmaier, Michael Beck
24  */
25 #include "config.h"
26
27 #include <string.h>
28 #include <stddef.h>
29
30 #include "xmalloc.h"
31 #include "ircons_t.h"
32 #include "irgraph_t.h"
33 #include "irprog_t.h"
34 #include "irgraph_t.h"
35 #include "irnode_t.h"
36 #include "iropt_t.h"
37 #include "irflag_t.h"
38 #include "array.h"
39 #include "irgmod.h"
40 #include "irouts.h"
41 #include "irhooks.h"
42 #include "irtools.h"
43 #include "util.h"
44 #include "irgwalk.h"
45 #include "irbackedge_t.h"
46 #include "iredges_t.h"
47 #include "type_t.h"
48 #include "irmemory.h"
49
50 #define INITIAL_IDX_IRN_MAP_SIZE 1024
51
52 /**
53  * Indicates, whether additional data can be registered to graphs.
54  * If set to 1, this is not possible anymore.
55  */
56 static int forbid_new_data = 0;
57
58 /**
59  * The amount of additional space for custom data to be allocated upon
60  * creating a new graph.
61  */
62 static size_t additional_graph_data_size = 0;
63
64 ir_graph *current_ir_graph;
65 ir_graph *get_current_ir_graph(void)
66 {
67         return current_ir_graph;
68 }
69
70 void set_current_ir_graph(ir_graph *graph)
71 {
72         current_ir_graph = graph;
73 }
74
75 /** contains the suffix for frame type names */
76 static ident *frame_type_suffix = NULL;
77
78 void firm_init_irgraph(void)
79 {
80         frame_type_suffix = new_id_from_str(FRAME_TP_SUFFIX);
81         forbid_new_data   = 1;
82 }
83
84 /**
85  * Allocate a new IR graph.
86  * This function respects the registered graph data. The only reason for
87  * this function is, that there are two locations, where graphs are
88  * allocated (new_r_ir_graph, new_const_code_irg).
89  * @return Memory for a new graph.
90  */
91 static ir_graph *alloc_graph(void)
92 {
93         ir_graph *res;
94         size_t   size = sizeof(ir_graph) + additional_graph_data_size;
95         char     *ptr = XMALLOCNZ(char, size);
96
97         res = (ir_graph *)(ptr + additional_graph_data_size);
98         res->kind = k_ir_graph;
99
100         /* initialize the idx->node map. */
101         res->idx_irn_map = NEW_ARR_F(ir_node *, INITIAL_IDX_IRN_MAP_SIZE);
102         memset(res->idx_irn_map, 0, INITIAL_IDX_IRN_MAP_SIZE * sizeof(res->idx_irn_map[0]));
103
104         return res;
105 }
106
107 /**
108  * Frees an allocated IR graph
109  */
110 static void free_graph(ir_graph *irg)
111 {
112         char           *ptr = (char *)irg;
113         ir_edge_kind_t  i;
114
115         for (i = EDGE_KIND_FIRST; i < EDGE_KIND_LAST; ++i)
116                 edges_deactivate_kind(irg, i);
117         DEL_ARR_F(irg->idx_irn_map);
118         free(ptr - additional_graph_data_size);
119 }
120
121 void irg_set_nloc(ir_graph *res, int n_loc)
122 {
123         assert(res->phase_state == phase_building);
124
125         res->n_loc = n_loc + 1;     /* number of local variables that are never
126                                        dereferenced in this graph plus one for
127                                        the store. This is not the number of
128                                        parameters to the procedure!  */
129
130         if (res->loc_descriptions) {
131                 xfree(res->loc_descriptions);
132                 res->loc_descriptions = NULL;
133         }
134 }
135
136 ir_graph *new_r_ir_graph(ir_entity *ent, int n_loc)
137 {
138         ir_graph *res;
139         ir_node  *first_block;
140         ir_node  *start, *start_block, *initial_mem, *projX;
141
142         res = alloc_graph();
143
144         /* inform statistics here, as blocks will be already build on this graph */
145         hook_new_graph(res, ent);
146
147         /*-- initialized for each graph. --*/
148         res->kind = k_ir_graph;
149         res->obst = XMALLOC(struct obstack);
150         obstack_init(res->obst);
151
152         res->phase_state = phase_building;
153         irg_set_nloc(res, n_loc);
154
155         /* descriptions will be allocated on demand */
156         res->loc_descriptions = NULL;
157
158         res->visited       = 0; /* visited flag, for the ir walker */
159         res->block_visited = 0; /* visited flag, for the 'block'-walker */
160
161         res->extbb_obst = NULL;
162
163         res->last_node_idx = 0;
164
165         new_identities(res);
166         res->outs = NULL;
167
168         res->inline_property       = irg_inline_any;
169         res->additional_properties = mtp_property_inherited;  /* inherited from type */
170
171         res->irg_pinned_state    = op_pin_state_pinned;
172         res->typeinfo_state      = ir_typeinfo_none;
173         set_irp_typeinfo_inconsistent();           /* there is a new graph with typeinfo_none. */
174         res->callee_info_state   = irg_callee_info_none;
175         res->class_cast_state    = ir_class_casts_transitive;
176         res->fp_model            = fp_model_precise;
177         res->mem_disambig_opt    = aa_opt_inherited;
178
179         /*-- Type information for the procedure of the graph --*/
180         res->ent = ent;
181         set_entity_irg(ent, res);
182
183         /*--  a class type so that it can contain "inner" methods as in Pascal. --*/
184         res->frame_type = new_type_frame();
185
186         /* the Anchor node must be created first */
187         res->anchor = new_r_Anchor(res);
188
189         /*-- Nodes needed in every graph --*/
190         set_irg_end_block(res, new_r_immBlock(res));
191         set_irg_end(res, new_r_End(res, 0, NULL));
192
193         start_block = new_r_Block_noopt(res, 0, NULL);
194         set_irg_start_block(res, start_block);
195         set_irg_no_mem     (res, new_r_NoMem(res));
196         start = new_r_Start(res);
197         set_irg_start      (res, start);
198
199         /* Proj results of start node */
200         projX                   = new_r_Proj(start, mode_X, pn_Start_X_initial_exec);
201         set_irg_initial_exec    (res, projX);
202         set_irg_frame           (res, new_r_Proj(start, mode_P_data, pn_Start_P_frame_base));
203         set_irg_args            (res, new_r_Proj(start, mode_T,      pn_Start_T_args));
204         initial_mem             = new_r_Proj(start, mode_M, pn_Start_M);
205         set_irg_initial_mem(res, initial_mem);
206
207         res->index       = get_irp_new_irg_idx();
208 #ifdef DEBUG_libfirm
209         res->graph_nr    = get_irp_new_node_nr();
210 #endif
211
212         set_r_cur_block(res, start_block);
213         set_r_store(res, initial_mem);
214
215         /*-- Make a block to start with --*/
216         first_block = new_r_Block(res, 1, &projX);
217         set_r_cur_block(res, first_block);
218
219         res->method_execution_frequency = -1.0;
220         res->estimated_node_count       = 0;
221
222         return res;
223 }
224
225 ir_graph *new_ir_graph(ir_entity *ent, int n_loc)
226 {
227         ir_graph *res = new_r_ir_graph(ent, n_loc);
228         add_irp_irg(res);          /* remember this graph global. */
229         return res;
230 }
231
232 ir_graph *new_const_code_irg(void)
233 {
234         ir_graph *res = alloc_graph();
235         ir_node  *body_block;
236         ir_node  *end;
237         ir_node  *end_block;
238         ir_node  *no_mem;
239         ir_node  *projX;
240         ir_node  *start_block;
241         ir_node  *start;
242
243         /* inform statistics here, as blocks will be already build on this graph */
244         hook_new_graph(res, NULL);
245
246         res->n_loc         = 1; /* Only the memory. */
247         res->visited       = 0; /* visited flag, for the ir walker */
248         res->block_visited = 0; /* visited flag, for the 'block'-walker */
249         res->obst          = XMALLOC(struct obstack);
250         obstack_init(res->obst);
251         res->extbb_obst = NULL;
252
253         res->last_node_idx = 0;
254
255         res->phase_state      = phase_building;
256         res->irg_pinned_state = op_pin_state_pinned;
257         res->fp_model         = fp_model_precise;
258
259         /* value table for global value numbering for optimizing use in iropt.c */
260         new_identities(res);
261         res->ent         = NULL;
262         res->frame_type  = NULL;
263
264         /* the Anchor node must be created first */
265         res->anchor = new_r_Anchor(res);
266
267         /* -- The end block -- */
268         end_block = new_r_Block_noopt(res, 0, NULL);
269         set_irg_end_block(res, end_block);
270         end = new_r_End(res, 0, NULL);
271         set_irg_end(res, end);
272
273         /* -- The start block -- */
274         start_block = new_r_Block_noopt(res, 0, NULL);
275         set_irg_start_block(res, start_block);
276         no_mem = new_r_NoMem(res);
277         set_irg_no_mem(res, no_mem);
278         start = new_r_Start(res);
279         set_irg_start(res, start);
280
281         /* Proj results of start node */
282         set_irg_initial_mem(res, new_r_Proj(start, mode_M, pn_Start_M));
283         projX = new_r_Proj(start, mode_X, pn_Start_X_initial_exec);
284
285         body_block = new_r_Block(res, 1, &projX);
286
287         set_r_cur_block(res, body_block);
288
289         /* Set the visited flag high enough that the blocks will never be visited. */
290         set_irn_visited(body_block, -1);
291         set_Block_block_visited(body_block, -1);
292         set_Block_block_visited(start_block, -1);
293         set_irn_visited(start_block, -1);
294
295         return res;
296 }
297
298 /**
299  * Pre-Walker: Copies blocks and nodes from the original method graph
300  * to the copied graph.
301  *
302  * @param n    A node from the original method graph.
303  * @param env  The copied graph.
304  */
305 static void copy_all_nodes(ir_node *node, void *env)
306 {
307         ir_graph *irg      = (ir_graph*)env;
308         ir_node  *new_node = irn_copy_into_irg(node, irg);
309
310         set_irn_link(node, new_node);
311
312         /* fix access to entities on the stack frame */
313         if (is_Sel(new_node)) {
314                 ir_entity *ent = get_Sel_entity(new_node);
315                 ir_type   *tp  = get_entity_owner(ent);
316
317                 if (is_frame_type(tp)) {
318                         /* replace by the copied entity */
319                         ent = (ir_entity*)get_entity_link(ent);
320
321                         assert(is_entity(ent));
322                         assert(get_entity_owner(ent) == get_irg_frame_type(irg));
323                         set_Sel_entity(new_node, ent);
324                 }
325         }
326 }
327
328 /**
329  * Post-walker: Set the predecessors of the copied nodes.
330  * The copied nodes are set as link of their original nodes. The links of
331  * "irn" predecessors are the predecessors of copied node.
332  */
333 static void rewire(ir_node *irn, void *env)
334 {
335         (void) env;
336         irn_rewire_inputs(irn);
337 }
338
339 static ir_node *get_new_node(const ir_node *old_node)
340 {
341         return (ir_node*) get_irn_link(old_node);
342 }
343
344 ir_graph *create_irg_copy(ir_graph *irg)
345 {
346         ir_graph *res;
347
348         res = alloc_graph();
349
350         res->n_loc = 0;
351         res->visited = 0;       /* visited flag, for the ir walker */
352         res->block_visited = 0; /* visited flag, for the 'block'-walker */
353         res->obst       = XMALLOC(struct obstack);
354         obstack_init(res->obst);
355         res->extbb_obst = NULL;
356
357         res->last_node_idx = 0;
358
359         res->phase_state      = irg->phase_state;
360         res->irg_pinned_state = irg->irg_pinned_state;
361         res->fp_model         = irg->fp_model;
362
363         new_identities(res);
364
365         /* clone the frame type here for safety */
366         irp_reserve_resources(irp, IRP_RESOURCE_ENTITY_LINK);
367         res->frame_type  = clone_frame_type(irg->frame_type);
368
369         res->phase_state = irg->phase_state;
370
371         ir_reserve_resources(irg, IR_RESOURCE_IRN_LINK);
372
373         /* copy all nodes from the graph irg to the new graph res */
374         irg_walk_anchors(irg, copy_all_nodes, rewire, res);
375
376         /* copy the Anchor node */
377         res->anchor = get_new_node(irg->anchor);
378
379         /* -- The end block -- */
380         set_irg_end_block (res, get_new_node(get_irg_end_block(irg)));
381         set_irg_end       (res, get_new_node(get_irg_end(irg)));
382
383         /* -- The start block -- */
384         set_irg_start_block(res, get_new_node(get_irg_start_block(irg)));
385         set_irg_no_mem     (res, get_new_node(get_irg_no_mem(irg)));
386         set_irg_start      (res, get_new_node(get_irg_start(irg)));
387
388         /* Proj results of start node */
389         set_irg_initial_mem(res, get_new_node(get_irg_initial_mem(irg)));
390
391         /* Copy the node count estimation. Would be strange if this
392            is different from the original one. */
393         res->estimated_node_count = irg->estimated_node_count;
394
395         ir_free_resources(irg, IR_RESOURCE_IRN_LINK);
396         irp_free_resources(irp, IRP_RESOURCE_ENTITY_LINK);
397
398         return res;
399 }
400
401 void free_ir_graph(ir_graph *irg)
402 {
403         assert(is_ir_graph(irg));
404
405         edges_deactivate(irg);
406
407         hook_free_graph(irg);
408         free_irg_outs(irg);
409         del_identities(irg);
410         if (irg->ent) {
411                 set_entity_irg(irg->ent, NULL);  /* not set in const code irg */
412         }
413
414         free_End(get_irg_end(irg));
415         obstack_free(irg->obst, NULL);
416         free(irg->obst);
417         if (irg->loc_descriptions)
418                 free(irg->loc_descriptions);
419         irg->kind = k_BAD;
420         free_graph(irg);
421 }
422
423 int (is_ir_graph)(const void *thing)
424 {
425         return is_ir_graph_(thing);
426 }
427
428 #ifdef DEBUG_libfirm
429 long get_irg_graph_nr(const ir_graph *irg)
430 {
431         return irg->graph_nr;
432 }
433 #else
434 long get_irg_graph_nr(const ir_graph *irg)
435 {
436         return PTR_TO_INT(irg);
437 }
438 #endif
439
440 size_t get_irg_idx(const ir_graph *irg)
441 {
442         return irg->index;
443 }
444
445 ir_node *(get_idx_irn)(const ir_graph *irg, unsigned idx)
446 {
447         return get_idx_irn_(irg, idx);
448 }
449
450 ir_node *(get_irg_start_block)(const ir_graph *irg)
451 {
452         return get_irg_start_block_(irg);
453 }
454
455 void (set_irg_start_block)(ir_graph *irg, ir_node *node)
456 {
457         set_irg_start_block_(irg, node);
458 }
459
460 ir_node *(get_irg_start)(const ir_graph *irg)
461 {
462         return get_irg_start_(irg);
463 }
464
465 void (set_irg_start)(ir_graph *irg, ir_node *node)
466 {
467         set_irg_start_(irg, node);
468 }
469
470 ir_node *(get_irg_end_block)(const ir_graph *irg)
471 {
472         return get_irg_end_block_(irg);
473 }
474
475 void (set_irg_end_block)(ir_graph *irg, ir_node *node)
476 {
477         set_irg_end_block_(irg, node);
478 }
479
480 ir_node *(get_irg_end)(const ir_graph *irg)
481 {
482         return get_irg_end_(irg);
483 }
484
485 void (set_irg_end)(ir_graph *irg, ir_node *node)
486 {
487         set_irg_end_(irg, node);
488 }
489
490 ir_node *(get_irg_initial_exec)(const ir_graph *irg)
491 {
492         return get_irg_initial_exec_(irg);
493 }
494
495 void (set_irg_initial_exec)(ir_graph *irg, ir_node *node)
496 {
497         set_irg_initial_exec_(irg, node);
498 }
499
500 ir_node *(get_irg_frame)(const ir_graph *irg)
501 {
502         return get_irg_frame_(irg);
503 }
504
505 void (set_irg_frame)(ir_graph *irg, ir_node *node)
506 {
507         set_irg_frame_(irg, node);
508 }
509
510 ir_node *(get_irg_initial_mem)(const ir_graph *irg)
511 {
512         return get_irg_initial_mem_(irg);
513 }
514
515 void (set_irg_initial_mem)(ir_graph *irg, ir_node *node)
516 {
517         set_irg_initial_mem_(irg, node);
518 }
519
520 ir_node *(get_irg_args)(const ir_graph *irg)
521 {
522         return get_irg_args_(irg);
523 }
524
525 void (set_irg_args)(ir_graph *irg, ir_node *node)
526 {
527         set_irg_args_(irg, node);
528 }
529
530 ir_node *(get_irg_no_mem)(const ir_graph *irg)
531 {
532         return get_irg_no_mem_(irg);
533 }
534
535 void (set_irg_no_mem)(ir_graph *irg, ir_node *node)
536 {
537         set_irg_no_mem_(irg, node);
538 }
539
540 ir_entity *(get_irg_entity)(const ir_graph *irg)
541 {
542         return get_irg_entity_(irg);
543 }
544
545 void (set_irg_entity)(ir_graph *irg, ir_entity *ent)
546 {
547         set_irg_entity_(irg, ent);
548 }
549
550 ir_type *(get_irg_frame_type)(ir_graph *irg)
551 {
552         return get_irg_frame_type_(irg);
553 }
554
555 void (set_irg_frame_type)(ir_graph *irg, ir_type *ftp)
556 {
557         set_irg_frame_type_(irg, ftp);
558 }
559
560 int get_irg_n_locs(ir_graph *irg)
561 {
562         return irg->n_loc - 1;
563 }
564
565 struct obstack *(get_irg_obstack)(const ir_graph *irg)
566 {
567         return get_irg_obstack_(irg);
568 }
569
570 int node_is_in_irgs_storage(const ir_graph *irg, const ir_node *n)
571 {
572         struct _obstack_chunk *p;
573
574         /*
575          * checks weather the ir_node pointer is on the obstack.
576          * A more sophisticated check would test the "whole" ir_node
577          */
578         for (p = irg->obst->chunk; p; p = p->prev) {
579                 if (((char *)p->contents <= (char *)n) && ((char *)n < (char *)p->limit))
580                         return 1;
581         }
582
583         return 0;
584 }
585
586 irg_phase_state (get_irg_phase_state)(const ir_graph *irg)
587 {
588         return get_irg_phase_state_(irg);
589 }
590
591 void (set_irg_phase_state)(ir_graph *irg, irg_phase_state state)
592 {
593         set_irg_phase_state_(irg, state);
594 }
595
596 op_pin_state (get_irg_pinned)(const ir_graph *irg)
597 {
598         return get_irg_pinned_(irg);
599 }
600
601 void (set_irg_pinned)(ir_graph *irg, op_pin_state p)
602 {
603         set_irg_pinned_(irg, p);
604 }
605
606 irg_callee_info_state (get_irg_callee_info_state)(const ir_graph *irg)
607 {
608         return get_irg_callee_info_state_(irg);
609 }
610
611 void (set_irg_callee_info_state)(ir_graph *irg, irg_callee_info_state s)
612 {
613         set_irg_callee_info_state_(irg, s);
614 }
615
616 irg_inline_property (get_irg_inline_property)(const ir_graph *irg)
617 {
618         return get_irg_inline_property_(irg);
619 }
620
621 void (set_irg_inline_property)(ir_graph *irg, irg_inline_property s)
622 {
623         set_irg_inline_property_(irg, s);
624 }
625
626 mtp_additional_properties (get_irg_additional_properties)(const ir_graph *irg)
627 {
628         return get_irg_additional_properties_(irg);
629 }
630
631 void (set_irg_additional_properties)(ir_graph *irg, mtp_additional_properties property_mask)
632 {
633         set_irg_additional_properties_(irg, property_mask);
634 }
635
636 void (add_irg_additional_properties)(ir_graph *irg, mtp_additional_properties flag)
637 {
638         add_irg_additional_properties_(irg, flag);
639 }
640
641 void (set_irg_link)(ir_graph *irg, void *thing)
642 {
643         set_irg_link_(irg, thing);
644 }
645
646 void *(get_irg_link)(const ir_graph *irg)
647 {
648         return get_irg_link_(irg);
649 }
650
651 ir_visited_t (get_irg_visited)(const ir_graph *irg)
652 {
653         return get_irg_visited_(irg);
654 }
655
656 /** maximum visited flag content of all ir_graph visited fields. */
657 static ir_visited_t max_irg_visited = 0;
658
659 void set_irg_visited(ir_graph *irg, ir_visited_t visited)
660 {
661         irg->visited = visited;
662         if (irg->visited > max_irg_visited) {
663                 max_irg_visited = irg->visited;
664         }
665 }
666
667 void inc_irg_visited(ir_graph *irg)
668 {
669         ++irg->visited;
670         if (irg->visited > max_irg_visited) {
671                 max_irg_visited = irg->visited;
672         }
673 }
674
675 ir_visited_t get_max_irg_visited(void)
676 {
677         return max_irg_visited;
678 }
679
680 void set_max_irg_visited(int val)
681 {
682         max_irg_visited = val;
683 }
684
685 ir_visited_t inc_max_irg_visited(void)
686 {
687 #ifndef NDEBUG
688         size_t i;
689         for (i = 0; i < get_irp_n_irgs(); i++)
690                 assert(max_irg_visited >= get_irg_visited(get_irp_irg(i)));
691 #endif
692         return ++max_irg_visited;
693 }
694
695 ir_visited_t (get_irg_block_visited)(const ir_graph *irg)
696 {
697         return get_irg_block_visited_(irg);
698 }
699
700 void (set_irg_block_visited)(ir_graph *irg, ir_visited_t visited)
701 {
702         set_irg_block_visited_(irg, visited);
703 }
704
705 void (inc_irg_block_visited)(ir_graph *irg)
706 {
707   inc_irg_block_visited_(irg);
708 }
709
710 unsigned (get_irg_fp_model)(const ir_graph *irg)
711 {
712         return get_irg_fp_model_(irg);
713 }
714
715 void set_irg_fp_model(ir_graph *irg, unsigned model)
716 {
717         irg->fp_model = model;
718 }
719
720 void set_irg_loc_description(ir_graph *irg, int n, void *description)
721 {
722         assert(0 <= n && n < irg->n_loc);
723
724         if (! irg->loc_descriptions)
725                 irg->loc_descriptions = XMALLOCNZ(void*, irg->n_loc);
726
727         irg->loc_descriptions[n] = description;
728 }
729
730 void *get_irg_loc_description(ir_graph *irg, int n)
731 {
732         assert(0 <= n && n < irg->n_loc);
733         return irg->loc_descriptions ? irg->loc_descriptions[n] : NULL;
734 }
735
736 #ifndef NDEBUG
737 void ir_reserve_resources(ir_graph *irg, ir_resources_t resources)
738 {
739         assert((irg->reserved_resources & resources) == 0);
740         irg->reserved_resources |= resources;
741 }
742
743 void ir_free_resources(ir_graph *irg, ir_resources_t resources)
744 {
745         assert((irg->reserved_resources & resources) == resources);
746         irg->reserved_resources &= ~resources;
747 }
748
749 ir_resources_t ir_resources_reserved(const ir_graph *irg)
750 {
751         return irg->reserved_resources;
752 }
753 #endif
754
755 unsigned (get_irg_estimated_node_cnt)(const ir_graph *irg)
756 {
757         return get_irg_estimated_node_cnt_(irg);
758 }
759
760 unsigned get_irg_last_idx(const ir_graph *irg)
761 {
762         return irg->last_node_idx;
763 }
764
765 size_t register_additional_graph_data(size_t size)
766 {
767         assert(!forbid_new_data && "Too late to register additional node data");
768
769         if (forbid_new_data)
770                 return 0;
771
772         return additional_graph_data_size += size;
773 }
774
775 void (set_irg_state)(ir_graph *irg, ir_graph_state_t state)
776 {
777         set_irg_state_(irg, state);
778 }
779
780 void (clear_irg_state)(ir_graph *irg, ir_graph_state_t state)
781 {
782         clear_irg_state_(irg, state);
783 }
784
785 int (is_irg_state)(const ir_graph *irg, ir_graph_state_t state)
786 {
787         return is_irg_state_(irg, state);
788 }