summaryrefslogtreecommitdiffhomepage
path: root/ir/tr
diff options
context:
space:
mode:
authorMatthias Braun <matze@braunis.de>2015-12-07 03:50:55 +0100
committerMatthias Braun <matze@braunis.de>2015-12-07 03:50:55 +0100
commit6f319bb1b3f32c12edafbcce6bb68c6bf83477d4 (patch)
tree2f236eb99e0e14d3c5d03781ba779d4a09a0d403 /ir/tr
parent4790cf11575b96c90db02b1fddcdef95e244212f (diff)
Get rid of tpop flags (we already have type flags)
Diffstat (limited to 'ir/tr')
-rw-r--r--ir/tr/tpop.c23
-rw-r--r--ir/tr/tpop_t.h11
-rw-r--r--ir/tr/type.c3
-rw-r--r--ir/tr/type_t.h21
4 files changed, 26 insertions, 32 deletions
diff --git a/ir/tr/tpop.c b/ir/tr/tpop.c
index 2725af6..b55fc2c 100644
--- a/ir/tr/tpop.c
+++ b/ir/tr/tpop.c
@@ -23,13 +23,12 @@ const tp_op *type_primitive; const tp_op *get_tpop_primitive(void) { return type
const tp_op *tpop_code; const tp_op *get_tpop_code_type(void) { return tpop_code; }
const tp_op *tpop_unknown; const tp_op *get_tpop_unknown (void) { return tpop_unknown; }
-const tp_op *new_tpop(tp_opcode code, ident *name, unsigned flags,
- size_t attr_size, const tp_op_ops *ops)
+const tp_op *new_tpop(tp_opcode code, ident *name, size_t attr_size,
+ const tp_op_ops *ops)
{
tp_op *res = XMALLOC(tp_op);
res->code = code;
res->name = name;
- res->flags = flags;
res->attr_size = attr_size;
res->ops = *ops;
return res;
@@ -64,15 +63,15 @@ static const tp_op_ops
void init_tpop(void)
{
- type_class = new_tpop(tpo_class, NEW_IDENT("class"), TP_OP_FLAG_COMPOUND, sizeof(cls_attr), &class_ops);
- type_struct = new_tpop(tpo_struct, NEW_IDENT("struct"), TP_OP_FLAG_COMPOUND, sizeof(compound_attr), &struct_ops);
- 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), &null_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, &null_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);
+ type_class = new_tpop(tpo_class, NEW_IDENT("class"), sizeof(cls_attr), &class_ops);
+ type_struct = new_tpop(tpo_struct, NEW_IDENT("struct"), sizeof(compound_attr), &struct_ops);
+ type_method = new_tpop(tpo_method, NEW_IDENT("method"), sizeof(mtd_attr), &method_ops);
+ type_union = new_tpop(tpo_union, NEW_IDENT("union"), sizeof(compound_attr), &union_ops);
+ type_array = new_tpop(tpo_array, NEW_IDENT("array"), sizeof(arr_attr), &null_ops);
+ type_pointer = new_tpop(tpo_pointer, NEW_IDENT("pointer"), sizeof(ptr_attr), &null_ops);
+ type_primitive = new_tpop(tpo_primitive, NEW_IDENT("primitive"), 0, &null_ops);
+ tpop_code = new_tpop(tpo_code, NEW_IDENT("code"), 0, &null_ops);
+ tpop_unknown = new_tpop(tpo_unknown, NEW_IDENT("Unknown"), 0, &null_ops);
}
void finish_tpop(void)
diff --git a/ir/tr/tpop_t.h b/ir/tr/tpop_t.h
index b8c51b5..89b2fb7 100644
--- a/ir/tr/tpop_t.h
+++ b/ir/tr/tpop_t.h
@@ -27,17 +27,11 @@ typedef struct tp_op_ops {
void (*free_attrs)(ir_type *type);
} tp_op_ops;
-/** possible flags for a type opcode */
-enum tp_op_flags_t {
- TP_OP_FLAG_COMPOUND = 1 /**< is a compound type */
-};
-
/** The type opcode. */
struct tp_op {
tp_opcode code; /**< The tpop code. */
ident *name; /**< The name of the type opcode. */
size_t attr_size; /**< The attribute size for a type of this opcode. */
- unsigned flags; /**< Flags for this opcode. */
tp_op_ops ops; /**< tp_op operations. */
};
@@ -50,14 +44,13 @@ struct tp_op {
*
* @param code the enum for this type opcode.
* @param name an ident for the name of the type opcode.
- * @param flags additional flags
* @param attr_size the size of the attributes necessary for a type with
* this opcode
* @param ops the tp_op operations for this type
* @return A new type opcode.
*/
-tp_op const *new_tpop(tp_opcode code, ident *name, unsigned flags,
- size_t attr_size, tp_op_ops const *ops);
+tp_op const *new_tpop(tp_opcode code, ident *name, size_t attr_size,
+ tp_op_ops const *ops);
/**
* Free a tpop data structure.
diff --git a/ir/tr/type.c b/ir/tr/type.c
index 0a20cfd..9ed8aee 100644
--- a/ir/tr/type.c
+++ b/ir/tr/type.c
@@ -312,6 +312,7 @@ void (set_type_dbg_info)(ir_type *tp, type_dbg_info *db)
static void compound_init(ir_type *const type, ident *const name)
{
+ type->flags |= tf_compound;
type->name = name;
type->attr.ca.members = NEW_ARR_F(ir_entity*, 0);
}
@@ -935,7 +936,7 @@ int is_compound_variable_size(const ir_type *tp)
int is_compound_type(const ir_type *tp)
{
assert(tp->kind == k_type);
- return tp->type_op->flags & TP_OP_FLAG_COMPOUND;
+ return (tp->flags & tf_compound) != 0;
}
ident *get_compound_ident(const ir_type *tp)
diff --git a/ir/tr/type_t.h b/ir/tr/type_t.h
index dd54a99..dd53dc5 100644
--- a/ir/tr/type_t.h
+++ b/ir/tr/type_t.h
@@ -99,16 +99,17 @@ typedef union {
/** Additional type flags. */
typedef enum type_flags {
tf_none = 0, /**< No flags. */
- tf_lowered_type = 1U << 0, /**< Set if this is a lowered type. */
- tf_layout_fixed = 1U << 1, /**< Set if the layout of a type is fixed */
-
- tf_frame_type = 1U << 2, /**< Set if this is a frame type. */
- tf_segment = 1U << 3, /**< type represents a linker segment */
- tf_global_type = 1U << 4, /**< Set only for the global type */
- tf_tls_type = 1U << 5, /**< Set only for the tls type */
- tf_info = 1U << 6, /**< infos (for example constructor, destructor pointers) */
- tf_variable_size = 1U << 7, /**< compound or array type may have variable size last element */
- tf_lowered_dw = 1U << 8, /**< hack to identify lowered doubleword params */
+ tf_compound = 1U << 0, /**< Set if type is a compound type. */
+ tf_lowered_type = 1U << 1, /**< Set if this is a lowered type. */
+ tf_layout_fixed = 1U << 2, /**< Set if the layout of a type is fixed */
+
+ tf_frame_type = 1U << 3, /**< Set if this is a frame type. */
+ tf_segment = 1U << 4, /**< type represents a linker segment */
+ tf_global_type = 1U << 5, /**< Set only for the global type */
+ tf_tls_type = 1U << 6, /**< Set only for the tls type */
+ tf_info = 1U << 7, /**< infos (for example constructor, destructor pointers) */
+ tf_variable_size = 1U << 8, /**< compound or array type may have variable size last element */
+ tf_lowered_dw = 1U << 9, /**< hack to identify lowered doubleword params */
} type_flags;
ENUM_BITSET(type_flags)