From 0064ee54b41c007b5d33b557d053e602ac3be2cc Mon Sep 17 00:00:00 2001 From: Matthias Braun Date: Tue, 25 May 2010 13:42:23 +0000 Subject: [PATCH] change firm API so the firm_parameter_t struct becomes completely optional and deprecated (because good libraries only export functions and opaque types - this makes bindings to other languages considerably easier) [r27584] --- include/libfirm/firm_common.h | 5 ++++- include/libfirm/firmstat.h | 1 + include/libfirm/ircons.h | 3 +++ include/libfirm/typerep.h | 3 --- ir/common/firm.c | 4 ++-- ir/ir/ircons.c | 5 +++-- ir/ir/ircons_t.h | 10 ---------- ir/tr/type.c | 12 +----------- ir/tr/type_t.h | 4 +--- 9 files changed, 15 insertions(+), 32 deletions(-) diff --git a/include/libfirm/firm_common.h b/include/libfirm/firm_common.h index 668ac7497..28b578b41 100644 --- a/include/libfirm/firm_common.h +++ b/include/libfirm/firm_common.h @@ -68,7 +68,10 @@ struct _firm_parameter_t { ident_if_t *id_if; /** - * The default calling convention. + * dummy parameter + * (this used to hold a default calling convention, but this concept is no + * more. You should always set the calling convention manually after + * creating the method entity if you need something else) */ unsigned cc_mask; diff --git a/include/libfirm/firmstat.h b/include/libfirm/firmstat.h index 0ac038e26..54a49efef 100644 --- a/include/libfirm/firmstat.h +++ b/include/libfirm/firmstat.h @@ -188,6 +188,7 @@ FIRM_API ir_prog_pass_t *stat_dump_snapshot_pass( /** * initialize the statistics module. + * Should be called directly after ir_init * * @param enable_options a bitmask containing the statistic options */ diff --git a/include/libfirm/ircons.h b/include/libfirm/ircons.h index 2f35b095f..1036d81f7 100644 --- a/include/libfirm/ircons.h +++ b/include/libfirm/ircons.h @@ -4609,6 +4609,9 @@ FIRM_API ir_type *get_cur_frame_type(void); * e.g., that no more subtypes will be added. */ FIRM_API void irp_finalize_cons(void); +FIRM_API void ir_set_uninitialized_local_variable_func( + uninitialized_local_variable_func_t *func); + #include "end.h" #endif diff --git a/include/libfirm/typerep.h b/include/libfirm/typerep.h index 3b8de538d..782c95f4f 100644 --- a/include/libfirm/typerep.h +++ b/include/libfirm/typerep.h @@ -1740,9 +1740,6 @@ typedef enum { /** fastcall calling convention */ #define cc_fastcall_set (cc_reg_param|cc_callee_clear_stk) -/** Returns the default calling convention for method types. */ -FIRM_API unsigned get_default_cc_mask(void); - /** * check for the CDECL calling convention */ diff --git a/ir/common/firm.c b/ir/common/firm.c index 97569391f..e6d3196b4 100644 --- a/ir/common/firm.c +++ b/ir/common/firm.c @@ -111,7 +111,7 @@ void ir_init(const firm_parameter_t *param) /* initialize all op codes an irnode can consist of */ init_op(); /* called once for each run of this library */ - firm_init_cons(def_params.initialize_local_func); + ir_set_uninitialized_local_variable_func(def_params.initialize_local_func); /* initialize reassociation */ firm_init_reassociation(); /* initialize function call optimization */ @@ -124,7 +124,7 @@ void ir_init(const firm_parameter_t *param) later. */ init_irprog_2(); /* Initialize the type module and construct some idents needed. */ - firm_init_type(def_params.cc_mask); + firm_init_type(); /* initialize the entity module */ firm_init_entity(); /* class cast optimization */ diff --git a/ir/ir/ircons.c b/ir/ir/ircons.c index 55937c70c..852196cf4 100644 --- a/ir/ir/ircons.c +++ b/ir/ir/ircons.c @@ -1476,10 +1476,11 @@ ir_type *get_cur_frame_type(void) /* initialize */ /* call once for each run of the library */ -void firm_init_cons(uninitialized_local_variable_func_t *func) +void ir_set_uninitialized_local_variable_func( + uninitialized_local_variable_func_t *func) { default_initialize_local_variable = func; -} /* firm_init_cons */ +} void irp_finalize_cons(void) { diff --git a/ir/ir/ircons_t.h b/ir/ir/ircons_t.h index 46066ccef..99e56685a 100644 --- a/ir/ir/ircons_t.h +++ b/ir/ir/ircons_t.h @@ -30,16 +30,6 @@ #include "ircons.h" #include "irgraph_t.h" -/** - * Initializes the graph construction. - * - * @param func callback that is called if a uninitialized - * variable is detected - * - * @see uninitialized_local_variable_func_t - */ -void firm_init_cons(uninitialized_local_variable_func_t *func); - /** * Creates a new Anchor node. */ diff --git a/ir/tr/type.c b/ir/tr/type.c index 7553fb685..30a9bf442 100644 --- a/ir/tr/type.c +++ b/ir/tr/type.c @@ -85,17 +85,8 @@ ir_type *get_unknown_type(void) static ident *value_params_suffix = NULL; static ident *value_ress_suffix = NULL; -/** The default calling convention for method types. */ -static unsigned default_cc_mask; - -unsigned get_default_cc_mask(void) -{ - return default_cc_mask; -} - -void firm_init_type(unsigned def_cc_mask) +void firm_init_type(void) { - default_cc_mask = def_cc_mask; value_params_suffix = new_id_from_str(VALUE_PARAMS_SUFFIX); value_ress_suffix = new_id_from_str(VALUE_RESS_SUFFIX); @@ -1215,7 +1206,6 @@ ir_type *new_d_type_method(int n_param, int n_res, type_dbg_info *db) res->attr.ma.variadicity = variadicity_non_variadic; res->attr.ma.first_variadic_param = -1; res->attr.ma.additional_properties = mtp_no_property; - res->attr.ma.irg_calling_conv = default_cc_mask; hook_new_type(res); return res; } diff --git a/ir/tr/type_t.h b/ir/tr/type_t.h index 8dad4d746..7f9c33fdf 100644 --- a/ir/tr/type_t.h +++ b/ir/tr/type_t.h @@ -283,10 +283,8 @@ void remove_compound_member(ir_type *compound, ir_entity *entity); /** * Initialize the type module. - * - * @param default_cc_mask default calling conventions for methods */ -void firm_init_type(unsigned default_cc_mask); +void firm_init_type(void); /** Clone an existing method type. * -- 2.20.1