becopyopt: Remove the unnecessary attribute name from struct copy_opt_t.
[libfirm] / ir / tr / type.c
index f4a22ea..98ba233 100644 (file)
@@ -1,24 +1,10 @@
 /*
- * 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
@@ -713,7 +699,6 @@ ir_type *new_d_type_class(ident *name, type_dbg_info *db)
        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;
@@ -733,7 +718,6 @@ void free_class_entities(ir_type *clss)
        /* 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)
@@ -930,18 +914,6 @@ void remove_class_supertype(ir_type *clss, ir_type *supertype)
        }
 }
 
-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));
@@ -1417,6 +1389,14 @@ void set_union_size(ir_type *tp, unsigned size)
 }
 
 
+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)
@@ -1441,10 +1421,9 @@ ir_type *new_d_type_array(size_t n_dimensions, ir_type *element_type,
                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;
@@ -1547,7 +1526,6 @@ long get_array_lower_bound_int(const ir_type *array, size_t dimension)
        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));
 }
 
@@ -1568,7 +1546,6 @@ long get_array_upper_bound_int(const ir_type *array, size_t dimension)
        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));
 }