Commit 7c0b52be authored by Michael Beck's avatar Michael Beck
Browse files

be_init now return parameters for the frontend

parent 51561559
......@@ -3,8 +3,29 @@
#define _BE_MAIN_H
#include <stdio.h>
#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.
......
......@@ -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
};
......
......@@ -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);
......
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