- simplified code
[libfirm] / testprograms / identify_types.c
1 /*
2  * Project:     libFIRM
3  * File name:   testprograms/indentify_types.c
4  * Purpose:     Shows use of ir_type identification
5  * Author:      Christian Schaefer, Goetz Lindenmaier
6  * Modified by:
7  * Created:
8  * CVS-ID:      $Id$
9  * Copyright:   (c) 1999-2003 Universität Karlsruhe
10  * Licence:     This file protected by GPL -  GNU GENERAL PUBLIC LICENSE.
11  */
12
13 #include <stdio.h>
14 #include <string.h>
15
16 #include <libfirm/firm.h>
17
18 int main(void)
19 {
20   ident *i1, *i2;
21   ir_type  *t1, *t2, *t3;
22   firm_parameter_t params;
23   type_identify_if_t params2;
24
25   printf("\nCreating ir_type information for IDENTIFY_TYPES ...\n");
26
27   /** init library */
28   memset (&params, 0, sizeof(params));
29   params.size = sizeof(params);
30   params2.cmp = compare_names;
31   params2.hash = NULL;
32   params.ti_if = &params2;
33   init_firm(&params);
34
35
36   i1 = new_id_from_str("type1");
37   i2 = new_id_from_str("type2");
38
39   t1 = new_type_class(i1);
40   t1 = mature_type(t1);
41
42   t1 = mature_type(t1);
43
44   t2 = new_type_class(i1);
45   t2 = mature_type(t2);
46
47   t3 = new_type_class(i2);
48   t3 = mature_type(t3);
49
50   /*
51   printf(" t1: "); DDMT(t1);
52   printf(" t2: "); DDMT(t2);
53   printf(" t3: "); DDMT(t3);
54   */
55
56   printf("Done building the graph.  Dumping it.\n");
57   dump_all_types(0);
58
59   printf("Use ycomp to view this graph:\n");
60   printf("ycomp GRAPHNAME\n\n");
61
62   return (0);
63 }