1 /* Copyright (C) 2000 by Universitaet Karlsruhe
2 ** All rights reserved.
4 ** Authors: Goetz Lindenmaier
6 ** irprog.h: ir representation of a program
8 ** This file defines a construct that keeps all information about a
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.)
23 /*# include "obst.h"*/
27 ir_graph *main_irg; /* entry point to the compiled program */
28 /* or a list, in case we compile a library or the like? */
29 ir_graph **graphs; /* all graphs in the ir */
30 type **types; /* all types in the ir */
31 type_class *glob_type; /* global type. Class as it can have
32 fields and procedures. Does this work?
34 /*struct obstack *obst; * @@@ Should we place all types and
35 entities on an obstack, too? */
37 long max_node_nr; /* to generate unique numbers for nodes. */
41 typedef struct ir_prog ir_prog;
43 /* A variable from where everything in the ir can be accessed. */
47 /* initializes ir_prog. Calles the constructor for an ir_prog. */
48 void init_irprog(void);
50 /* Creates a new ir_prog, returns it and sets irp with it.
51 Automatically called by init_firm through init_irprog. */
52 ir_prog *new_ir_prog (void);
54 /* Access the main routine of the compiled program. */
55 ir_graph *get_irp_main_irg();
56 void set_irp_main_irg(ir_graph *main_irg);
58 /* Adds irg to the list of ir graphs in irp. */
59 void add_irp_irg(ir_graph *irg);
61 ir_graph *get_irp_irg(int pos);
62 /* set_irp_irg() und das gleiche fuer type */
64 /* Adds type to the list of types in irp. */
65 void add_irp_type(type *typ);
67 /** Functions to access the fields of ir_prog **/
68 type_class *get_glob_type(void);
71 /* Returns a new, unique number to number nodes or the like. */
72 int get_irp_new_node_nr();
75 #endif /* ifndef _IRPROG_H_ */