From: Matthias Braun Date: Wed, 10 Dec 2008 19:05:14 +0000 (+0000) Subject: move some typedefs to firm_types, move functions from firm.h into firm_common.h X-Git-Url: http://nsz.repo.hu/git/?a=commitdiff_plain;h=52857722ee4190392a853669fc34d08d6022c9a8;p=libfirm move some typedefs to firm_types, move functions from firm.h into firm_common.h [r24498] --- diff --git a/include/libfirm/firm.h b/include/libfirm/firm.h index b0361c70b..8c60fcb5e 100644 --- a/include/libfirm/firm.h +++ b/include/libfirm/firm.h @@ -122,84 +122,6 @@ extern "C" { #include "be.h" -/** - * libFirm initialization parameters. - */ -struct _firm_parameter_t { - /** - * The size of this structure. init_firm() will only initialize - * this amount of data. This allows to add more fields to this structure - * without breaking compatibility to older source. - */ - unsigned int size; - - /** - * Statistic options. If statistic function where enabled, these - * flags configure it, see enum firmstat_options_t. - */ - unsigned enable_statistics; - - /** - * This function is called, whenever a local variable is - * used before definition. The function should insert a default value, - * and/or raise a compiler error/warning. Note that returning - * an Unknown is allowed here. - */ - uninitialized_local_variable_func_t *initialize_local_func; - - /** - * The interface functions for the type identification module. - * If not set, the default implementation with compare_strict() and - * firm_hash_name() will be used. - */ - type_identify_if_t *ti_if; - - /** - * The interface for the ident module. - * If not set, the default libFirm ident module (using hash sets). - */ - ident_if_t *id_if; - - /** - * The default calling convention. - */ - unsigned cc_mask; - - /** - * The debug info that should be used for "builtin" objects. - */ - dbg_info *builtin_dbg; -}; - -typedef struct _firm_parameter_t firm_parameter_t; - -/** - * Initialize the firm library. - * - * Initializes the firm library. Allocates default data structures. - * Initializes configurable behavior of the library. - * - * @param params A structure containing the parameters of the libFirm. - * - * The parameter struct may be NULL. In that case, the original FIRM behavior - * is conserved. - */ -void ir_init(const firm_parameter_t *params); - -/** - * Frees all memory occupied by the firm library. - */ -void ir_finish(void); - -/** returns the libFirm major version number */ -unsigned ir_get_version_major(void); -/** returns libFirm minor version number */ -unsigned ir_get_version_minor(void); -/** returns string describing libFirm revision */ -const char *ir_get_version_revision(void); -/** returns string describing libFirm build */ -const char *ir_get_version_build(void); - #ifdef __cplusplus } #endif diff --git a/include/libfirm/firm_common.h b/include/libfirm/firm_common.h index 590bc1b45..18e4ef44e 100644 --- a/include/libfirm/firm_common.h +++ b/include/libfirm/firm_common.h @@ -26,6 +26,88 @@ #ifndef FIRM_COMMON_FIRM_COMMON_H #define FIRM_COMMON_FIRM_COMMON_H +#include "firm_types.h" + +/** + * libFirm initialization parameters. + */ +struct _firm_parameter_t { + /** + * The size of this structure. init_firm() will only initialize + * this amount of data. This allows to add more fields to this structure + * without breaking compatibility to older source. + */ + unsigned int size; + + /** + * Statistic options. If statistic function where enabled, these + * flags configure it, see enum firmstat_options_t. + */ + unsigned enable_statistics; + + /** + * This function is called, whenever a local variable is + * used before definition. The function should insert a default value, + * and/or raise a compiler error/warning. Note that returning + * an Unknown is allowed here. + */ + uninitialized_local_variable_func_t *initialize_local_func; + + /** + * The interface functions for the type identification module. + * If not set, the default implementation with compare_strict() and + * firm_hash_name() will be used. + */ + type_identify_if_t *ti_if; + + /** + * The interface for the ident module. + * If not set, the default libFirm ident module (using hash sets). + */ + ident_if_t *id_if; + + /** + * The default calling convention. + */ + unsigned cc_mask; + + /** + * The debug info that should be used for "builtin" objects. + */ + dbg_info *builtin_dbg; +}; + +typedef struct _firm_parameter_t firm_parameter_t; + +/** + * Initialize the firm library. + * + * Initializes the firm library. Allocates default data structures. + * Initializes configurable behavior of the library. + * + * @param params A structure containing the parameters of the libFirm. + * + * The parameter struct may be NULL. In that case, the original FIRM behavior + * is conserved. + */ +void ir_init(const firm_parameter_t *params); + +/** + * Frees all memory occupied by the firm library. + */ +void ir_finish(void); + +/** returns the libFirm major version number */ +unsigned ir_get_version_major(void); +/** returns libFirm minor version number */ +unsigned ir_get_version_minor(void); +/** returns string describing libFirm revision */ +const char *ir_get_version_revision(void); +/** returns string describing libFirm build */ +const char *ir_get_version_build(void); + + + /** a list of firm kinds @@@ not all datatypes are tagged yet. */ typedef enum { diff --git a/include/libfirm/firm_types.h b/include/libfirm/firm_types.h index 3eb801e04..1d2c0f9e6 100644 --- a/include/libfirm/firm_types.h +++ b/include/libfirm/firm_types.h @@ -51,6 +51,8 @@ typedef struct ir_exec_freq ir_exec_freq, *ir_exec_freq_ptr; typedef struct ir_cdep ir_cdep, *ir_cdep_ptr; typedef struct sn_entry *seqno_t; typedef struct arch_irn_ops_t arch_irn_ops_t; +typedef struct ident_if_t ident_if_t; +typedef struct type_identify_if_t type_identify_if_t; typedef union ir_initializer_t ir_initializer_t, *ir_initializer_ptr; @@ -75,6 +77,21 @@ typedef enum { all still in the representation, but the graph is no more complete. */ } ip_view_state; - +/** + * This function is called, whenever a local variable is used before definition + * + * @param irg the IR graph on which this happens + * @param mode the mode of the local var + * @param pos position chosen be the frontend for this variable (n_loc) + * + * @return a firm node of mode @p mode that initializes the var at position pos + * + * @note + * Do not return NULL! + * If this function is not set, FIRM will create a const node with tarval BAD. + * Use set_irg_loc_description()/get_irg_loc_description() to assign additional + * informations to local variables. + */ +typedef ir_node *uninitialized_local_variable_func_t(ir_graph *irg, ir_mode *mode, int pos); #endif diff --git a/include/libfirm/ident.h b/include/libfirm/ident.h index 8e3c4298f..9b3e0086e 100644 --- a/include/libfirm/ident.h +++ b/include/libfirm/ident.h @@ -37,7 +37,7 @@ /** * The ident module interface. */ -typedef struct _ident_if_t { +struct ident_if_t { /** The handle. */ void *handle; @@ -76,7 +76,7 @@ typedef struct _ident_if_t { * Finish the ident module and frees all idents, may be NULL. */ void (*finish_ident)(void *handle); -} ident_if_t; +}; /** * Store a string and create an ident. diff --git a/include/libfirm/ircons.h b/include/libfirm/ircons.h index bbea40e89..2472a13b8 100644 --- a/include/libfirm/ircons.h +++ b/include/libfirm/ircons.h @@ -4498,21 +4498,4 @@ void irp_finalize_cons(void); /* --- Initialization --- */ -/** - * This function is called, whenever a local variable is used before definition - * - * @param irg the IR graph on which this happens - * @param mode the mode of the local var - * @param pos position chosen be the frontend for this variable (n_loc) - * - * @return a firm node of mode @p mode that initializes the var at position pos - * - * @note - * Do not return NULL! - * If this function is not set, FIRM will create a const node with tarval BAD. - * Use set_irg_loc_description()/get_irg_loc_description() to assign additional - * informations to local variables. - */ -typedef ir_node *uninitialized_local_variable_func_t(ir_graph *irg, ir_mode *mode, int pos); - #endif diff --git a/include/libfirm/typerep.h b/include/libfirm/typerep.h index 149c9be0f..42f123392 100644 --- a/include/libfirm/typerep.h +++ b/include/libfirm/typerep.h @@ -2555,12 +2555,12 @@ ir_type *mature_type_free_entities(ir_type *tp); /** * The interface type for the type identify module; */ -typedef struct _type_identify_if_t { +struct type_identify_if_t { compare_types_func_t *cmp; /**< The function that should be used to compare two types. If NULL, compare_strict() will be used. */ hash_types_func_t *hash; /**< The function that should be used to calculate a hash value of a type. If NULL, hash_name() will be used. */ -} type_identify_if_t; +}; /** * Initialise the type identifier module.