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