/*
- * Copyright (C) 1995-2011 University of Karlsruhe. All right reserved.
- *
* This file is part of libFirm.
- *
- * This file may be distributed and/or modified under the terms of the
- * GNU General Public License version 2 as published by the Free Software
- * Foundation and appearing in the file LICENSE.GPL included in the
- * packaging of this file.
- *
- * Licensees holding valid libFirm Professional Edition licenses may use
- * this file in accordance with the libFirm Commercial License.
- * Agreement provided with the Software.
- *
- * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
- * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE.
+ * Copyright (C) 2012 University of Karlsruhe.
*/
/**
- * @file type.c
+ * @file
* @brief Representation of types.
* @author Goetz Lindenmaier, Michael Beck
* @brief
res->attr.ca.subtypes = NEW_ARR_F (ir_type *, 0);
res->attr.ca.supertypes = NEW_ARR_F (ir_type *, 0);
res->attr.ca.peculiarity = peculiarity_existent;
- res->attr.ca.type_info = NULL;
res->attr.ca.vtable_size = 0;
res->attr.ca.clss_flags = cf_none;
res->attr.ca.dfn = 0;
/* we must iterate backward here */
for (i = get_class_n_members(clss); i > 0;)
free_entity(get_class_member(clss, --i));
- /* do NOT free the type info here. It belongs to another class */
}
void free_class_attrs(ir_type *clss)
}
}
-ir_entity *get_class_type_info(const ir_type *clss)
-{
- return clss->attr.ca.type_info;
-}
-
-void set_class_type_info(ir_type *clss, ir_entity *ent)
-{
- clss->attr.ca.type_info = ent;
- if (ent)
- ent->repr_class = clss;
-}
-
ir_peculiarity get_class_peculiarity(const ir_type *clss)
{
assert(clss && (clss->type_op == type_class));
}
+ir_type *new_type_segment(ident *const name, type_flags const flags)
+{
+ ir_type *const seg = new_type_class(name);
+ seg->flags |= tf_segment | flags;
+ set_class_final(seg, true);
+ return seg;
+}
+
ir_type *new_d_type_array(size_t n_dimensions, ir_type *element_type,
type_dbg_info *db)
res->attr.aa.order[i] = i;
}
+ ident *const id = new_id_from_chars("elem_ent", 8);
res->attr.aa.element_type = element_type;
- res->attr.aa.element_ent
- = new_entity(NULL, new_id_from_chars("elem_ent", 8), element_type);
- res->attr.aa.element_ent->owner = res;
+ res->attr.aa.element_ent = new_entity(res, id, element_type);
hook_new_type(res);
return res;
ir_node *node;
assert(array->type_op == type_array);
node = array->attr.aa.lower_bound[dimension];
- assert(is_Const(node));
return get_tarval_long(get_Const_tarval(node));
}
ir_node *node;
assert(array->type_op == type_array);
node = array->attr.aa.upper_bound[dimension];
- assert(is_Const(node));
return get_tarval_long(get_Const_tarval(node));
}