summaryrefslogtreecommitdiffhomepage
path: root/ir/tr
diff options
context:
space:
mode:
authorChristoph Mallon <christoph.mallon@gmx.de>2016-05-22 15:01:59 +0200
committerChristoph Mallon <christoph.mallon@gmx.de>2016-05-22 15:01:59 +0200
commit342585364adc6072718af690bebd157f4a7ce6ee (patch)
tree220c0e7f1227d98525f19bc5c13e517b7a136e29 /ir/tr
parentb0f7f0acf8b95556dcd578efaebb574a15be6f5a (diff)
tr: Set variadicity directly when creating method types.
Diffstat (limited to 'ir/tr')
-rw-r--r--ir/tr/type.c14
-rw-r--r--ir/tr/type_t.h8
2 files changed, 7 insertions, 15 deletions
diff --git a/ir/tr/type.c b/ir/tr/type.c
index fde8452..35104f9 100644
--- a/ir/tr/type.c
+++ b/ir/tr/type.c
@@ -559,7 +559,7 @@ int (is_Struct_type)(const ir_type *strct)
return is_struct_type_(strct);
}
-ir_type *new_type_method(size_t n_param, size_t n_res)
+ir_type *new_type_method(size_t const n_param, size_t const n_res, bool const is_variadic)
{
ir_type *res = new_type(tpo_method, sizeof(method_attr), mode_P);
res->flags |= tf_layout_fixed;
@@ -568,14 +568,14 @@ ir_type *new_type_method(size_t n_param, size_t n_res)
res->attr.method.params = XMALLOCNZ(ir_type*, n_param);
res->attr.method.n_res = n_res;
res->attr.method.res_type = XMALLOCNZ(ir_type*, n_res);
- res->attr.method.variadic = false;
+ res->attr.method.variadic = is_variadic;
res->attr.method.properties = mtp_no_property;
set_type_alignment(res, 1);
hook_new_type(res);
return res;
}
-ir_type *clone_type_method(ir_type *tp)
+ir_type *clone_type_method(ir_type *const tp, bool const is_variadic)
{
assert(is_Method_type(tp));
ir_mode *mode = tp->mode;
@@ -594,7 +594,7 @@ ir_type *clone_type_method(ir_type *tp)
res->attr.method.n_res = n_res;
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 = tp->attr.method.variadic;
+ res->attr.method.variadic = is_variadic;
res->attr.method.properties = tp->attr.method.properties;
res->attr.method.irg_calling_conv = tp->attr.method.irg_calling_conv;
set_type_alignment(res, get_type_alignment(tp));
@@ -655,12 +655,6 @@ int is_method_variadic(ir_type const *const method)
return method->attr.method.variadic;
}
-void set_method_variadic(ir_type *const method, int const is_variadic)
-{
- assert(is_Method_type(method));
- method->attr.method.variadic = is_variadic;
-}
-
mtp_additional_properties (get_method_additional_properties)(const ir_type *method)
{
return get_method_additional_properties_(method);
diff --git a/ir/tr/type_t.h b/ir/tr/type_t.h
index e458120..be82512 100644
--- a/ir/tr/type_t.h
+++ b/ir/tr/type_t.h
@@ -162,13 +162,12 @@ void ir_finish_type(ir_prog *irp);
/** Clone an existing method type.
*
- * @param tp the method type to clone.
- * @param prefix if non-null, will be the prefix for the name of
- * the cloned type
+ * @param tp the method type to clone.
+ * @param is_variadic whether the cloned type is variadic
*
* @return the cloned method type.
*/
-ir_type *clone_type_method(ir_type *tp);
+ir_type *clone_type_method(ir_type *tp, bool is_variadic);
extern ir_visited_t firm_type_visited;
@@ -386,7 +385,6 @@ 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_variadic(dst, is_method_variadic(src));
set_method_calling_convention(dst, get_method_calling_convention(src));
set_method_additional_properties(dst, get_method_additional_properties(src));
}