Commit d6058457 authored by Matthias Braun's avatar Matthias Braun
Browse files

Remove generic set_type_mode() only leave set_pointer_mode()

parent 2028883f
......@@ -995,12 +995,6 @@ FIRM_API void set_type_state(ir_type *tp, ir_type_state state);
*/
FIRM_API ir_mode *get_type_mode(const ir_type *tp);
/** Sets the mode of a type.
*
* Only has an effect on primitive and pointer types.
*/
FIRM_API void set_type_mode(ir_type *tp, ir_mode* m);
/** Returns the size of a type in bytes. */
FIRM_API unsigned get_type_size_bytes(const ir_type *tp);
......@@ -1534,6 +1528,9 @@ FIRM_API const tp_op *get_tpop_array(void);
/** Creates a new type pointer. */
FIRM_API ir_type *new_type_pointer(ir_type *points_to);
/** Set mode of a pointer typer. */
FIRM_API void set_pointer_mode(ir_type *pointer, ir_mode *mode);
/** Sets the type to which a pointer points to. */
FIRM_API void set_pointer_points_to_type(ir_type *pointer, ir_type *tp);
......
......@@ -1706,7 +1706,7 @@ static void read_type(read_env_t *env)
ir_mode *mode = read_mode_ref(env);
ir_type *pointsto = get_type(env, read_long(env));
type = new_type_pointer(pointsto);
set_type_mode(type, mode);
set_pointer_mode(type, mode);
goto finish_type;
}
......
......@@ -45,7 +45,6 @@ static const tp_op_ops
class_ops = {
.free_attrs = free_class_attrs,
.free_entities = free_compound_entities,
.set_type_mode = set_class_mode,
.set_type_size = set_default_size,
.get_n_members = get_class_n_members,
.get_member = get_class_member,
......@@ -55,7 +54,6 @@ static const tp_op_ops
struct_ops = {
.free_attrs = free_struct_attrs,
.free_entities = free_compound_entities,
.set_type_mode = set_struct_mode,
.set_type_size = set_default_size,
.get_n_members = get_struct_n_members,
.get_member = get_struct_member,
......@@ -78,14 +76,9 @@ static const tp_op_ops
array_ops = {
.set_type_size = set_default_size,
},
/** tpop operations for pointer types */
pointer_ops = {
.set_type_mode = set_pointer_mode,
},
primitive_ops = {
.set_type_size = set_default_size,
},
/** tpop operations for primitive types */
null_ops = {
.free_attrs = NULL,
}
......@@ -98,7 +91,7 @@ void init_tpop(void)
type_method = new_tpop(tpo_method, NEW_IDENT("method"), 0, sizeof(mtd_attr), &method_ops);
type_union = new_tpop(tpo_union, NEW_IDENT("union"), TP_OP_FLAG_COMPOUND, sizeof(compound_attr), &union_ops);
type_array = new_tpop(tpo_array, NEW_IDENT("array"), 0, sizeof(arr_attr), &array_ops);
type_pointer = new_tpop(tpo_pointer, NEW_IDENT("pointer"), 0, sizeof(ptr_attr), &pointer_ops);
type_pointer = new_tpop(tpo_pointer, NEW_IDENT("pointer"), 0, sizeof(ptr_attr), &null_ops);
type_primitive = new_tpop(tpo_primitive, NEW_IDENT("primitive"), 0, 0, &primitive_ops);
tpop_code = new_tpop(tpo_code, NEW_IDENT("code"), 0, 0, &null_ops);
tpop_unknown = new_tpop(tpo_unknown, NEW_IDENT("Unknown"), 0, 0, &null_ops);
......
......@@ -27,8 +27,6 @@ typedef struct tp_op_ops {
void (*free_attrs)(ir_type *type);
/** Called to free the owned entities of a type. */
void (*free_entities)(ir_type *type);
/** Called to set a ir_mode of a type. */
void (*set_type_mode)(ir_type *type, ir_mode *mode);
/** Called to set the byte size of a type. */
void (*set_type_size)(ir_type *type, unsigned size);
/** Called to return the number of compound members. */
......
......@@ -197,16 +197,6 @@ ir_mode *(get_type_mode)(const ir_type *tp)
return get_type_mode_(tp);
}
void set_type_mode(ir_type *tp, ir_mode *mode)
{
const tp_op *tpop = get_type_tpop(tp);
if (tpop->ops.set_type_mode) {
tpop->ops.set_type_mode(tp, mode);
} else {
panic("setting a mode is NOT allowed for this type");
}
}
long get_type_nr(const ir_type *tp)
{
assert(is_type(tp));
......@@ -571,15 +561,6 @@ int (is_Class_type)(const ir_type *clss)
return is_class_type_(clss);
}
void set_class_mode(ir_type *tp, ir_mode *mode)
{
/* for classes and structs we allow to set a mode if the layout is fixed
* AND the size matches */
assert(get_type_state(tp) == layout_fixed &&
tp->size == get_mode_size_bytes(mode));
tp->mode = mode;
}
ir_type *new_type_struct(ident *name)
{
......@@ -645,15 +626,6 @@ int (is_Struct_type)(const ir_type *strct)
return is_struct_type_(strct);
}
void set_struct_mode(ir_type *tp, ir_mode *mode)
{
/* for classes and structs we allow to set a mode if the layout is fixed
* AND the size matches */
assert(get_type_state(tp) == layout_fixed &&
tp->size == get_mode_size_bytes(mode));
tp->mode = mode;
}
ir_type *new_type_method(size_t n_param, size_t n_res)
{
ir_type *res = new_type(type_method, mode_P);
......
......@@ -160,10 +160,6 @@ void free_struct_attrs(ir_type *strct);
void free_method_attrs(ir_type *method);
void free_union_attrs(ir_type *uni);
void set_class_mode(ir_type *tp, ir_mode *mode);
void set_struct_mode(ir_type *tp, ir_mode *mode);
void set_pointer_mode(ir_type *tp, ir_mode *mode);
void set_default_size(ir_type *tp, unsigned bytes);
void add_compound_member(ir_type *compound, ir_entity *entity);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment