Commit 52857722 authored by Matthias Braun's avatar Matthias Braun
Browse files

move some typedefs to firm_types, move functions from firm.h into firm_common.h

[r24498]
parent 9bb32875
...@@ -122,84 +122,6 @@ extern "C" { ...@@ -122,84 +122,6 @@ extern "C" {
#include "be.h" #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 #ifdef __cplusplus
} }
#endif #endif
......
...@@ -26,6 +26,88 @@ ...@@ -26,6 +26,88 @@
#ifndef FIRM_COMMON_FIRM_COMMON_H #ifndef FIRM_COMMON_FIRM_COMMON_H
#define 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 /** a list of firm kinds
@@@ not all datatypes are tagged yet. */ @@@ not all datatypes are tagged yet. */
typedef enum { typedef enum {
......
...@@ -51,6 +51,8 @@ typedef struct ir_exec_freq ir_exec_freq, *ir_exec_freq_ptr; ...@@ -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 ir_cdep ir_cdep, *ir_cdep_ptr;
typedef struct sn_entry *seqno_t; typedef struct sn_entry *seqno_t;
typedef struct arch_irn_ops_t arch_irn_ops_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; typedef union ir_initializer_t ir_initializer_t, *ir_initializer_ptr;
...@@ -75,6 +77,21 @@ typedef enum { ...@@ -75,6 +77,21 @@ typedef enum {
all still in the representation, but the graph is no more complete. */ all still in the representation, but the graph is no more complete. */
} ip_view_state; } 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 #endif
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
/** /**
* The ident module interface. * The ident module interface.
*/ */
typedef struct _ident_if_t { struct ident_if_t {
/** The handle. */ /** The handle. */
void *handle; void *handle;
...@@ -76,7 +76,7 @@ typedef struct _ident_if_t { ...@@ -76,7 +76,7 @@ typedef struct _ident_if_t {
* Finish the ident module and frees all idents, may be NULL. * Finish the ident module and frees all idents, may be NULL.
*/ */
void (*finish_ident)(void *handle); void (*finish_ident)(void *handle);
} ident_if_t; };
/** /**
* Store a string and create an ident. * Store a string and create an ident.
......
...@@ -4498,21 +4498,4 @@ void irp_finalize_cons(void); ...@@ -4498,21 +4498,4 @@ void irp_finalize_cons(void);
/* --- Initialization --- */ /* --- 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 #endif
...@@ -2555,12 +2555,12 @@ ir_type *mature_type_free_entities(ir_type *tp); ...@@ -2555,12 +2555,12 @@ ir_type *mature_type_free_entities(ir_type *tp);
/** /**
* The interface type for the type identify module; * 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. compare_types_func_t *cmp; /**< The function that should be used to compare two types.
If NULL, compare_strict() will be used. */ If NULL, compare_strict() will be used. */
hash_types_func_t *hash; /**< The function that should be used to calculate a hash 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. */ value of a type. If NULL, hash_name() will be used. */
} type_identify_if_t; };
/** /**
* Initialise the type identifier module. * Initialise the type identifier module.
......
Supports Markdown
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