1 /* Copyright (C) 2000 by Universitaet Karlsruhe
2 ** All rights reserved.
4 ** Authors: Goetz Lindenmaier
6 ** irprog.c: ir representation of a program
12 #define GLOBAL_TYPE_NAME "GlobalType"
14 /* initializes ir_prog. Calles the constructor for an ir_prog. */
15 void init_irprog(void) {
19 /* Create a new ir prog. Automatically called by init_firm through init_irprog. */
20 ir_prog *new_ir_prog (void) {
23 res = (ir_prog *) malloc (sizeof(ir_prog));
26 /* res->obst = (struct obstack *) xmalloc (sizeof (struct obstack)); */
27 res->graphs = NEW_ARR_F (ir_graph *, 1);
28 res->types = NEW_ARR_F (type *, 1);
29 res->glob_type = new_type_class(id_from_str (GLOBAL_TYPE_NAME,
30 strlen(GLOBAL_TYPE_NAME)));
31 add_irp_type((type *)res->glob_type);
37 /** Functions to access the fields of ir_prog **/
38 type_class *get_glob_type(void) {
40 return irp->glob_type;
43 /* Adds irg to the list of ir graphs in irp. */
44 void add_irp_irg(ir_graph *irg) {
47 ARR_APP1 (ir_graph *, irp->graphs, irg);
50 /* Adds type to the list of types in irp. */
51 void add_irp_type(type *typ) {
54 ARR_APP1 (type *, irp->types, typ);