X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Ftr%2Ftpop.c;h=1237aacb1833b3ed0b33f867720c77820a3c1749;hb=e88385016800d3c56c3fa09770e9f7995c42e106;hp=0184bbf087a868f38dc4d1d4837a0aa8e10c8550;hpb=aee537d3a7765763d1d5040c9a16faf3396133b9;p=libfirm diff --git a/ir/tr/tpop.c b/ir/tr/tpop.c index 0184bbf08..1237aacb1 100644 --- a/ir/tr/tpop.c +++ b/ir/tr/tpop.c @@ -1,5 +1,5 @@ /* - * 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. * @@ -59,8 +59,8 @@ new_tpop(tp_opcode code, ident *name, unsigned flags, size_t attr_size, const tp return res; } -void -free_tpop(const tp_op *tpop) { +void free_tpop(const tp_op *tpop) +{ xfree((void *)tpop); } @@ -165,28 +165,27 @@ static const tp_op_ops NULL }; -#define C TP_OP_FLAG_COMPOUND +void init_tpop(void) +{ #define ID(s) new_id_from_chars(s, sizeof(s) - 1) - -void init_tpop(void) { - type_class = new_tpop(tpo_class , ID("class"), C, sizeof (cls_attr), &class_ops); - type_struct = new_tpop(tpo_struct , ID("struct"), C, sizeof (stc_attr), &struct_ops); - type_method = new_tpop(tpo_method , ID("method"), 0, sizeof (mtd_attr), &method_ops); - type_union = new_tpop(tpo_union , ID("union"), C, sizeof (uni_attr), &union_ops); - type_array = new_tpop(tpo_array , ID("array"), C, sizeof (arr_attr), &array_ops); - type_enumeration = new_tpop(tpo_enumeration, ID("enumeration"), 0, sizeof (enm_attr), &enum_ops); - type_pointer = new_tpop(tpo_pointer , ID("pointer"), 0, sizeof (ptr_attr), &pointer_ops); - type_primitive = new_tpop(tpo_primitive , ID("primitive"), 0, sizeof (pri_attr), &null_ops); - tpop_code = new_tpop(tpo_code , ID("code"), 0, /* sizeof (non_attr) */ 0, &null_ops); - tpop_none = new_tpop(tpo_none , ID("None"), 0, /* sizeof (non_attr) */ 0, &pseudo_ops); - tpop_unknown = new_tpop(tpo_unknown , ID("Unknown"), 0, /* sizeof (ukn_attr) */ 0, &pseudo_ops); -} + type_class = new_tpop(tpo_class , ID("class"), TP_OP_FLAG_COMPOUND, sizeof(cls_attr), &class_ops); + type_struct = new_tpop(tpo_struct , ID("struct"), TP_OP_FLAG_COMPOUND, sizeof(stc_attr), &struct_ops); + type_method = new_tpop(tpo_method , ID("method"), 0, sizeof(mtd_attr), &method_ops); + type_union = new_tpop(tpo_union , ID("union"), TP_OP_FLAG_COMPOUND, sizeof(uni_attr), &union_ops); + type_array = new_tpop(tpo_array , ID("array"), 0, sizeof(arr_attr), &array_ops); + type_enumeration = new_tpop(tpo_enumeration, ID("enumeration"), 0, sizeof(enm_attr), &enum_ops); + type_pointer = new_tpop(tpo_pointer , ID("pointer"), 0, sizeof(ptr_attr), &pointer_ops); + type_primitive = new_tpop(tpo_primitive , ID("primitive"), 0, sizeof(pri_attr), &null_ops); + tpop_code = new_tpop(tpo_code , ID("code"), 0, 0, &null_ops); + tpop_none = new_tpop(tpo_none , ID("None"), 0, 0, &pseudo_ops); + tpop_unknown = new_tpop(tpo_unknown , ID("Unknown"), 0, 0, &pseudo_ops); #undef ID -#undef C +} /* Finalize the tpop module. * Frees all type opcodes. */ -void finish_tpop(void) { +void finish_tpop(void) +{ free_tpop(type_class ); type_class = NULL; free_tpop(type_struct ); type_struct = NULL; free_tpop(type_method ); type_method = NULL; @@ -201,15 +200,18 @@ void finish_tpop(void) { } /* Returns the string for the tp_opcode. */ -const char *get_tpop_name(const tp_op *op) { +const char *get_tpop_name(const tp_op *op) +{ return get_id_str(op->name); } -tp_opcode (get_tpop_code)(const tp_op *op) { +tp_opcode (get_tpop_code)(const tp_op *op) +{ return _get_tpop_code(op); } /* returns the attribute size of the operator. */ -int (get_tpop_attr_size)(const tp_op *op) { +size_t (get_tpop_attr_size)(const tp_op *op) +{ return _get_tpop_attr_size(op); }