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