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.)
26 * NAME Datastructure that holds central information about a program
28 * NOTE Preliminary documentation ;-)
35 * NAME Datastructure that holds central information about a program
37 * NOTE Preliminary documentation ;-)
40 * type A list containing all types known to the translated program.
41 * Some types can have several entries in this list (as a result of
42 * using exchange_types()).
46 typedef struct ir_prog ir_prog;
48 /* A variable from where everything in the ir can be accessed. */
51 /* initializes ir_prog. Calles the constructor for an ir_prog. */
52 void init_irprog(void);
54 /* Creates a new ir_prog, returns it and sets irp with it.
55 Automatically called by init_firm through init_irprog. */
56 ir_prog *new_ir_prog (void);
58 /* Access the main routine of the compiled program. */
59 ir_graph *get_irp_main_irg();
60 void set_irp_main_irg(ir_graph *main_irg);
62 /* Adds irg to the list of ir graphs in irp. */
63 void add_irp_irg(ir_graph *irg);
64 /* Removes irg from the list or irgs, shrinks the list by one.
65 @@@ does not work properly. */
66 void remove_irp_irg(ir_graph *irg);
68 ir_graph *get_irp_irg(int pos);
69 void set_irp_irg(int pos, ir_graph *irg);
71 /* Adds type to the list of types in irp. */
72 void add_irp_type(type *typ);
73 int get_irp_n_types();
74 type *get_irp_type(int pos);
75 void set_irp_type(int pos, type *typ);
77 /** Functions to access the fields of ir_prog **/
78 type *get_glob_type(void);
81 /* Returns a new, unique number to number nodes or the like. */
82 int get_irp_new_node_nr();
86 #endif /* ifndef _IRPROG_H_ */