Changes to avoid compiler warnings.
[libfirm] / ir / tr / type_t.h
1
2 /* $Id$ */
3
4 # ifndef _TYPE_T_H_
5 # define _TYPE_T_H_
6
7 # include "type.h"
8
9 /****h* libfirm/type_t.h
10  *
11  * NAME
12  *   file type_t.h
13  * COPYRIGHT
14  *   (C) 2001 by Universitaet Karlsruhe
15  * AUTHORS
16  *   Goetz Lindenmaier
17  * NOTES
18  *   This file contains the datatypes hidden in type.h.
19  * SEE ALSO
20  *   type.h tpop_t.h tpop.h
21  *****
22  */
23
24 typedef struct {
25   entity **members;    /* fields and methods of this class */
26   type   **subtypes;   /* direct subtypes */
27   type   **supertypes; /* direct supertypes */
28   peculiarity peculiarity;
29   int dfn;             /* number used for 'instanceof' operator */
30 } cls_attr;
31
32 typedef struct {
33   entity **members;    /* fields of this struct. No method entities
34                           allowed. */
35 } stc_attr;
36
37 typedef struct {
38   int n_params;        /* number of parameters */
39   type **param_type;   /* code generation needs this information.
40                           @@@ Should it be generated by the frontend,
41                           or does this impose unnecessary work for
42                           optimizations that change the parameters of
43                           methods? */
44   int n_res;           /* number of results */
45   type **res_type;     /* array with result types */
46 } mtd_attr;
47
48 typedef struct {
49   int     n_types;
50   /* type  **unioned_type; * a list of unioned types. */
51   /* ident **delim_names;  * names of the union delimiters. */
52   entity **members;    /* fields of this union. No method entities
53                           allowed.  */
54
55 } uni_attr;
56
57 typedef struct {
58   int   n_dimensions;  /* Number of array dimensions.  */
59   ir_node **lower_bound;   /* Lower bounds of dimensions.  Usually all 0. */
60   ir_node **upper_bound;   /* Upper bounds or dimensions. */
61   int *order;              /* Ordering of dimensions. */
62   type *element_type;  /* The type of the array elements. */
63   entity *element_ent; /* Entity for the array elements, to be used for
64                           element selection with Sel. */
65 } arr_attr;
66
67 typedef struct {
68   int      n_enums;    /* Number of enumerators. */
69   tarval **enumer;     /* Contains all constants that represent a member
70                           of the enum -- enumerators. */
71   ident  **enum_nameid;/* Contains the names of the enum fields as specified by
72                           the source program */
73 } enm_attr;
74
75 typedef struct {
76   type *points_to;     /* The type of the enitity the pointer points to. */
77 } ptr_attr;
78
79 /*
80 typedef struct {   * No private attr yet! *
81 } pri_attr; */
82
83
84 /*
85 typedef struct {        * No private attr, must be smaller than others! *
86 } id_attr;
87 */
88
89
90 typedef union {
91   cls_attr ca;
92   stc_attr sa;
93   mtd_attr ma;
94   uni_attr ua;
95   arr_attr aa;
96   enm_attr ea;
97   ptr_attr pa;
98 } tp_attr;
99
100 struct type {
101   firm_kind kind;
102   tp_op *type_op;
103   ident *name;
104   type_state state;        /* Represents the types state: layout undefined or
105                               fixed. */
106   int size;                /* Size of an entity of this type.  This is determined
107                               when fixing the layout of this class.  Size must be
108                               given in bytes. */
109   ir_mode *mode;           /* The mode for atomic types */
110   unsigned long visit;     /* visited counter for walks of the type information */
111   void *link;              /* holds temporary data - like in irnode_t.h */
112   tp_attr attr;            /* type kind specific fields. This must be the last
113                               entry in this struct!  Varying size! */
114 };
115
116 /****f* type_t.h/new_type
117  *
118  * NAME
119  *   new_type - creates a new type representation
120  * SYNOPSIS
121  *  type *new_type(tp_op *type_op, ir_mode *mode, ident* name);
122  * INPUTS
123  *   type_op - the kind of this type.  May not be type_id.
124  *   mode    - the mode to be used for this type, may be NULL
125  *   name    - an ident for the name of this type.
126  * RESULT
127  *   a new type of the given type.  The remaining private attributes are not
128  *   initalized.  The type is in state layout_undefined.
129  ***
130  */
131 inline type *
132 new_type(tp_op *type_op,
133          ir_mode *mode,
134          ident* name);
135 void free_type_attrs       (type *tp);
136
137 inline void free_class_attrs      (type *clss);
138 inline void free_struct_attrs     (type *strct);
139 inline void free_method_attrs     (type *method);
140 inline void free_union_attrs      (type *uni);
141 inline void free_array_attrs      (type *array);
142 inline void free_enumeration_attrs(type *enumeration);
143 inline void free_pointer_attrs    (type *pointer);
144 inline void free_primitive_attrs  (type *primitive);
145
146
147 # endif /* _TYPE_T_H_ */