*** empty log message ***
[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
24 /***** irprog/irprog
25  *
26  * NAME  Datastructure that holds central information about a program
27  *
28  * NOTE  Preliminary documentation ;-)
29  *
30  * SOURCE
31  */
32 typedef struct ir_prog ir_prog;
33
34 /* A variable from where everything in the ir can be accessed. */
35 extern ir_prog *irp;
36
37 /* initializes ir_prog. Calles the constructor for an ir_prog. */
38 void init_irprog(void);
39
40 /* Creates a new ir_prog, returns it and sets irp with it.
41    Automatically called by init_firm through init_irprog. */
42 ir_prog *new_ir_prog (void);
43
44 /* Access the main routine of the compiled program. */
45 ir_graph *get_irp_main_irg();
46 void      set_irp_main_irg(ir_graph *main_irg);
47
48 /* Adds irg to the list of ir graphs in irp. */
49 void      add_irp_irg(ir_graph *irg);
50 int       get_irp_n_irgs();
51 ir_graph *get_irp_irg(int pos);
52 void      set_irp_irg(int pos, ir_graph *irg);
53
54 /* Adds type to the list of types in irp. */
55 void  add_irp_type(type *typ);
56 int   get_irp_n_types();
57 type *get_irp_type(int pos);
58 void  set_irp_type(int pos, type *typ);
59
60 /** Functions to access the fields of ir_prog **/
61 type *get_glob_type(void);
62
63 #ifdef DEBUG_libfirm
64 /* Returns a new, unique number to number nodes or the like. */
65 int get_irp_new_node_nr();
66 #endif
67 /*****/
68
69 #endif /* ifndef _IRPROG_H_ */