better state handling
[libfirm] / ir / ana / irsimpletype.h
1 /**
2  *
3  * @file irsimpeltype.h
4  *
5  * Project:     libFIRM
6  * File name:   ir/ana/irsimpletype.h
7  * Purpose:     Run most simple type analyses.
8  * Author:      Goetz Lindenmaier
9  * Modified by:
10  * Created:     22.8.2003
11  * CVS-ID:      $Id$
12  * Copyright:   (c) 2003 Universität Karlsruhe
13  * Licence:     This file protected by GPL -  GNU GENERAL PUBLIC LICENSE.
14  *
15  *
16  * We compute type information for each node.  It is derived from the
17  * types of the origines of values, e.g. parameter types can be derived
18  * from the method type.
19  * The type information so far is saved in the link field.
20  *
21  */
22
23
24 # ifndef _IRSIMPLETYPE_H_
25 # define _IRSIMPLETYPE_H_
26
27 # include "irgraph.h"
28 # include "irnode.h"
29 # include "type.h"
30
31
32
33 /* ------------ Building and Removing the type information  ----------- */
34
35 /** Computes type information for each node in all ir graphs.
36  *
37  * Computes type information for each node.  Stores the information in the
38  * field defined in irtypeinfo.h. Sets typestate in irg to irg_typeinfo_consistent.
39  *
40  * Derives the information from nodes/pattarns that give hints about the
41  * type, as projecting an argument from the Start node.  Deletes all previous
42  * type information.
43  *
44  * If a non-pointer type is specified for a pointer value (as the Alloc node does:
45  * it contains the type allocated, but to type the result we need the type that
46  * describes a pointer to the allocated type) searches for a corresponding pointer
47  * type.  If several exist, uses one of them.  If none exists, uses unknown_type.
48  *
49  * Uses the link field of types.  Sets this field of each type to point to a
50  * pointer type that points to the type (Got it? ;-)).
51  */
52 void simple_analyse_types(void);
53
54 /** Frees all type information datastructures.  Sets the flag in irg to "???". */
55 void free_simple_type_information(void);
56
57 /** Computes type information for a node.
58  *
59  *  Computes type information for a node.  Does not remark this type information
60  *  in the ir.  Computes the type information by analysing the predecessors.
61  *  Calls the same basic analyses routine for a node as simple_analyse_types,
62  *  but returns unknown_type for Phi nodes.
63  *  Each call is theoretically O(n).
64  *
65  *  Not yet implemented, but I guess we want this for iropt, to find the
66  *  type for newly allocated constants.
67  */
68 /* type *analyse_irn_type(ir_node *node); */
69
70 #endif /* _IRSIMPLETYPE_H_ */