summaryrefslogtreecommitdiffhomepage
path: root/ir/tr
diff options
context:
space:
mode:
authorChristoph Mallon <christoph.mallon@gmx.de>2016-07-08 20:07:33 +0200
committerChristoph Mallon <christoph.mallon@gmx.de>2016-07-11 14:40:44 +0200
commit1a643e44900c511a733d977d9d31de036ea2b4f9 (patch)
tree0cf620d31407007a8b76eb8e41c9513bbce009a3 /ir/tr
parentcc80f54ffafd48a98732d0196265bd08ef790703 (diff)
Set the additional properties right when construction a method type.
Diffstat (limited to 'ir/tr')
-rw-r--r--ir/tr/type.c19
-rw-r--r--ir/tr/type_t.h30
2 files changed, 10 insertions, 39 deletions
diff --git a/ir/tr/type.c b/ir/tr/type.c
index 9542277..202c0b3 100644
--- a/ir/tr/type.c
+++ b/ir/tr/type.c
@@ -519,7 +519,7 @@ int (is_Struct_type)(const ir_type *strct)
return is_struct_type_(strct);
}
-ir_type *new_type_method(size_t const n_param, size_t const n_res, int const is_variadic, unsigned const cc_mask)
+ir_type *new_type_method(size_t const n_param, size_t const n_res, int const is_variadic, unsigned const cc_mask, mtp_additional_properties const property_mask)
{
ir_type *res = new_type(tpo_method, sizeof(method_attr), mode_P);
res->flags |= tf_layout_fixed;
@@ -530,13 +530,13 @@ ir_type *new_type_method(size_t const n_param, size_t const n_res, int const is_
res->attr.method.res_type = XMALLOCNZ(ir_type*, n_res);
res->attr.method.variadic = is_variadic;
res->attr.method.irg_calling_conv = cc_mask;
- res->attr.method.properties = mtp_no_property;
+ res->attr.method.properties = property_mask;
set_type_alignment(res, 1);
hook_new_type(res);
return res;
}
-ir_type *clone_type_method(ir_type *const tp, bool const is_variadic)
+ir_type *clone_type_method(ir_type *const tp, bool const is_variadic, mtp_additional_properties const property_mask)
{
assert(is_Method_type(tp));
ir_mode *mode = tp->mode;
@@ -556,7 +556,7 @@ ir_type *clone_type_method(ir_type *const tp, bool const is_variadic)
res->attr.method.res_type = XMALLOCN(ir_type*, n_res);
MEMCPY(res->attr.method.res_type, tp->attr.method.res_type, n_res);
res->attr.method.variadic = is_variadic;
- res->attr.method.properties = tp->attr.method.properties;
+ res->attr.method.properties = property_mask;
res->attr.method.irg_calling_conv = tp->attr.method.irg_calling_conv;
set_type_alignment(res, get_type_alignment(tp));
hook_new_type(res);
@@ -621,17 +621,6 @@ mtp_additional_properties (get_method_additional_properties)(const ir_type *meth
return get_method_additional_properties_(method);
}
-void (set_method_additional_properties)(ir_type *method, mtp_additional_properties mask)
-{
- set_method_additional_properties_(method, mask);
-}
-
-void (add_method_additional_properties)(ir_type *method,
- mtp_additional_properties flag)
-{
- add_method_additional_properties_(method, flag);
-}
-
unsigned (get_method_calling_convention)(const ir_type *method)
{
return get_method_calling_convention_(method);
diff --git a/ir/tr/type_t.h b/ir/tr/type_t.h
index 5480d53..f9bf2de 100644
--- a/ir/tr/type_t.h
+++ b/ir/tr/type_t.h
@@ -45,10 +45,8 @@
#define is_atomic_type(tp) is_atomic_type_(tp)
#define get_method_n_params(method) get_method_n_params_(method)
#define get_method_n_ress(method) get_method_n_ress_(method)
-#define get_method_additional_properties(method) get_method_additional_properties_(method)
-#define set_method_additional_properties(method, mask) set_method_additional_properties_(method, mask)
-#define add_method_additional_properties(method, flag) add_method_additional_properties_(method, flag)
-#define get_method_calling_convention(method) get_method_calling_convention_(method)
+#define get_method_additional_properties(method) get_method_additional_properties_(method)
+#define get_method_calling_convention(method) get_method_calling_convention_(method)
/** Compound type attributes. */
typedef struct {
@@ -157,12 +155,13 @@ void ir_finish_type(ir_prog *irp);
/** Clone an existing method type.
*
- * @param tp the method type to clone.
- * @param is_variadic whether the cloned type is variadic
+ * @param tp the method type to clone.
+ * @param is_variadic whether the cloned type is variadic
+ * @param property_mask additional method properties for the cloned type
*
* @return the cloned method type.
*/
-ir_type *clone_type_method(ir_type *tp, bool is_variadic);
+ir_type *clone_type_method(ir_type *tp, bool is_variadic, mtp_additional_properties property_mask);
extern ir_visited_t firm_type_visited;
@@ -341,18 +340,6 @@ static inline mtp_additional_properties get_method_additional_properties_(const
return method->attr.method.properties;
}
-static inline void set_method_additional_properties_(ir_type *method, mtp_additional_properties properties)
-{
- assert(is_Method_type(method));
- method->attr.method.properties = properties;
-}
-
-static inline void add_method_additional_properties_(ir_type *method, mtp_additional_properties properties)
-{
- assert(is_Method_type(method));
- method->attr.method.properties |= properties;
-}
-
static inline unsigned get_method_calling_convention_(const ir_type *method)
{
assert(is_Method_type(method));
@@ -372,9 +359,4 @@ static inline bool is_aggregate_type(const ir_type *type)
ir_type *new_type_segment(ident *name, type_flags flags);
-static inline void copy_method_properties(ir_type *const dst, ir_type const *const src)
-{
- set_method_additional_properties(dst, get_method_additional_properties(src));
-}
-
#endif