/*
- * Copyright (C) 1995-2008 University of Karlsruhe. All right reserved.
+ * Copyright (C) 1995-2011 University of Karlsruhe. All right reserved.
*
* This file is part of libFirm.
*
ir_type *new_type(const tp_op *type_op, ir_mode *mode, type_dbg_info *db)
{
ir_type *res;
- int node_size;
+ size_t node_size;
node_size = offsetof(ir_type, attr) + type_op->attr_size;
- res = xmalloc(node_size);
+ res = (ir_type*)xmalloc(node_size);
memset(res, 0, node_size);
res->kind = k_type;
assert(get_type_mode(tp) != NULL);
for (i = get_enumeration_n_enums(tp) - 1; i >= 0; --i) {
ir_enum_const *ec = get_enumeration_const(tp, i);
- tarval *tv = get_enumeration_value(ec);
+ ir_tarval *tv = get_enumeration_value(ec);
assert(tv != NULL && tv != tarval_bad);
}
#endif
return NULL;
}
-void set_class_member(ir_type *clss, ir_entity *member, int pos)
-{
- assert(clss && (clss->type_op == type_class));
- assert(pos >= 0 && pos < get_class_n_members(clss));
- clss->attr.ca.members[pos] = member;
-}
-
-void set_class_members(ir_type *clss, ir_entity **members, int arity)
-{
- int i;
- assert(clss && (clss->type_op == type_class));
- DEL_ARR_F(clss->attr.ca.members);
- clss->attr.ca.members = NEW_ARR_F(ir_entity *, 0);
- for (i = 0; i < arity; ++i) {
- set_entity_owner(members[i], clss);
- ARR_APP1(ir_entity *, clss->attr.ca.members, members[i]);
- }
-}
-
static void remove_class_member(ir_type *clss, ir_entity *member)
{
int i;
if (clss->attr.ca.subtypes[i] == subtype) {
for (; i < (ARR_LEN (clss->attr.ca.subtypes))-1; i++)
clss->attr.ca.subtypes[i] = clss->attr.ca.subtypes[i+1];
- ARR_SETLEN(ir_entity*, clss->attr.ca.subtypes, ARR_LEN(clss->attr.ca.subtypes) - 1);
+ ARR_SETLEN(ir_type*, clss->attr.ca.subtypes, ARR_LEN(clss->attr.ca.subtypes) - 1);
break;
}
}
if (clss->attr.ca.supertypes[i] == supertype) {
for (; i < (ARR_LEN(clss->attr.ca.supertypes))-1; i++)
clss->attr.ca.supertypes[i] = clss->attr.ca.supertypes[i+1];
- ARR_SETLEN(ir_entity*, clss->attr.ca.supertypes, ARR_LEN(clss->attr.ca.supertypes) - 1);
+ ARR_SETLEN(ir_type*, clss->attr.ca.supertypes, ARR_LEN(clss->attr.ca.supertypes) - 1);
break;
}
}
return -1;
}
-void set_struct_member(ir_type *strct, int pos, ir_entity *member)
-{
- assert(strct && (strct->type_op == type_struct));
- assert(pos >= 0 && pos < get_struct_n_members(strct));
- assert(get_entity_type(member)->type_op != type_method);/* @@@ lowerfirm !!*/
- strct->attr.sa.members[pos] = member;
-}
-
static void remove_struct_member(ir_type *strct, ir_entity *member)
{
int i;
method->attr.ma.first_variadic_param = index;
}
-unsigned (get_method_additional_properties)(const ir_type *method)
+mtp_additional_properties (get_method_additional_properties)(const ir_type *method)
{
return _get_method_additional_properties(method);
}
-void (set_method_additional_properties)(ir_type *method, unsigned mask)
+void (set_method_additional_properties)(ir_type *method, mtp_additional_properties mask)
{
_set_method_additional_properties(method, mask);
}
-void (set_method_additional_property)(ir_type *method,
- mtp_additional_property flag)
+void (add_method_additional_properties)(ir_type *method,
+ mtp_additional_properties flag)
{
- _set_method_additional_property(method, flag);
+ _add_method_additional_properties(method, flag);
}
unsigned (get_method_calling_convention)(const ir_type *method)
return -1;
}
-void set_union_member(ir_type *uni, int pos, ir_entity *member)
-{
- assert(uni && (uni->type_op == type_union));
- assert(pos >= 0 && pos < get_union_n_members(uni));
- uni->attr.ua.members[pos] = member;
-}
-
static void remove_union_member(ir_type *uni, ir_entity *member)
{
int i;
}
void set_enumeration_const(ir_type *enumeration, int pos, ident *nameid,
- tarval *con)
+ ir_tarval *con)
{
assert(0 <= pos && pos < ARR_LEN(enumeration->attr.ea.enumer));
enumeration->attr.ea.enumer[pos].nameid = nameid;
return enum_cnst->owner;
}
-void set_enumeration_value(ir_enum_const *enum_cnst, tarval *con)
+void set_enumeration_value(ir_enum_const *enum_cnst, ir_tarval *con)
{
enum_cnst->value = con;
}
-tarval *get_enumeration_value(const ir_enum_const *enum_cnst)
+ir_tarval *get_enumeration_value(const ir_enum_const *enum_cnst)
{
return enum_cnst->value;
}