fixed lost line
[libfirm] / ir / ir / irgraph.c
1 /*
2  * Project:     libFIRM
3  * File name:   ir/ir/irgraph.c
4  * Purpose:     Entry point to the representation of procedure code.
5  * Author:      Martin Trapp, Christian Schaefer
6  * Modified by: Goetz Lindenmaier
7  * Created:
8  * CVS-ID:      $Id$
9  * Copyright:   (c) 1998-2003 Universität Karlsruhe
10  * Licence:     This file protected by GPL -  GNU GENERAL PUBLIC LICENSE.
11  */
12
13 #ifdef HAVE_CONFIG_H
14 # include "config.h"
15 #endif
16
17 #ifdef HAVE_STRING_H
18 # include <string.h>
19 #endif
20
21 #include <stddef.h>
22
23 # include "xmalloc.h"
24 # include "ircons.h"
25 # include "irgraph_t.h"
26 # include "irprog_t.h"
27 # include "irnode_t.h"
28 # include "iropt_t.h"
29 # include "irflag_t.h"
30 # include "array.h"
31 # include "irgmod.h"
32 # include "mangle.h"
33 # include "irouts.h"
34 # include "irhooks.h"
35 # include "irgwalk.h"
36 # include "iredges_t.h"
37
38 /**
39  * Indicates, whether additional data can be registered to graphs.
40  * If set to 1, this is not possible anymore.
41  */
42 static int forbid_new_data = 0;
43
44 /**
45  * The amount of additional space for custom data to be allocated upon
46  * creating a new graph.
47  */
48 static size_t additional_graph_data_size = 0;
49
50 ir_graph *current_ir_graph;
51 ir_graph *get_current_ir_graph(void) {
52   return current_ir_graph;
53 }
54 void set_current_ir_graph(ir_graph *graph) {
55   current_ir_graph = graph;
56 }
57
58
59 int __interprocedural_view = false;
60
61 int (get_interprocedural_view)(void) {
62   return _get_interprocedural_view();
63 }
64
65 void (set_interprocedural_view)(int state) {
66   __interprocedural_view = state;
67
68   /* set function vectors for faster access */
69   if (state) {
70     _get_irn_arity = _get_irn_inter_arity;
71     _get_irn_n     = _get_irn_inter_n;
72   }
73   else {
74     _get_irn_arity = _get_irn_intra_arity;
75     _get_irn_n     = _get_irn_intra_n;
76   }
77 }
78
79 /** contains the suffix for frame type names */
80 static ident *frame_type_suffix = NULL;
81
82 /* initialize the IR graph module */
83 void init_irgraph(void) {
84   frame_type_suffix = new_id_from_str(FRAME_TP_SUFFIX);
85         forbid_new_data = 1;
86 }
87
88 /**
89  * Allocate a new IR graph.
90  * This function respects the registered graph data. The only reason for
91  * this function is, that there are two locations, where graphs are
92  * allocated (new_r_ir_graph, new_const_code_irg).
93  * @return Memory for a new graph.
94  */
95 static ir_graph *alloc_graph(void)
96 {
97         size_t size = sizeof(ir_graph) + additional_graph_data_size;
98         char *ptr = xmalloc(size);
99         memset(ptr, 0, size);
100
101         return (ir_graph *) (ptr + additional_graph_data_size);
102 }
103
104 #if USE_EXPLICIT_PHI_IN_STACK
105 /* really defined in ircons.c */
106 typedef struct Phi_in_stack Phi_in_stack;
107 Phi_in_stack *new_Phi_in_stack();
108 void free_Phi_in_stack(Phi_in_stack *s);
109 #endif
110
111 /* Allocates a list of nodes:
112     - The start block containing a start node and Proj nodes for it's four
113       results (X, M, P, Tuple).
114     - The end block containing an end node. This block is not matured after
115       new_ir_graph as predecessors need to be added to it.
116     - The current block, which is empty and also not matured.
117    Further it allocates several datastructures needed for graph construction
118    and optimization.
119 */
120 ir_graph *
121 new_r_ir_graph (entity *ent, int n_loc)
122 {
123   ir_graph *res;
124   ir_node *first_block;
125   ir_node *projX;
126
127   res = alloc_graph();
128   res->kind = k_ir_graph;
129
130   edges_init_graph(res);
131
132   /* inform statistics here, as blocks will be already build on this graph */
133   hook_new_graph(res, ent);
134
135   current_ir_graph = res;
136
137   /*-- initialized for each graph. --*/
138   if (get_opt_precise_exc_context()) {
139     res->n_loc = n_loc + 1 + 1; /* number of local variables that are never
140                    dereferenced in this graph plus one for
141                    the store plus one for links to fragile
142                    operations.  n_loc is not the number of
143                    parameters to the procedure!  */
144   }
145   else {
146     res->n_loc = n_loc + 1;  /* number of local variables that are never
147                 dereferenced in this graph plus one for
148                 the store. This is not the number of parameters
149                 to the procedure!  */
150   }
151
152   /* descriptions will be allocated on demand */
153   res->loc_descriptions = NULL;
154
155   res->visited       = 0; /* visited flag, for the ir walker */
156   res->block_visited = 0; /* visited flag, for the 'block'-walker */
157
158 #if USE_EXPLICIT_PHI_IN_STACK
159   res->Phi_in_stack = new_Phi_in_stack();  /* A stack needed for automatic Phi
160                                 generation */
161 #endif
162   res->kind = k_ir_graph;
163   res->obst = xmalloc (sizeof(*res->obst));
164   obstack_init (res->obst);
165   res->value_table = new_identities (); /* value table for global value
166                        numbering for optimizing use in
167                        iropt.c */
168   res->outs = NULL;
169
170   res->phase_state    = phase_building;
171   res->op_pin_state_pinned = op_pin_state_pinned;
172   res->outs_state     = outs_none;
173   res->dom_state      = dom_none;
174   res->typeinfo_state = irg_typeinfo_none;
175   res->loopinfo_state = loopinfo_none;
176
177   /*-- Type information for the procedure of the graph --*/
178   res->ent = ent;
179   set_entity_irg(ent, res);
180
181   /*--  a class type so that it can contain "inner" methods as in Pascal. --*/
182   res->frame_type = new_type_class(mangle(get_entity_ident(ent), frame_type_suffix));
183
184   /* Remove type from type list.  Must be treated differently than other types. */
185   remove_irp_type_from_list(res->frame_type);
186
187   /*-- Nodes needed in every graph --*/
188   res->end_block  = new_immBlock();
189   res->end        = new_End();
190   res->end_reg    = res->end;
191   res->end_except = res->end;
192
193   res->start_block = new_immBlock();
194   res->start   = new_Start();
195   res->bad     = new_ir_node(NULL, res, res->start_block, op_Bad, mode_T, 0, NULL);
196   res->no_mem  = new_ir_node(NULL, res, res->start_block, op_NoMem, mode_M, 0, NULL);
197
198   /* Proj results of start node */
199   projX            = new_Proj (res->start, mode_X, pn_Start_X_initial_exec);
200   res->frame       = new_Proj (res->start, mode_P_mach, pn_Start_P_frame_base);
201   res->globals     = new_Proj (res->start, mode_P_mach, pn_Start_P_globals);
202   res->initial_mem = new_Proj (res->start, mode_M, pn_Start_M);
203   res->args        = new_Proj (res->start, mode_T, pn_Start_T_args);
204 #ifdef DEBUG_libfirm
205   res->graph_nr    = get_irp_new_node_nr();
206 #endif
207   res->proj_args   = NULL;
208
209   set_store(res->initial_mem);
210
211   add_immBlock_pred(res->start_block, projX);
212   /*
213    * The code generation needs it. leave it in now.
214    * Use of this edge is matter of discussion, unresolved. Also possible:
215    * add_immBlock_pred(res->start_block, res->start_block), but invalid typed.
216    */
217   mature_immBlock (res->current_block);
218
219   /*-- Make a block to start with --*/
220   first_block = new_immBlock();
221   add_immBlock_pred (first_block, projX);
222
223   res->method_execution_frequency = -1;
224
225   return res;
226 }
227
228
229 ir_graph *
230 new_ir_graph (entity *ent, int n_loc)
231 {
232   ir_graph *res = new_r_ir_graph (ent, n_loc);
233   add_irp_irg(res);          /* remember this graph global. */
234   return res;
235 }
236
237 /* Make a rudimentary ir graph for the constant code.
238    Must look like a correct irg, spare everything else. */
239 ir_graph *new_const_code_irg(void) {
240   ir_graph *res;
241   ir_node *projX;
242
243   res = alloc_graph();
244
245   /* inform statistics here, as blocks will be already build on this graph */
246   hook_new_graph(res, NULL);
247
248   current_ir_graph = res;
249   res->n_loc = 1;       /* Only the memory. */
250   res->visited = 0;     /* visited flag, for the ir walker */
251   res->block_visited=0; /* visited flag, for the 'block'-walker */
252 #if USE_EXPLICIT_PHI_IN_STACK
253   res->Phi_in_stack = NULL;
254 #endif
255   res->kind = k_ir_graph;
256   res->obst      = xmalloc (sizeof(*res->obst));
257   obstack_init (res->obst);
258   res->phase_state = phase_building;
259   res->op_pin_state_pinned = op_pin_state_pinned;
260   res->value_table = new_identities (); /* value table for global value
261                        numbering for optimizing use in
262                        iropt.c */
263   res->ent = NULL;
264   res->frame_type  = NULL;
265
266   /* -- The end block -- */
267   res->end_block  = new_immBlock ();
268   res->end        = new_End ();
269   res->end_reg    = res->end;
270   res->end_except = res->end;
271   mature_immBlock(get_cur_block());  /* mature the end block */
272
273   /* -- The start block -- */
274   res->start_block = new_immBlock ();
275   res->bad     = new_ir_node (NULL, res, res->start_block, op_Bad, mode_T, 0, NULL);
276   res->no_mem  = new_ir_node (NULL, res, res->start_block, op_NoMem, mode_M, 0, NULL);
277   res->start   = new_Start ();
278   /* Proj results of start node */
279   res->initial_mem = new_Proj (res->start, mode_M, pn_Start_M);
280   projX            = new_Proj (res->start, mode_X, pn_Start_X_initial_exec);
281   add_immBlock_pred (res->start_block, projX);
282   mature_immBlock   (res->start_block);  /* mature the start block */
283
284   add_immBlock_pred (new_immBlock (), projX);
285   mature_immBlock   (get_cur_block());   /* mature the 'body' block for expressions */
286
287   /* Set the visited flag high enough that the blocks will never be visited. */
288   set_irn_visited(get_cur_block(), -1);
289   set_Block_block_visited(get_cur_block(), -1);
290   set_Block_block_visited(res->start_block, -1);
291   set_irn_visited(res->start_block, -1);
292   set_irn_visited(res->bad, -1);
293   set_irn_visited(res->no_mem, -1);
294
295   res->phase_state = phase_high;
296
297   return res;
298 }
299
300 /* Defined in iropt.c */
301 void  del_identities (pset *value_table);
302
303 /* Frees the passed irgraph.
304    Deallocates all nodes in this graph and the ir_graph structure.
305    Sets the field irgraph in the corresponding entity to NULL.
306    Does not remove the irgraph from the list in irprog (requires
307    inefficient search, call remove_irp_irg by hand).
308    Does not free types, entities or modes that are used only by this
309    graph, nor the entity standing for this graph. */
310 void free_ir_graph (ir_graph *irg) {
311
312   hook_free_graph(irg);
313   if (irg->outs_state != outs_none) free_outs(irg);
314   if (irg->frame_type)  free_type(irg->frame_type);
315   if (irg->value_table) del_identities(irg->value_table);
316   if (irg->ent) {
317     peculiarity pec = get_entity_peculiarity (irg->ent);
318     set_entity_peculiarity (irg->ent, peculiarity_description);
319     set_entity_irg(irg->ent, NULL);  /* not set in const code irg */
320     set_entity_peculiarity (irg->ent, pec);
321   }
322
323   free_End(irg->end);
324   obstack_free(irg->obst,NULL);
325   free(irg->obst);
326 #if USE_EXPLICIT_PHI_IN_STACK
327   free_Phi_in_stack(irg->Phi_in_stack);
328 #endif
329   if (irg->loc_descriptions)
330     free(irg->loc_descriptions);
331   irg->kind = k_BAD;
332   free(irg);
333 }
334
335 /* access routines for all ir_graph attributes:
336    templates:
337    {attr type} get_irg_{attribute name} (ir_graph *irg);
338    void set_irg_{attr name} (ir_graph *irg, {attr type} {attr}); */
339
340 int
341 (is_ir_graph)(const void *thing) {
342   return _is_ir_graph(thing);
343 }
344
345 /* Outputs a unique number for this node */
346
347 long
348 get_irg_graph_nr(ir_graph *irg) {
349   assert(irg);
350 #ifdef DEBUG_libfirm
351   return irg->graph_nr;
352 #else
353   return (long)irg;
354 #endif
355 }
356
357 ir_node *
358 (get_irg_start_block)(const ir_graph *irg) {
359   return _get_irg_start_block(irg);
360 }
361
362 void
363 (set_irg_start_block)(ir_graph *irg, ir_node *node) {
364   _set_irg_start_block(irg, node);
365 }
366
367 ir_node *
368 (get_irg_start)(const ir_graph *irg) {
369   return _get_irg_start(irg);
370 }
371
372 void
373 (set_irg_start)(ir_graph *irg, ir_node *node) {
374   _set_irg_start(irg, node);
375 }
376
377 ir_node *
378 (get_irg_end_block)(const ir_graph *irg) {
379   return _get_irg_end_block(irg);
380 }
381
382 void
383 (set_irg_end_block)(ir_graph *irg, ir_node *node) {
384   _set_irg_end_block(irg, node);
385 }
386
387 ir_node *
388 (get_irg_end)(const ir_graph *irg) {
389   return _get_irg_end(irg);
390 }
391
392 void
393 (set_irg_end)(ir_graph *irg, ir_node *node) {
394   _set_irg_end(irg, node);
395 }
396
397 ir_node *
398 (get_irg_end_reg)(const ir_graph *irg) {
399   return _get_irg_end_reg(irg);
400 }
401
402 void     set_irg_end_reg (ir_graph *irg, ir_node *node) {
403   assert(get_irn_op(node) == op_EndReg || get_irn_op(node) == op_End);
404   irg->end_reg = node;
405 }
406
407 ir_node *
408 (get_irg_end_except)(const ir_graph *irg) {
409   return _get_irg_end_except(irg);
410 }
411
412 void     set_irg_end_except (ir_graph *irg, ir_node *node) {
413   assert(get_irn_op(node) == op_EndExcept || get_irn_op(node) == op_End);
414   irg->end_except = node;
415 }
416
417 ir_node *
418 (get_irg_cstore)(const ir_graph *irg) {
419   return _get_irg_cstore(irg);
420 }
421
422 void
423 (set_irg_cstore)(ir_graph *irg, ir_node *node) {
424   _set_irg_cstore(irg, node);
425 }
426
427 ir_node *
428 (get_irg_frame)(const ir_graph *irg) {
429   return _get_irg_frame(irg);
430 }
431
432 void
433 (set_irg_frame)(ir_graph *irg, ir_node *node) {
434   _set_irg_frame(irg, node);
435 }
436
437 ir_node *
438 (get_irg_globals)(const ir_graph *irg) {
439   return _get_irg_globals(irg);
440 }
441
442 void
443 (set_irg_globals)(ir_graph *irg, ir_node *node) {
444   _set_irg_globals(irg, node);
445 }
446
447 ir_node *
448 (get_irg_initial_mem)(const ir_graph *irg) {
449   return _get_irg_initial_mem(irg);
450 }
451
452 void
453 (set_irg_initial_mem)(ir_graph *irg, ir_node *node) {
454   _set_irg_initial_mem(irg, node);
455 }
456
457 ir_node *
458 (get_irg_args)(const ir_graph *irg) {
459   return _get_irg_args(irg);
460 }
461
462 void
463 (set_irg_args)(ir_graph *irg, ir_node *node) {
464   _set_irg_args(irg, node);
465 }
466
467 ir_node **
468 (get_irg_proj_args) (const ir_graph *irg) {
469   return _get_irg_proj_args (irg);
470 }
471
472 void
473 (set_irg_proj_args) (ir_graph *irg, ir_node **nodes) {
474   _set_irg_proj_args (irg, nodes);
475 }
476
477 ir_node *
478 (get_irg_bad)(const ir_graph *irg) {
479   return _get_irg_bad(irg);
480 }
481
482 void
483 (set_irg_bad)(ir_graph *irg, ir_node *node) {
484   _set_irg_bad(irg, node);
485 }
486
487 ir_node *
488 (get_irg_no_mem)(const ir_graph *irg) {
489   return _get_irg_no_mem(irg);
490 }
491
492 void
493 (set_irg_no_mem)(ir_graph *irg, ir_node *node) {
494   _set_irg_no_mem(irg, node);
495 }
496
497 ir_node *
498 (get_irg_current_block)(const ir_graph *irg) {
499   return _get_irg_current_block(irg);
500 }
501
502 void
503 (set_irg_current_block)(ir_graph *irg, ir_node *node) {
504   _set_irg_current_block(irg, node);
505 }
506
507 entity *
508 (get_irg_entity)(const ir_graph *irg) {
509   return _get_irg_entity(irg);
510 }
511
512 void
513 (set_irg_entity)(ir_graph *irg, entity *ent) {
514   _set_irg_entity(irg, ent);
515 }
516
517 type *
518 (get_irg_frame_type)(const ir_graph *irg) {
519   return _get_irg_frame_type(irg);
520 }
521
522 void
523 (set_irg_frame_type)(ir_graph *irg, type *ftp) {
524   _set_irg_frame_type(irg, ftp);
525 }
526
527
528 /* To test for a frame type */
529 int
530 is_frame_type(const type *ftp) {
531   int i;
532   if (is_Class_type(ftp)) {
533     for (i = 0; i < get_irp_n_irgs(); i++) {
534       const type *frame_tp = get_irg_frame_type(get_irp_irg(i));
535       if (ftp == frame_tp) return true;
536     }
537   }
538   return false;
539 }
540
541 int
542 get_irg_n_locs (ir_graph *irg)
543 {
544   if (get_opt_precise_exc_context())
545     return irg->n_loc - 1 - 1;
546   else
547     return irg->n_loc - 1;
548 }
549
550 void
551 set_irg_n_loc (ir_graph *irg, int n_loc)
552 {
553   if (get_opt_precise_exc_context())
554     irg->n_loc = n_loc + 1 + 1;
555   else
556     irg->n_loc = n_loc + 1;
557 }
558
559
560
561 /* Returns the obstack associated with the graph. */
562 struct obstack *
563 (get_irg_obstack)(const ir_graph *irg) {
564   return _get_irg_obstack(irg);
565 }
566
567 /*
568  * Returns true if the node n is allocated on the storage of graph irg.
569  *
570  * Implementation is GLIBC specific as is uses the internal _obstack_chunk implementation.
571  */
572 int node_is_in_irgs_storage(ir_graph *irg, ir_node *n)
573 {
574   struct _obstack_chunk *p;
575
576   /*
577    * checks weather the ir_node pointer is on the obstack.
578    * A more sophisticated check would test the "whole" ir_node
579    */
580   for (p = irg->obst->chunk; p; p = p->prev) {
581     if (((char *)p->contents <= (char *)n) && ((char *)n < (char *)p->limit))
582       return 1;
583   }
584
585   return 0;
586 }
587
588 irg_phase_state
589 (get_irg_phase_state)(const ir_graph *irg) {
590   return _get_irg_phase_state(irg);
591 }
592
593 void
594 (set_irg_phase_low)(ir_graph *irg) {
595   _set_irg_phase_low(irg);
596 }
597
598 op_pin_state
599 (get_irg_pinned)(const ir_graph *irg) {
600   return _get_irg_pinned(irg);
601 }
602
603 irg_outs_state
604 (get_irg_outs_state)(const ir_graph *irg) {
605   return _get_irg_outs_state(irg);
606 }
607
608 void
609 (set_irg_outs_inconsistent)(ir_graph *irg) {
610   _set_irg_outs_inconsistent(irg);
611 }
612
613 irg_dom_state
614 (get_irg_dom_state)(const ir_graph *irg) {
615   return _get_irg_dom_state(irg);
616 }
617
618 void
619 (set_irg_dom_inconsistent)(ir_graph *irg) {
620   _set_irg_dom_inconsistent(irg);
621 }
622
623 irg_loopinfo_state
624 (get_irg_loopinfo_state)(const ir_graph *irg) {
625   return _get_irg_loopinfo_state(irg);
626 }
627
628 void
629 (set_irg_loopinfo_state)(ir_graph *irg, irg_loopinfo_state s) {
630   _set_irg_loopinfo_state(irg, s);
631 }
632
633 void
634 set_irg_loopinfo_inconsistent(ir_graph *irg) {
635   if (irg->loopinfo_state == loopinfo_ip_consistent)
636     irg->loopinfo_state = loopinfo_ip_inconsistent;
637
638   else if (irg->loopinfo_state == loopinfo_consistent)
639     irg->loopinfo_state = loopinfo_inconsistent;
640
641   else if (irg->loopinfo_state == loopinfo_cf_ip_consistent)
642     irg->loopinfo_state = loopinfo_cf_ip_inconsistent;
643
644   else if (irg->loopinfo_state == loopinfo_cf_consistent)
645     irg->loopinfo_state = loopinfo_cf_inconsistent;
646 }
647
648 void
649 (set_irg_pinned)(ir_graph *irg, op_pin_state p) {
650   _set_irg_pinned(irg, p);
651 }
652
653 irg_callee_info_state
654 (get_irg_callee_info_state)(const ir_graph *irg) {
655   return _get_irg_callee_info_state(irg);
656 }
657
658 void
659 (set_irg_callee_info_state)(ir_graph *irg, irg_callee_info_state s) {
660   _set_irg_callee_info_state(irg, s);
661 }
662
663 irg_inline_property
664 (get_irg_inline_property)(const ir_graph *irg) {
665   return _get_irg_inline_property(irg);
666 }
667
668 void
669 (set_irg_inline_property)(ir_graph *irg, irg_inline_property s) {
670   _set_irg_inline_property(irg, s);
671 }
672
673 void
674 (set_irg_link)(ir_graph *irg, void *thing) {
675   _set_irg_link(irg, thing);
676 }
677
678 void *
679 (get_irg_link)(const ir_graph *irg) {
680   return _get_irg_link(irg);
681 }
682
683 /** maximum visited flag content of all ir_graph visited fields. */
684 static unsigned long max_irg_visited = 0;
685
686 unsigned long
687 (get_irg_visited)(const ir_graph *irg) {
688   return _get_irg_visited(irg);
689 }
690
691 void
692 set_irg_visited (ir_graph *irg, unsigned long visited)
693 {
694   irg->visited = visited;
695   if (irg->visited > max_irg_visited) {
696     max_irg_visited = irg->visited;
697   }
698 }
699
700 void
701 inc_irg_visited (ir_graph *irg)
702 {
703   if (++irg->visited > max_irg_visited) {
704     max_irg_visited = irg->visited;
705   }
706 }
707
708 unsigned long
709 get_max_irg_visited(void)
710 {
711   /*
712   int i;
713   for(i = 0; i < get_irp_n_irgs(); i++)
714   assert(max_irg_visited >= get_irg_visited(get_irp_irg(i)));
715    */
716   return max_irg_visited;
717 }
718
719 void set_max_irg_visited(int val) {
720   max_irg_visited = val;
721 }
722
723 unsigned long
724 inc_max_irg_visited(void)
725 {
726   /*
727   int i;
728   for(i = 0; i < get_irp_n_irgs(); i++)
729   assert(max_irg_visited >= get_irg_visited(get_irp_irg(i)));
730   */
731   max_irg_visited++;
732   return max_irg_visited;
733 }
734
735 unsigned long
736 (get_irg_block_visited)(const ir_graph *irg) {
737   return _get_irg_block_visited(irg);
738 }
739
740 void
741 (set_irg_block_visited)(ir_graph *irg, unsigned long visited) {
742   _set_irg_block_visited(irg, visited);
743 }
744
745 void
746 (inc_irg_block_visited)(ir_graph *irg) {
747   _inc_irg_block_visited(irg);
748 }
749
750
751 /**
752  * walker Start->End: places Proj nodes into the same block
753  * as it's predecessors
754  *
755  * @param n    the node
756  * @param env  ignored
757  */
758 static void normalize_proj_walker(ir_node *n, void *env)
759 {
760   if (is_Proj(n)) {
761     ir_node *pred  = get_Proj_pred(n);
762     ir_node *block = get_nodes_block(pred);
763
764     set_nodes_block(n, block);
765   }
766 }
767
768 /* move Proj nodes into the same block as its predecessors */
769 void normalize_proj_nodes(ir_graph *irg)
770 {
771   irg_walk_graph(irg, NULL, normalize_proj_walker, NULL);
772   set_irg_outs_inconsistent(irg);
773 }
774
775 /* set a description for local value n */
776 void set_irg_loc_description(ir_graph *irg, int n, void *description)
777 {
778   assert(0 <= n && n < irg->n_loc);
779
780   if (! irg->loc_descriptions)
781     irg->loc_descriptions = xcalloc(sizeof(*irg->loc_descriptions), irg->n_loc);
782
783   irg->loc_descriptions[n] = description;
784 }
785
786 /* get the description for local value n */
787 void *get_irg_loc_description(ir_graph *irg, int n)
788 {
789   assert(0 <= n && n < irg->n_loc);
790   return irg->loc_descriptions ? irg->loc_descriptions[n] : NULL;
791 }
792
793 /* register additional space in an IR graph */
794 size_t register_additional_graph_data(size_t size)
795 {
796   assert(!forbid_new_data && "Too late to register additional node data");
797
798   if (forbid_new_data)
799     return 0;
800
801   return additional_graph_data_size += size;
802 }