* was allocated, else NULL.
*/
FIRM_API ir_type *get_method_value_param_type(const ir_type *method);
-/** Returns an ident representing the parameters name. Returns NULL if not set.
- For debug support only. */
-FIRM_API ident *get_method_param_ident(ir_type *method, size_t pos);
-/** Returns a string representing the parameters name. Returns NULL if not set.
- For debug support only. */
-FIRM_API const char *get_method_param_name(ir_type *method, size_t pos);
-/** Sets an ident representing the parameters name. For debug support only. */
-FIRM_API void set_method_param_ident(ir_type *method, size_t pos, ident *id);
-
/** Returns the number of results of a method type. */
FIRM_API size_t get_method_n_ress(const ir_type *method);
/** Returns the return type of a method type at position pos. */
between_size = get_type_size_bytes(layout->between_type);
for (i = 0, n = get_method_n_params(mtp); i < n; ++i) {
ir_type *ptp = get_method_param_type(mtp, i);
- const char *name = get_method_param_name(mtp, i);
+ const char *name = NULL;
unsigned type_num = get_type_number(h, ptp);
char buf[16];
int ofs = 0;
*/
static ir_type *create_modified_mtd_type(const lower_params_t *lp, ir_type *mtp)
{
- ir_type *lowered, *ptr_tp, *value_type;
+ ir_type *lowered, *ptr_tp;
ir_type **params, **results, *res_tp;
size_t *param_map;
ir_mode *modes[MAX_REGISTER_RET_VAL];
set_lowered_type(mtp, lowered);
- value_type = get_method_value_param_type(mtp);
- if (value_type != NULL) {
- /* set new param positions */
- for (i = 0; i < nn_params; ++i) {
- ir_entity *ent = get_method_value_param_ent(lowered, i);
- size_t pos = param_map[i];
- ident *id;
-
- set_entity_link(ent, INT_TO_PTR(pos));
- if (pos >= n_params) {
- /* formally return value, ignore for now */
- continue;
- }
-
- id = get_method_param_ident(mtp, pos);
- if (id != NULL) {
- set_method_param_ident(lowered, i, id);
- set_entity_ident(ent, id);
- }
- }
-
- set_lowered_type(value_type, get_method_value_param_type(lowered));
- }
-
return lowered;
}
static ir_type *lower_mtp(lower_env_t *env, ir_type *mtp)
{
pmap_entry *entry;
- ident *lid;
ir_type *res, *value_type;
if (is_lowered_type(mtp))
/* set new param positions for all entities of the value type */
for (i = n_param = 0; i < orig_n_params; ++i) {
ir_type *tp = get_method_param_type(mtp, i);
- ident *id = get_method_param_ident(mtp, i);
ir_entity *ent = get_method_value_param_ent(mtp, i);
set_entity_arg_idx(ent, n_param);
ir_mode *mode = get_type_mode(tp);
if (mode == env->high_signed || mode == env->high_unsigned) {
- if (id != NULL) {
- lid = id_mangle(id, env->first_id);
- set_method_param_ident(res, n_param, lid);
- set_entity_ident(get_method_value_param_ent(res, n_param), lid);
- lid = id_mangle(id, env->next_id);
- set_method_param_ident(res, n_param + 1, lid);
- set_entity_ident(get_method_value_param_ent(res, n_param + 1), lid);
- }
n_param += 2;
continue;
}
}
- if (id != NULL) {
- set_method_param_ident(res, n_param, id);
- set_entity_ident(get_method_value_param_ent(res, n_param), id);
- }
++n_param;
}
}
/* Suffixes added to types used for pass-by-value representations. */
-static ident *value_params_suffix = NULL;
static ident *value_ress_suffix = NULL;
void ir_init_type(void)
{
- value_params_suffix = new_id_from_str(VALUE_PARAMS_SUFFIX);
value_ress_suffix = new_id_from_str(VALUE_RESS_SUFFIX);
/* construct none and unknown type. */
free_type(firm_unknown_type);
firm_unknown_type = NULL;
}
- value_params_suffix = NULL;
value_ress_suffix = NULL;
}
/* Remove type from type list. Must be treated differently than other types. */
remove_irp_type(res);
for (i = 0; i < len; ++i) {
- ident *id = tps[i].param_name;
+ ident *id = new_id_from_str("elt");
/* use res as default if corresponding type is not yet set. */
ir_type *elt_type = tps[i].tp ? tps[i].tp : res;
-
- /* use the parameter name if specified */
- if (id == NULL) {
- id = new_id_from_str("elt");
- }
tps[i].ent = new_entity(res, id, elt_type);
set_entity_allocation(tps[i].ent, allocation_parameter);
}
}
}
-ident *get_method_param_ident(ir_type *method, size_t pos)
-{
- assert(method->type_op == type_method);
- assert(pos < get_method_n_params(method));
- return method->attr.ma.params[pos].param_name;
-}
-
-const char *get_method_param_name(ir_type *method, size_t pos)
-{
- ident *id = get_method_param_ident(method, pos);
- return id ? get_id_str(id) : NULL;
-}
-
-void set_method_param_ident(ir_type *method, size_t pos, ident *id)
-{
- assert(method->type_op == type_method);
- assert(pos < get_method_n_params(method));
- method->attr.ma.params[pos].param_name = id;
-}
-
ir_entity *get_method_value_param_ent(ir_type *method, size_t pos)
{
assert(method && (method->type_op == type_method));
/** 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. */