summaryrefslogtreecommitdiffhomepage
path: root/ir/lower
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/lower
parentcc80f54ffafd48a98732d0196265bd08ef790703 (diff)
Set the additional properties 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.c13
-rw-r--r--ir/lower/lower_copyb.c2
-rw-r--r--ir/lower/lower_dw.c22
-rw-r--r--ir/lower/lower_softfloat.c17
5 files changed, 26 insertions, 30 deletions
diff --git a/ir/lower/lower_builtins.c b/ir/lower/lower_builtins.c
index f1bd23e..ed669d8 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, cc_cdecl_set);
+ ir_type *new_type = new_type_method(1, 1, false, cc_cdecl_set, mtp_no_property);
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 41bba92..ed012c7 100644
--- a/ir/lower/lower_calls.c
+++ b/ir/lower/lower_calls.c
@@ -183,9 +183,14 @@ static ir_type *lower_mtp(lowering_env_t const *const env, ir_type *mtp)
if (nn_params > n_params)
cconv |= cc_compound_ret;
+ 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 */
+ mtp_properties &= ~(mtp_property_no_write | mtp_property_pure);
+
/* create the new type */
bool const is_variadic = is_method_variadic(mtp);
- lowered = new_type_method(nn_params, nn_ress, is_variadic, cconv);
+ lowered = new_type_method(nn_params, nn_ress, is_variadic, cconv, mtp_properties);
set_type_dbg_info(lowered, get_type_dbg_info(mtp));
/* fill it */
@@ -194,12 +199,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]);
- 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 */
- mtp_properties &= ~(mtp_property_no_write | mtp_property_pure);
- set_method_additional_properties(lowered, mtp_properties);
-
/* associate the lowered type with the original one for easier access */
set_higher_type(lowered, mtp);
pmap_insert(lowered_mtps, mtp, lowered);
diff --git a/ir/lower/lower_copyb.c b/ir/lower/lower_copyb.c
index 246567a..119811b 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, cc_cdecl_set);
+ ir_type *tp = new_type_method(3, 1, false, cc_cdecl_set, mtp_no_property);
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 caa7183..31d33f3 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, cc_cdecl_set);
+ mtd = new_type_method(n_param, n_res, false, cc_cdecl_set, mtp_no_property);
/* set param types and result types */
n_param = 0;
@@ -1571,9 +1571,10 @@ static ir_type *lower_mtp(ir_type *mtp)
return 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);
+ bool const is_variadic = is_method_variadic(mtp);
+ unsigned const cc_mask = get_method_calling_convention(mtp);
+ mtp_additional_properties const props = get_method_additional_properties(mtp);
+ res = new_type_method(n_param, n_res, is_variadic, cc_mask, props);
set_type_dbg_info(res, get_type_dbg_info(mtp));
/* set param types and result types */
@@ -1624,8 +1625,6 @@ static ir_type *lower_mtp(ir_type *mtp)
set_method_res_type(res, n_res++, tp);
}
- copy_method_properties(res, mtp);
-
set_higher_type(res, mtp);
set_type_link(res, mtp);
@@ -2114,16 +2113,15 @@ static ir_type *lower_Builtin_type(pmap *const type_map, ir_type *const mtp, ir_
return mtp;
}
- unsigned const cc_mask = get_method_calling_convention(mtp);
- res = new_type_method(n_params, n_results, false, cc_mask);
+ unsigned const cc_mask = get_method_calling_convention(mtp);
+ mtp_additional_properties const props = get_method_additional_properties(mtp);
+ res = new_type_method(n_params, n_results, false, cc_mask, props);
set_type_dbg_info(res, get_type_dbg_info(mtp));
/* set param types and result types */
lower_types_builtin(n_params, res, mtp, tp_s_l, tp_u, &get_method_param_type, &set_method_param_type);
lower_types_builtin(n_results, res, mtp, tp_s_l, tp_u, &get_method_res_type, &set_method_res_type);
- copy_method_properties(res, mtp);
-
pmap_insert(type_map, mtp, res);
return res;
}
@@ -2589,7 +2587,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, cc_cdecl_set);
+ ir_type *const tp = new_type_method(4, 2, false, cc_cdecl_set, mtp_no_property);
set_method_param_type(tp, 0, even);
set_method_param_type(tp, 1, odd);
set_method_param_type(tp, 2, even);
@@ -2601,7 +2599,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, cc_cdecl_set);
+ ir_type *const tp = new_type_method(2, 2, false, cc_cdecl_set, mtp_no_property);
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 3fc3464..8debf91 100644
--- a/ir/lower/lower_softfloat.c
+++ b/ir/lower/lower_softfloat.c
@@ -327,11 +327,12 @@ 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);
- unsigned const cc_mask = get_method_calling_convention(mtp);
- res = new_type_method(n_param, n_res, is_variadic, cc_mask);
+ 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);
+ mtp_additional_properties const props = get_method_additional_properties(mtp);
+ res = new_type_method(n_param, n_res, is_variadic, cc_mask, props);
/* set param types and result types */
for (size_t i = 0; i < n_param; ++i) {
@@ -355,8 +356,6 @@ static ir_type *lower_method_type(ir_type *mtp)
set_method_res_type(res, i, rtp);
}
- copy_method_properties(res, mtp);
-
set_higher_type(res, mtp);
pmap_insert(lowered_type, mtp, res);
@@ -766,7 +765,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, cc_cdecl_set);
+ ir_type *const type = *memoized = new_type_method(2, 1, false, cc_cdecl_set, mtp_no_property);
set_method_param_type(type, 0, left);
set_method_param_type(type, 1, right);
set_method_res_type( type, 0, res);
@@ -777,7 +776,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, cc_cdecl_set);
+ ir_type *const type = *memoized = new_type_method(1, 1, false, cc_cdecl_set, mtp_no_property);
set_method_param_type(type, 0, op);
set_method_res_type( type, 0, res);
}