961857c3514aee13fcf044fba6e551333024d3bb
[libfirm] / ir / ir / irprog.h
1 /* Copyright (C) 2000 by Universitaet Karlsruhe
2 ** All rights reserved.
3 **
4 ** Authors: Goetz Lindenmaier
5 **
6 ** irprog.h: ir representation of a program
7 **
8 ** This file defines a construct that keeps all information about a
9 ** program:
10 **   - A list of all procedures.
11 **   - A list of all types.
12 **   - A global type that can be thought of as a god-class containing all
13 **     global variables and procedures.  This is not the base class of
14 **     all classes in a class hierarchy (as, e.g., "object" in java).
15 **   - An obstack containing global things, e.g., the above mentioned lists.
16 */
17
18 # ifndef _IRPROG_H_
19 # define _IRPROG_H_
20
21 # include "irnode.h"
22 # include "type.h"
23 /*# include "obst.h"*/
24
25 typedef struct ir_prog {
26   firm_kind kind;
27   ir_graph **graphs;               /* all graphs in the ir */
28   type **types;                    /* all types in the ir */
29   type_class *glob_type;           /* global type.  Class as it can have
30                                       fields and procedures.  Does this work?
31                                       Better name??? @@@ */
32   /*struct obstack *obst;                  * @@@ Should we place all types and entities themselves
33                                       on an obstack, too?  */
34 } ir_prog;
35
36 /* A variable from where everything in the ir can be accessed. */
37 ir_prog *irp;
38
39 /* initializes ir_prog. Calles the constructor for an ir_prog. */
40 void init_irprog(void);
41
42 /* Creates a new ir_prog, returns it and sets irp with it.
43    Automatically called by init_firm through init_prog. */
44 ir_prog *new_ir_prog (void);
45
46
47 /** Functions to access the fields of ir_prog **/
48 type_class *get_glob_type(void);
49
50 /* Adds irg to the list of ir graphs in irp. */
51 void      add_irp_irg(ir_graph *irg);
52 /* Adds type to the list of types in irp. */
53 void      add_irp_type(type *typ);
54
55 #endif /* ifndef _IRPROG_H_ */