48f12e7f103effa06f912126747efe1f545008db
[libfirm] / testprograms / identify_types.c
1 /*
2  * Project:     libFIRM
3  * File name:   testprograms/indentify_types.c
4  * Purpose:     Shows use of 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 "irvrfy.h"
17 # include "irdump.h"
18 # include "firm.h"
19 # include "type_identify.h"
20
21
22
23 int main(int argc, char **argv)
24 {
25   ident *i1, *i2;
26   type  *t1, *t2, *t3;
27
28   printf("\nCreating type information for IDENTIFY_TYPES ...\n");
29
30
31
32
33   /** init library */
34   firm_parameter_t params;
35   memset (&params, 0, sizeof(params));
36   params.size = sizeof(params);
37   params.compare_types_func = compare_names;
38   init_firm(&params);
39
40
41   i1 = new_id_from_str("type1");
42   i2 = new_id_from_str("type2");
43
44   t1 = new_type_class(i1);
45   t1 = mature_type(t1);
46
47   t1 = mature_type(t1);
48
49   t2 = new_type_class(i1);
50   t2 = mature_type(t2);
51
52   t3 = new_type_class(i2);
53   t3 = mature_type(t3);
54
55   /*
56   printf(" t1: "); DDMT(t1);
57   printf(" t2: "); DDMT(t2);
58   printf(" t3: "); DDMT(t3);
59   */
60
61   printf("Done building the graph.  Dumping it.\n");
62   dump_all_types();
63
64   printf("use xvcg to view this graph:\n");
65   printf("/ben/goetz/bin/xvcg GRAPHNAME\n\n");
66
67   return (0);
68 }