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