summaryrefslogtreecommitdiffhomepage
path: root/ir/tr
diff options
context:
space:
mode:
authorChristoph Mallon <christoph.mallon@gmx.de>2016-07-08 08:04:53 +0200
committerChristoph Mallon <christoph.mallon@gmx.de>2016-07-11 14:40:44 +0200
commitcc80f54ffafd48a98732d0196265bd08ef790703 (patch)
treeea9a0888a735378d20ab45b3bced92d8520368f1 /ir/tr
parent5e8671106a446534bf78dfb79012104f2d77a031 (diff)
Set the calling convention right when construction a method type.
Diffstat (limited to 'ir/tr')
-rw-r--r--ir/tr/type.c32
-rw-r--r--ir/tr/type_t.h8
2 files changed, 10 insertions, 30 deletions
diff --git a/ir/tr/type.c b/ir/tr/type.c
index 0ef2ec3..9542277 100644
--- a/ir/tr/type.c
+++ b/ir/tr/type.c
@@ -519,17 +519,18 @@ 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)
+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 *res = new_type(tpo_method, sizeof(method_attr), mode_P);
- res->flags |= tf_layout_fixed;
- res->size = get_mode_size_bytes(mode_P);
- res->attr.method.n_params = n_param;
- 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 = is_variadic;
- res->attr.method.properties = mtp_no_property;
+ res->flags |= tf_layout_fixed;
+ res->size = get_mode_size_bytes(mode_P);
+ res->attr.method.n_params = n_param;
+ 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 = is_variadic;
+ res->attr.method.irg_calling_conv = cc_mask;
+ res->attr.method.properties = mtp_no_property;
set_type_alignment(res, 1);
hook_new_type(res);
return res;
@@ -636,11 +637,6 @@ unsigned (get_method_calling_convention)(const ir_type *method)
return get_method_calling_convention_(method);
}
-void (set_method_calling_convention)(ir_type *method, unsigned cc_mask)
-{
- set_method_calling_convention_(method, cc_mask);
-}
-
unsigned get_method_n_regparams(ir_type *method)
{
unsigned cc = get_method_calling_convention(method);
@@ -649,14 +645,6 @@ unsigned get_method_n_regparams(ir_type *method)
return cc & ~cc_bits;
}
-void set_method_n_regparams(ir_type *method, unsigned n_regs)
-{
- unsigned cc = get_method_calling_convention(method);
- assert(IS_FASTCALL(cc));
-
- set_method_calling_convention(method, (cc & cc_bits) | (n_regs & ~cc_bits));
-}
-
int (is_Method_type)(const ir_type *method)
{
return is_method_type_(method);
diff --git a/ir/tr/type_t.h b/ir/tr/type_t.h
index a5cc6a3..5480d53 100644
--- a/ir/tr/type_t.h
+++ b/ir/tr/type_t.h
@@ -49,7 +49,6 @@
#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 set_method_calling_convention(method, cc_mask) set_method_calling_convention_(method, cc_mask)
/** Compound type attributes. */
typedef struct {
@@ -360,12 +359,6 @@ static inline unsigned get_method_calling_convention_(const ir_type *method)
return method->attr.method.irg_calling_conv;
}
-static inline void set_method_calling_convention_(ir_type *method, unsigned cc_mask)
-{
- assert(is_Method_type(method));
- method->attr.method.irg_calling_conv = cc_mask;
-}
-
/**
* Check if type is a compound or array type.
* This function returns true iff a value of this type cannot be represented by
@@ -381,7 +374,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_calling_convention(dst, get_method_calling_convention(src));
set_method_additional_properties(dst, get_method_additional_properties(src));
}