From 7c0b52be1885bfb12c5cc2acfd000cfd26482e87 Mon Sep 17 00:00:00 2001 From: Michael Beck Date: Thu, 11 May 2006 16:21:11 +0000 Subject: [PATCH] be_init now return parameters for the frontend --- ir/be/be.h | 26 +++++++++++++++++++++++++- ir/be/bearch.h | 14 ++++++++++---- ir/be/bemain.c | 16 ++++++++++++++-- 3 files changed, 49 insertions(+), 7 deletions(-) diff --git a/ir/be/be.h b/ir/be/be.h index 3df673228..5d04946c4 100644 --- a/ir/be/be.h +++ b/ir/be/be.h @@ -3,8 +3,29 @@ #define _BE_MAIN_H #include +#include "irarch.h" +#include "archop.h" +#include "lower_dw.h" #include "dbginfo.h" +/** + * This structure contains parameters that should be + * propagated to the libFirm parameter set. + */ +typedef struct backend_params { + /** Additional opcodes settings. */ + const arch_ops_info *arch_op_settings; + + /** Settings for architecture dependent optimizations */ + const arch_dep_params_t *dep_param; + + /** if set, the backend cannot handle DWORD access */ + unsigned do_dw_lowering; + + /** the architecture specific intrinsic function creator */ + create_intrinsic_fkt *arch_create_intrinsic_fkt; +} backend_params; + /** * Register the Firm backend command line options. */ @@ -17,8 +38,11 @@ int be_parse_arg(const char *arg); /** * Initialize the Firm backend. Must be run BEFORE init_firm()! + * + * @return libFirm configuration parameters for the selected + * backend */ -void be_init(void); +const backend_params *be_init(void); /** * Main interface to the frontend. diff --git a/ir/be/bearch.h b/ir/be/bearch.h index edb58e776..30404e977 100644 --- a/ir/be/bearch.h +++ b/ir/be/bearch.h @@ -598,11 +598,17 @@ struct _arch_isa_if_t { */ int (*get_reg_class_alignment)(const void *self, const arch_register_class_t *cls); + /** + * A "static" function, returns the frontend settings + * needed for this backend. + */ + const backend_params *(*get_params)(void); + #ifdef WITH_LIBCORE - /** - * Register command line options for this backend. - * @param grp The root group. - */ + /** + * Register command line options for this backend. + * @param grp The root group. + */ void (*register_options)(lc_opt_entry_t *grp); #endif }; diff --git a/ir/be/bemain.c b/ir/be/bemain.c index 8ed05fd3e..30a0cc4a8 100644 --- a/ir/be/bemain.c +++ b/ir/be/bemain.c @@ -186,8 +186,16 @@ int be_parse_arg(const char *arg) { #endif /* WITH_LIBCORE */ } +/** The be parameters returned by default, all off. */ +const static backend_params be_params = { + NULL, + NULL, + 0, + NULL, +}; -void be_init(void) +/* Initialize the Firm backend. Must be run BEFORE init_firm()! */ +const backend_params *be_init(void) { be_opt_register(); @@ -197,6 +205,10 @@ void be_init(void) be_copy_opt_init(); copystat_init(); phi_class_init(); + + if (isa_if->get_params) + return isa_if->get_params(); + return &be_params; } static be_main_env_t *be_init_env(be_main_env_t *env, FILE *file_handle) @@ -364,7 +376,7 @@ static void be_main_loop(FILE *file_handle) be_abi_fix_stack_bias(birg.abi); arch_code_generator_done(birg.cg); - dump(DUMP_FINAL, irg, "-end", dump_ir_block_graph_sched); + dump(DUMP_FINAL, irg, "-end", dump_ir_extblock_graph_sched); be_abi_free(birg.abi); // free_ir_graph(irg); -- 2.20.1