summaryrefslogtreecommitdiffhomepage
path: root/ir/lower
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/lower
parent5e8671106a446534bf78dfb79012104f2d77a031 (diff)
Set the calling convention right when construction a method type.
Diffstat (limited to 'ir/lower')
-rw-r--r--ir/lower/lower_builtins.c2
-rw-r--r--ir/lower/lower_calls.c12
-rw-r--r--ir/lower/lower_copyb.c2
-rw-r--r--ir/lower/lower_dw.c14
-rw-r--r--ir/lower/lower_softfloat.c13
5 files changed, 22 insertions, 21 deletions
diff --git a/ir/lower/lower_builtins.c b/ir/lower/lower_builtins.c
index 6dbc33a..f1bd23e 100644
--- a/ir/lower/lower_builtins.c
+++ b/ir/lower/lower_builtins.c
@@ -95,7 +95,7 @@ static void widen_builtin(ir_node *node)
ir_type *new_arg1 = get_type_for_mode(target_mode);
ir_type *new_result = get_method_res_type(mtp, 0);
- ir_type *new_type = new_type_method(1, 1, false);
+ ir_type *new_type = new_type_method(1, 1, false, cc_cdecl_set);
set_method_param_type(new_type, 0, new_arg1);
set_method_res_type(new_type, 0, new_result);
set_Builtin_type(node, new_type);
diff --git a/ir/lower/lower_calls.c b/ir/lower/lower_calls.c
index a35cd48..41bba92 100644
--- a/ir/lower/lower_calls.c
+++ b/ir/lower/lower_calls.c
@@ -179,9 +179,13 @@ static ir_type *lower_mtp(lowering_env_t const *const env, ir_type *mtp)
assert(nn_ress <= n_ress*2);
assert(nn_params <= n_params + n_ress);
+ unsigned cconv = get_method_calling_convention(mtp);
+ if (nn_params > n_params)
+ cconv |= cc_compound_ret;
+
/* create the new type */
bool const is_variadic = is_method_variadic(mtp);
- lowered = new_type_method(nn_params, nn_ress, is_variadic);
+ lowered = new_type_method(nn_params, nn_ress, is_variadic, cconv);
set_type_dbg_info(lowered, get_type_dbg_info(mtp));
/* fill it */
@@ -190,12 +194,6 @@ static ir_type *lower_mtp(lowering_env_t const *const env, ir_type *mtp)
for (size_t i = 0; i < nn_ress; ++i)
set_method_res_type(lowered, i, results[i]);
- unsigned cconv = get_method_calling_convention(mtp);
- if (nn_params > n_params) {
- cconv |= cc_compound_ret;
- }
- set_method_calling_convention(lowered, cconv);
-
mtp_additional_properties mtp_properties = get_method_additional_properties(mtp);
/* after lowering the call is not pure anymore, since it writes to the
* memory for the return value passed to it */
diff --git a/ir/lower/lower_copyb.c b/ir/lower/lower_copyb.c
index 572f323..246567a 100644
--- a/ir/lower/lower_copyb.c
+++ b/ir/lower/lower_copyb.c
@@ -92,7 +92,7 @@ static void lower_small_copyb_node(ir_node *irn)
static ir_type *get_memcpy_methodtype(void)
{
- ir_type *tp = new_type_method(3, 1, false);
+ ir_type *tp = new_type_method(3, 1, false, cc_cdecl_set);
ir_mode *size_t_mode = get_ir_mode(native_mode_bytes);
set_method_param_type(tp, 0, get_type_for_mode(mode_P));
diff --git a/ir/lower/lower_dw.c b/ir/lower/lower_dw.c
index cfc0806..caa7183 100644
--- a/ir/lower/lower_dw.c
+++ b/ir/lower/lower_dw.c
@@ -149,7 +149,7 @@ static ir_type *get_conv_type(ir_mode *imode, ir_mode *omode)
n_res = 2;
/* create a new method type */
- mtd = new_type_method(n_param, n_res, false);
+ mtd = new_type_method(n_param, n_res, false, cc_cdecl_set);
/* set param types and result types */
n_param = 0;
@@ -1571,8 +1571,9 @@ static ir_type *lower_mtp(ir_type *mtp)
return mtp;
}
- bool const is_variadic = is_method_variadic(mtp);
- res = new_type_method(n_param, n_res, is_variadic);
+ bool const is_variadic = is_method_variadic(mtp);
+ unsigned const cc_mask = get_method_calling_convention(mtp);
+ res = new_type_method(n_param, n_res, is_variadic, cc_mask);
set_type_dbg_info(res, get_type_dbg_info(mtp));
/* set param types and result types */
@@ -2113,7 +2114,8 @@ static ir_type *lower_Builtin_type(pmap *const type_map, ir_type *const mtp, ir_
return mtp;
}
- res = new_type_method(n_params, n_results, false);
+ unsigned const cc_mask = get_method_calling_convention(mtp);
+ res = new_type_method(n_params, n_results, false, cc_mask);
set_type_dbg_info(res, get_type_dbg_info(mtp));
/* set param types and result types */
@@ -2587,7 +2589,7 @@ static int lower_mux_cb(ir_node *mux)
static ir_type *make_type_4_2(ir_type *const even, ir_type *const odd)
{
- ir_type *const tp = new_type_method(4, 2, false);
+ ir_type *const tp = new_type_method(4, 2, false, cc_cdecl_set);
set_method_param_type(tp, 0, even);
set_method_param_type(tp, 1, odd);
set_method_param_type(tp, 2, even);
@@ -2599,7 +2601,7 @@ static ir_type *make_type_4_2(ir_type *const even, ir_type *const odd)
static ir_type *make_type_2_2(ir_type *const even, ir_type *const odd)
{
- ir_type *const tp = new_type_method(2, 2, false);
+ ir_type *const tp = new_type_method(2, 2, false, cc_cdecl_set);
set_method_param_type(tp, 0, even);
set_method_param_type(tp, 1, odd);
set_method_res_type(tp, 0, even);
diff --git a/ir/lower/lower_softfloat.c b/ir/lower/lower_softfloat.c
index 84b0602..3fc3464 100644
--- a/ir/lower/lower_softfloat.c
+++ b/ir/lower/lower_softfloat.c
@@ -327,10 +327,11 @@ static ir_type *lower_method_type(ir_type *mtp)
if (res != NULL)
return res;
- size_t const n_param = get_method_n_params(mtp);
- size_t const n_res = get_method_n_ress(mtp);
- bool const is_variadic = is_method_variadic(mtp);
- res = new_type_method(n_param, n_res, is_variadic);
+ size_t const n_param = get_method_n_params(mtp);
+ size_t const n_res = get_method_n_ress(mtp);
+ bool const is_variadic = is_method_variadic(mtp);
+ unsigned const cc_mask = get_method_calling_convention(mtp);
+ res = new_type_method(n_param, n_res, is_variadic, cc_mask);
/* set param types and result types */
for (size_t i = 0; i < n_param; ++i) {
@@ -765,7 +766,7 @@ static void make_binop_type(ir_type **const memoized, ir_type *const left,
ir_type *const right, ir_type *const res)
{
if (!*memoized) {
- ir_type *const type = *memoized = new_type_method(2, 1, false);
+ ir_type *const type = *memoized = new_type_method(2, 1, false, cc_cdecl_set);
set_method_param_type(type, 0, left);
set_method_param_type(type, 1, right);
set_method_res_type( type, 0, res);
@@ -776,7 +777,7 @@ static void make_unop_type(ir_type **const memoized, ir_type *const op,
ir_type *const res)
{
if (!*memoized) {
- ir_type *const type = *memoized = new_type_method(1, 1, false);
+ ir_type *const type = *memoized = new_type_method(1, 1, false, cc_cdecl_set);
set_method_param_type(type, 0, op);
set_method_res_type( type, 0, res);
}