Commit 1a643e44 authored by Christoph Mallon's avatar Christoph Mallon
Browse files

Set the additional properties right when construction a method type.

parent cc80f54f
...@@ -1200,7 +1200,7 @@ FIRM_API int is_Union_type(const ir_type *uni); ...@@ -1200,7 +1200,7 @@ FIRM_API int is_Union_type(const ir_type *uni);
* The arrays for the parameter and result types are not initialized by * The arrays for the parameter and result types are not initialized by
* the constructor. * the constructor.
*/ */
FIRM_API ir_type *new_type_method(size_t n_param, size_t n_res, int is_variadic, unsigned cc_mask); FIRM_API ir_type *new_type_method(size_t n_param, size_t n_res, int is_variadic, unsigned cc_mask, mtp_additional_properties property_mask);
/** Returns the number of parameters of this method. */ /** Returns the number of parameters of this method. */
FIRM_API size_t get_method_n_params(const ir_type *method); FIRM_API size_t get_method_n_params(const ir_type *method);
...@@ -1224,14 +1224,6 @@ FIRM_API int is_method_variadic(ir_type const *method); ...@@ -1224,14 +1224,6 @@ FIRM_API int is_method_variadic(ir_type const *method);
/** Returns the mask of the additional graph properties. */ /** Returns the mask of the additional graph properties. */
FIRM_API mtp_additional_properties get_method_additional_properties(const ir_type *method); FIRM_API mtp_additional_properties get_method_additional_properties(const ir_type *method);
/** Sets the mask of the additional graph properties. */
FIRM_API void set_method_additional_properties(ir_type *method,
mtp_additional_properties property_mask);
/** Sets one additional graph property. */
FIRM_API void add_method_additional_properties(ir_type *method,
mtp_additional_properties flag);
/** /**
* Calling conventions: lower 24 bits are the number of register parameters, * Calling conventions: lower 24 bits are the number of register parameters,
* upper 8 encode the calling conventions. * upper 8 encode the calling conventions.
......
...@@ -898,8 +898,8 @@ static ir_type *clone_type_and_cache(ir_type *const tp, bool const is_variadic) ...@@ -898,8 +898,8 @@ static ir_type *clone_type_and_cache(ir_type *const tp, bool const is_variadic)
{ {
ir_type *res = pmap_get(ir_type, mtp_map, tp); ir_type *res = pmap_get(ir_type, mtp_map, tp);
if (res == NULL) { if (res == NULL) {
res = clone_type_method(tp, is_variadic); mtp_additional_properties const props = get_method_additional_properties(tp);
add_method_additional_properties(res, mtp_property_private); res = clone_type_method(tp, is_variadic, props | mtp_property_private);
pmap_insert(mtp_map, tp, res); pmap_insert(mtp_map, tp, res);
} }
......
...@@ -117,7 +117,7 @@ static void handle_intrinsic(ir_node *node, void *data) ...@@ -117,7 +117,7 @@ static void handle_intrinsic(ir_node *node, void *data)
static ir_type *make_divmod_type(ir_type *const tp) static ir_type *make_divmod_type(ir_type *const tp)
{ {
ir_type *const mtp = new_type_method(2, 1, false, cc_cdecl_set); ir_type *const mtp = new_type_method(2, 1, false, cc_cdecl_set, mtp_no_property);
set_method_param_type(mtp, 0, tp); set_method_param_type(mtp, 0, tp);
set_method_param_type(mtp, 1, tp); set_method_param_type(mtp, 1, tp);
set_method_res_type(mtp, 0, tp); set_method_res_type(mtp, 0, tp);
......
...@@ -106,7 +106,7 @@ static ir_entity *uldivmod; ...@@ -106,7 +106,7 @@ static ir_entity *uldivmod;
static ir_entity *make_divmod(char const *const name, ir_type *const even, ir_type *const odd) static ir_entity *make_divmod(char const *const name, ir_type *const even, ir_type *const odd)
{ {
ir_type *const mtp = new_type_method(4, 4, false, cc_cdecl_set); ir_type *const mtp = new_type_method(4, 4, false, cc_cdecl_set, mtp_no_property);
set_method_param_type(mtp, 0, even); set_method_param_type(mtp, 0, even);
set_method_param_type(mtp, 1, odd); set_method_param_type(mtp, 1, odd);
set_method_param_type(mtp, 2, even); set_method_param_type(mtp, 2, even);
......
...@@ -1135,7 +1135,7 @@ static void ia32_select_instructions(ir_graph *irg) ...@@ -1135,7 +1135,7 @@ static void ia32_select_instructions(ir_graph *irg)
static ir_entity *mcount = NULL; static ir_entity *mcount = NULL;
if (mcount == NULL) { if (mcount == NULL) {
ir_type *tp = new_type_method(0, 0, false, cc_cdecl_set); ir_type *tp = new_type_method(0, 0, false, cc_cdecl_set, mtp_no_property);
ident *id = new_id_from_str("mcount"); ident *id = new_id_from_str("mcount");
mcount = new_global_entity(get_glob_type(), id, tp, mcount = new_global_entity(get_glob_type(), id, tp,
ir_visibility_external, ir_visibility_external,
......
...@@ -1188,7 +1188,7 @@ zero_neg: ...@@ -1188,7 +1188,7 @@ zero_neg:
static ir_type *get_thunk_type(void) static ir_type *get_thunk_type(void)
{ {
if (!thunk_type) { if (!thunk_type) {
ir_type *const tp = new_type_method(0, 1, false, cc_cdecl_set); ir_type *const tp = new_type_method(0, 1, false, cc_cdecl_set, mtp_no_property);
set_method_res_type(tp, 0, get_type_for_mode(mode_P)); set_method_res_type(tp, 0, get_type_for_mode(mode_P));
thunk_type = tp; thunk_type = tp;
} }
......
...@@ -288,7 +288,7 @@ static void handle_intrinsic(ir_node *node, void *data) ...@@ -288,7 +288,7 @@ static void handle_intrinsic(ir_node *node, void *data)
static ir_type *make_mod_type(ir_type *const tp) static ir_type *make_mod_type(ir_type *const tp)
{ {
ir_type *const mtp = new_type_method(2, 1, false, cc_cdecl_set); ir_type *const mtp = new_type_method(2, 1, false, cc_cdecl_set, mtp_no_property);
set_method_param_type(mtp, 0, tp); set_method_param_type(mtp, 0, tp);
set_method_param_type(mtp, 1, tp); set_method_param_type(mtp, 1, tp);
set_method_res_type(mtp, 0, tp); set_method_res_type(mtp, 0, tp);
......
...@@ -161,7 +161,8 @@ bool sparc_variadic_fixups(ir_graph *irg, calling_convention_t *cconv) ...@@ -161,7 +161,8 @@ bool sparc_variadic_fixups(ir_graph *irg, calling_convention_t *cconv)
size_t const n_ress = get_method_n_ress(mtp); size_t const n_ress = get_method_n_ress(mtp);
size_t const new_n_params = n_params + (SPARC_N_PARAM_REGS - cconv->n_param_regs); size_t const new_n_params = n_params + (SPARC_N_PARAM_REGS - cconv->n_param_regs);
unsigned const cc_mask = get_method_calling_convention(mtp); unsigned const cc_mask = get_method_calling_convention(mtp);
ir_type *const new_mtp = new_type_method(new_n_params, n_ress, true, cc_mask); mtp_additional_properties const props = get_method_additional_properties(mtp);
ir_type *const new_mtp = new_type_method(new_n_params, n_ress, true, cc_mask, props);
type_dbg_info *const dbgi = get_type_dbg_info(mtp); type_dbg_info *const dbgi = get_type_dbg_info(mtp);
set_type_dbg_info(new_mtp, dbgi); set_type_dbg_info(new_mtp, dbgi);
...@@ -182,7 +183,6 @@ bool sparc_variadic_fixups(ir_graph *irg, calling_convention_t *cconv) ...@@ -182,7 +183,6 @@ bool sparc_variadic_fixups(ir_graph *irg, calling_convention_t *cconv)
new_parameter_entity(frame_type, i, gp_reg_type); new_parameter_entity(frame_type, i, gp_reg_type);
} }
copy_method_properties(new_mtp, mtp);
set_higher_type(new_mtp, mtp); set_higher_type(new_mtp, mtp);
set_entity_type(entity, new_mtp); set_entity_type(entity, new_mtp);
......
...@@ -1634,7 +1634,7 @@ static void read_type(read_env_t *env) ...@@ -1634,7 +1634,7 @@ static void read_type(read_env_t *env)
size_t const nparams = read_size_t(env); size_t const nparams = read_size_t(env);
size_t const nresults = read_size_t(env); size_t const nresults = read_size_t(env);
bool const is_variadic = read_long(env); bool const is_variadic = read_long(env);
type = new_type_method(nparams, nresults, is_variadic, callingconv); type = new_type_method(nparams, nresults, is_variadic, callingconv, addprops);
for (size_t i = 0; i < nparams; i++) { for (size_t i = 0; i < nparams; i++) {
long ptypenr = read_long(env); long ptypenr = read_long(env);
...@@ -1649,7 +1649,6 @@ static void read_type(read_env_t *env) ...@@ -1649,7 +1649,6 @@ static void read_type(read_env_t *env)
set_method_res_type(type, i, restype); set_method_res_type(type, i, restype);
} }
set_method_additional_properties(type, addprops);
goto finish_type; goto finish_type;
} }
......
...@@ -152,7 +152,7 @@ static void add_constructor(ir_entity *method) ...@@ -152,7 +152,7 @@ static void add_constructor(ir_entity *method)
static ir_entity *get_init_firmprof_ref(void) static ir_entity *get_init_firmprof_ref(void)
{ {
ident *const init_name = new_id_from_str("__init_firmprof"); ident *const init_name = new_id_from_str("__init_firmprof");
ir_type *const init_type = new_type_method(3, 0, false, cc_cdecl_set); ir_type *const init_type = new_type_method(3, 0, false, cc_cdecl_set, mtp_no_property);
ir_type *const uint = get_type_for_mode(mode_Iu); ir_type *const uint = get_type_for_mode(mode_Iu);
ir_type *const uintptr = new_type_pointer(uint); ir_type *const uintptr = new_type_pointer(uint);
ir_type *const string = new_type_pointer(get_type_for_mode(mode_Bs)); ir_type *const string = new_type_pointer(get_type_for_mode(mode_Bs));
...@@ -177,7 +177,7 @@ static ir_graph *gen_initializer_irg(ir_entity *ent_filename, ir_entity *bblock_ ...@@ -177,7 +177,7 @@ static ir_graph *gen_initializer_irg(ir_entity *ent_filename, ir_entity *bblock_
{ {
ident *const name = new_id_from_str("__firmprof_initializer"); ident *const name = new_id_from_str("__firmprof_initializer");
ir_type *const owner = get_glob_type(); ir_type *const owner = get_glob_type();
ir_type *const type = new_type_method(0, 0, false, cc_cdecl_set); ir_type *const type = new_type_method(0, 0, false, cc_cdecl_set, mtp_no_property);
ir_entity *const ent = new_global_entity(owner, name, type, ir_visibility_local, IR_LINKAGE_DEFAULT); ir_entity *const ent = new_global_entity(owner, name, type, ir_visibility_local, IR_LINKAGE_DEFAULT);
ir_graph *const irg = new_ir_graph(ent, 0); ir_graph *const irg = new_ir_graph(ent, 0);
......
...@@ -95,7 +95,7 @@ static void widen_builtin(ir_node *node) ...@@ -95,7 +95,7 @@ static void widen_builtin(ir_node *node)
ir_type *new_arg1 = get_type_for_mode(target_mode); ir_type *new_arg1 = get_type_for_mode(target_mode);
ir_type *new_result = get_method_res_type(mtp, 0); 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_param_type(new_type, 0, new_arg1);
set_method_res_type(new_type, 0, new_result); set_method_res_type(new_type, 0, new_result);
set_Builtin_type(node, new_type); set_Builtin_type(node, new_type);
......
...@@ -183,9 +183,14 @@ static ir_type *lower_mtp(lowering_env_t const *const env, ir_type *mtp) ...@@ -183,9 +183,14 @@ static ir_type *lower_mtp(lowering_env_t const *const env, ir_type *mtp)
if (nn_params > n_params) if (nn_params > n_params)
cconv |= cc_compound_ret; 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 */ /* create the new type */
bool const is_variadic = is_method_variadic(mtp); 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)); set_type_dbg_info(lowered, get_type_dbg_info(mtp));
/* fill it */ /* fill it */
...@@ -194,12 +199,6 @@ static ir_type *lower_mtp(lowering_env_t const *const env, ir_type *mtp) ...@@ -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) for (size_t i = 0; i < nn_ress; ++i)
set_method_res_type(lowered, i, results[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 */ /* associate the lowered type with the original one for easier access */
set_higher_type(lowered, mtp); set_higher_type(lowered, mtp);
pmap_insert(lowered_mtps, mtp, lowered); pmap_insert(lowered_mtps, mtp, lowered);
......
...@@ -92,7 +92,7 @@ static void lower_small_copyb_node(ir_node *irn) ...@@ -92,7 +92,7 @@ static void lower_small_copyb_node(ir_node *irn)
static ir_type *get_memcpy_methodtype(void) 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); ir_mode *size_t_mode = get_ir_mode(native_mode_bytes);
set_method_param_type(tp, 0, get_type_for_mode(mode_P)); set_method_param_type(tp, 0, get_type_for_mode(mode_P));
......
...@@ -149,7 +149,7 @@ static ir_type *get_conv_type(ir_mode *imode, ir_mode *omode) ...@@ -149,7 +149,7 @@ static ir_type *get_conv_type(ir_mode *imode, ir_mode *omode)
n_res = 2; n_res = 2;
/* create a new method type */ /* 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 */ /* set param types and result types */
n_param = 0; n_param = 0;
...@@ -1573,7 +1573,8 @@ static ir_type *lower_mtp(ir_type *mtp) ...@@ -1573,7 +1573,8 @@ static ir_type *lower_mtp(ir_type *mtp)
bool const is_variadic = is_method_variadic(mtp); bool const is_variadic = is_method_variadic(mtp);
unsigned const cc_mask = get_method_calling_convention(mtp); unsigned const cc_mask = get_method_calling_convention(mtp);
res = new_type_method(n_param, n_res, is_variadic, cc_mask); 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_type_dbg_info(res, get_type_dbg_info(mtp));
/* set param types and result types */ /* set param types and result types */
...@@ -1624,8 +1625,6 @@ static ir_type *lower_mtp(ir_type *mtp) ...@@ -1624,8 +1625,6 @@ static ir_type *lower_mtp(ir_type *mtp)
set_method_res_type(res, n_res++, tp); set_method_res_type(res, n_res++, tp);
} }
copy_method_properties(res, mtp);
set_higher_type(res, mtp); set_higher_type(res, mtp);
set_type_link(res, mtp); set_type_link(res, mtp);
...@@ -2115,15 +2114,14 @@ static ir_type *lower_Builtin_type(pmap *const type_map, ir_type *const mtp, ir_ ...@@ -2115,15 +2114,14 @@ static ir_type *lower_Builtin_type(pmap *const type_map, ir_type *const mtp, ir_
} }
unsigned const cc_mask = get_method_calling_convention(mtp); unsigned const cc_mask = get_method_calling_convention(mtp);
res = new_type_method(n_params, n_results, false, cc_mask); 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_type_dbg_info(res, get_type_dbg_info(mtp));
/* set param types and result types */ /* 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_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); 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); pmap_insert(type_map, mtp, res);
return res; return res;
} }
...@@ -2589,7 +2587,7 @@ static int lower_mux_cb(ir_node *mux) ...@@ -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) 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, 0, even);
set_method_param_type(tp, 1, odd); set_method_param_type(tp, 1, odd);
set_method_param_type(tp, 2, even); 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) ...@@ -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) 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, 0, even);
set_method_param_type(tp, 1, odd); set_method_param_type(tp, 1, odd);
set_method_res_type(tp, 0, even); set_method_res_type(tp, 0, even);
......
...@@ -331,7 +331,8 @@ static ir_type *lower_method_type(ir_type *mtp) ...@@ -331,7 +331,8 @@ static ir_type *lower_method_type(ir_type *mtp)
size_t const n_res = get_method_n_ress(mtp); size_t const n_res = get_method_n_ress(mtp);
bool const is_variadic = is_method_variadic(mtp); bool const is_variadic = is_method_variadic(mtp);
unsigned const cc_mask = get_method_calling_convention(mtp); unsigned const cc_mask = get_method_calling_convention(mtp);
res = new_type_method(n_param, n_res, is_variadic, cc_mask); 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 */ /* set param types and result types */
for (size_t i = 0; i < n_param; ++i) { for (size_t i = 0; i < n_param; ++i) {
...@@ -355,8 +356,6 @@ static ir_type *lower_method_type(ir_type *mtp) ...@@ -355,8 +356,6 @@ static ir_type *lower_method_type(ir_type *mtp)
set_method_res_type(res, i, rtp); set_method_res_type(res, i, rtp);
} }
copy_method_properties(res, mtp);
set_higher_type(res, mtp); set_higher_type(res, mtp);
pmap_insert(lowered_type, mtp, res); pmap_insert(lowered_type, mtp, res);
...@@ -766,7 +765,7 @@ static void make_binop_type(ir_type **const memoized, ir_type *const left, ...@@ -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) ir_type *const right, ir_type *const res)
{ {
if (!*memoized) { 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, 0, left);
set_method_param_type(type, 1, right); set_method_param_type(type, 1, right);
set_method_res_type( type, 0, res); set_method_res_type( type, 0, res);
...@@ -777,7 +776,7 @@ static void make_unop_type(ir_type **const memoized, ir_type *const op, ...@@ -777,7 +776,7 @@ static void make_unop_type(ir_type **const memoized, ir_type *const op,
ir_type *const res) ir_type *const res)
{ {
if (!*memoized) { 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_param_type(type, 0, op);
set_method_res_type( type, 0, res); set_method_res_type( type, 0, res);
} }
......
...@@ -423,7 +423,7 @@ static void change_entity_type(const quadruple_t *q, ir_entity *ent) ...@@ -423,7 +423,7 @@ static void change_entity_type(const quadruple_t *q, ir_entity *ent)
/* Create the new type for our clone. It must have one parameter /* Create the new type for our clone. It must have one parameter
less then the original.*/ less then the original.*/
ir_type *const new_mtp = new_type_method(n_params - 1, n_ress, false, cc_cdecl_set); ir_type *const new_mtp = new_type_method(n_params - 1, n_ress, false, cc_cdecl_set, mtp_no_property);
/* We must set the type of the methods parameters.*/ /* We must set the type of the methods parameters.*/
for (size_t i = 0, j = 0; i < n_params; ++i) { for (size_t i = 0, j = 0; i < n_params; ++i) {
......
...@@ -519,7 +519,7 @@ int (is_Struct_type)(const ir_type *strct) ...@@ -519,7 +519,7 @@ int (is_Struct_type)(const ir_type *strct)
return is_struct_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); ir_type *res = new_type(tpo_method, sizeof(method_attr), mode_P);
res->flags |= tf_layout_fixed; 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_ ...@@ -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.res_type = XMALLOCNZ(ir_type*, n_res);
res->attr.method.variadic = is_variadic; res->attr.method.variadic = is_variadic;
res->attr.method.irg_calling_conv = cc_mask; 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); set_type_alignment(res, 1);
hook_new_type(res); hook_new_type(res);
return 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)); assert(is_Method_type(tp));
ir_mode *mode = tp->mode; ir_mode *mode = tp->mode;
...@@ -556,7 +556,7 @@ ir_type *clone_type_method(ir_type *const tp, bool const is_variadic) ...@@ -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); res->attr.method.res_type = XMALLOCN(ir_type*, n_res);
MEMCPY(res->attr.method.res_type, tp->attr.method.res_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.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; res->attr.method.irg_calling_conv = tp->attr.method.irg_calling_conv;
set_type_alignment(res, get_type_alignment(tp)); set_type_alignment(res, get_type_alignment(tp));
hook_new_type(res); hook_new_type(res);
...@@ -621,17 +621,6 @@ mtp_additional_properties (get_method_additional_properties)(const ir_type *meth ...@@ -621,17 +621,6 @@ mtp_additional_properties (get_method_additional_properties)(const ir_type *meth
return get_method_additional_properties_(method); 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) unsigned (get_method_calling_convention)(const ir_type *method)
{ {
return get_method_calling_convention_(method); return get_method_calling_convention_(method);
......
...@@ -46,8 +46,6 @@ ...@@ -46,8 +46,6 @@
#define get_method_n_params(method) get_method_n_params_(method) #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_n_ress(method) get_method_n_ress_(method)
#define get_method_additional_properties(method) get_method_additional_properties_(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_calling_convention(method) get_method_calling_convention_(method)
/** Compound type attributes. */ /** Compound type attributes. */
...@@ -159,10 +157,11 @@ void ir_finish_type(ir_prog *irp); ...@@ -159,10 +157,11 @@ void ir_finish_type(ir_prog *irp);
* *
* @param tp the method type to clone. * @param tp the method type to clone.
* @param is_variadic whether the cloned type is variadic * @param is_variadic whether the cloned type is variadic
* @param property_mask additional method properties for the cloned type
* *
* @return the cloned method 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; extern ir_visited_t firm_type_visited;
...@@ -341,18 +340,6 @@ static inline mtp_additional_properties get_method_additional_properties_(const ...@@ -341,18 +340,6 @@ static inline mtp_additional_properties get_method_additional_properties_(const
return method->attr.method.properties; 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) static inline unsigned get_method_calling_convention_(const ir_type *method)
{ {
assert(is_Method_type(method)); assert(is_Method_type(method));
...@@ -372,9 +359,4 @@ static inline bool is_aggregate_type(const ir_type *type) ...@@ -372,9 +359,4 @@ static inline bool is_aggregate_type(const ir_type *type)
ir_type *new_type_segment(ident *name, type_flags flags); 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 #endif
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment