#ifndef FIRM_TR_TYPE_T_H
#define FIRM_TR_TYPE_T_H
+#include <stdbool.h>
#include "typerep.h"
#include "tpop_t.h"
#include "irgraph.h"
/** 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. */
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. */
/** 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.
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);
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);