X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Ftr%2Ftype_t.h;h=660fb24f2e48ea254fd3276591e738e7f7e5278d;hb=5c34afb830f4a9233b659c95a9f71643f8421f86;hp=73c7c782f142f5e33341d2296c2c6ef9f74b00df;hpb=15ad7ccd8dff64e1808e1d093d4a8d7cda5af33e;p=libfirm diff --git a/ir/tr/type_t.h b/ir/tr/type_t.h index 73c7c782f..660fb24f2 100644 --- a/ir/tr/type_t.h +++ b/ir/tr/type_t.h @@ -27,6 +27,7 @@ #ifndef FIRM_TR_TYPE_T_H #define FIRM_TR_TYPE_T_H +#include #include "typerep.h" #include "tpop_t.h" #include "irgraph.h" @@ -61,23 +62,20 @@ typedef struct { /** A (type, ir_entity) pair. */ typedef struct { - ir_type *tp; /**< A type. */ - ir_entity *ent; /**< An ir_entity. */ - ident *param_name; /**< For debugging purposes: the name of the parameter */ + ir_type *tp; /**< A type. */ + ir_entity *ent; /**< An ir_entity. */ } tp_ent_pair; /** Method type attributes. */ typedef struct { size_t n_params; /**< Number of parameters. */ tp_ent_pair *params; /**< Array of parameter type/value entities pairs. */ - ir_type *value_params; /**< A type whose entities represent copied value arguments. */ size_t n_res; /**< Number of results. */ tp_ent_pair *res_type; /**< Array of result type/value ir_entity pairs. */ - ir_type *value_ress; /**< A type whose entities represent copied value results. */ ir_variadicity variadicity; /**< The variadicity of the method. */ - size_t first_variadic_param; /**< The index of the first variadic parameter or -1 if non-variadic .*/ mtp_additional_properties additional_properties; /**< Set of additional method properties. */ unsigned irg_calling_conv; /**< A set of calling convention flags. */ + bool has_compound_ret_parameter : 1; /**< first parameter compound return address */ } mtd_attr; /** Union type attributes. */ @@ -90,7 +88,7 @@ typedef struct { size_t n_dimensions; /**< Number of array dimensions. */ ir_node **lower_bound; /**< Lower bounds of dimensions. Usually all 0. */ ir_node **upper_bound; /**< Upper bounds or dimensions. */ - int *order; /**< Ordering of dimensions. */ + size_t *order; /**< Ordering of dimensions. */ ir_type *element_type; /**< The type of the array elements. */ ir_entity *element_ent; /**< entity for the array elements, to be used for element selection with a Sel node. */ @@ -133,17 +131,17 @@ typedef union { /** Additional type flags. */ enum type_flags { - tf_none = 0, /**< No flags. */ - tf_lowered_type = 1, /**< Set if this is a lowered type. */ - tf_layout_fixed = 2, /**< Set if the layout of a type is fixed */ - - tf_frame_type = 4, /**< Set if this is a frame type. */ - tf_value_param_type = 8, /**< Set if this is a value param type. */ - tf_global_type = 16, /**< Set only for the global type */ - tf_tls_type = 32, /**< Set only for the tls type */ - tf_constructors = 64, /**< Set only for the constructors segment type */ - tf_destructors = 128, /**< Set only for the destructors segment type */ + tf_none = 0, /**< No flags. */ + tf_lowered_type = 1U << 0, /**< Set if this is a lowered type. */ + tf_layout_fixed = 1U << 1, /**< Set if the layout of a type is fixed */ + + tf_frame_type = 1U << 2, /**< Set if this is a frame type. */ + tf_global_type = 1U << 3, /**< Set only for the global type */ + tf_tls_type = 1U << 4, /**< Set only for the tls type */ + tf_constructors = 1U << 5, /**< Set only for the constructors segment type */ + tf_destructors = 1U << 6, /**< Set only for the destructors segment type */ }; +ENUM_BITSET(type_flags) /** * An abstract data type to represent types. @@ -284,7 +282,6 @@ void set_class_dfn(ir_type *clss, int dfn); int get_class_dfn(const ir_type *clss); void add_compound_member(ir_type *compound, ir_entity *entity); -void remove_compound_member(ir_type *compound, ir_entity *entity); /** Initialize the type module. */ void ir_init_type(void); @@ -312,6 +309,28 @@ static inline void _set_master_type_visited(ir_visited_t val) { firm_type_visite static inline ir_visited_t _get_master_type_visited(void) { return firm_type_visited; } static inline void _inc_master_type_visited(void) { ++firm_type_visited; } +static inline int is_lowered_type(const ir_type *tp) +{ + return tp->flags & tf_lowered_type; +} + +/** + * Gets the lowered/unlowered type of a type or NULL if this type + * has no lowered/unlowered one. + */ +static inline ir_type *get_associated_type(const ir_type *tp) +{ + return tp->assoc_type; +} + +static inline void set_lowered_type(ir_type *tp, ir_type *lowered_type) +{ + assert (is_type(tp) && is_type(lowered_type)); + lowered_type->flags |= tf_lowered_type; + tp->assoc_type = lowered_type; + lowered_type->assoc_type = tp; +} + static inline void *_get_type_link(const ir_type *tp) { assert(tp && tp->kind == k_type);