Commit 622c00b8 authored by Michael Beck's avatar Michael Beck
Browse files

interface changed: outfile is transmitted to the isa, not to the code generators

parent 46270524
...@@ -30,10 +30,11 @@ ...@@ -30,10 +30,11 @@
#include "irprintf.h" #include "irprintf.h"
arch_env_t *arch_env_init(arch_env_t *env, const arch_isa_if_t *isa_if) /* Initialize the architecture environment struct. */
arch_env_t *arch_env_init(arch_env_t *env, const arch_isa_if_t *isa_if, FILE *file_handle)
{ {
memset(env, 0, sizeof(*env)); memset(env, 0, sizeof(*env));
env->isa = isa_if->init(); env->isa = isa_if->init(file_handle);
return env; return env;
} }
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
struct _be_node_factory_t; struct _be_node_factory_t;
typedef enum _arch_register_type_t { typedef enum _arch_register_type_t {
arch_register_type_none = 0, arch_register_type_none = 0,
arch_register_type_caller_save = 1, /**< The register must be saved by the caller arch_register_type_caller_save = 1, /**< The register must be saved by the caller
upon a function call. It thus can be overwritten upon a function call. It thus can be overwritten
in the called function. */ in the called function. */
...@@ -417,11 +417,10 @@ struct _arch_irn_handler_t { ...@@ -417,11 +417,10 @@ struct _arch_irn_handler_t {
struct _arch_code_generator_if_t { struct _arch_code_generator_if_t {
/** /**
* Initialize the code generator. * Initialize the code generator.
* @param file The file to dump to.
* @param birg A backend IRG session. * @param birg A backend IRG session.
* @return A newly created code generator. * @return A newly created code generator.
*/ */
void *(*init)(FILE *file, const be_irg_t *birg); void *(*init)(const be_irg_t *birg);
/** /**
* Called before abi introduce. * Called before abi introduce.
...@@ -500,8 +499,10 @@ struct _arch_isa_if_t { ...@@ -500,8 +499,10 @@ struct _arch_isa_if_t {
/** /**
* Initialize the isa interface. * Initialize the isa interface.
* @param file_handle the file handle to write the output to
* @return a new isa instance
*/ */
void *(*init)(void); void *(*init)(FILE *file_handle);
/** /**
* Free the isa instance. * Free the isa instance.
...@@ -610,10 +611,11 @@ struct _arch_env_t { ...@@ -610,10 +611,11 @@ struct _arch_env_t {
/** /**
* Initialize the architecture environment struct. * Initialize the architecture environment struct.
* @param isa The isa which shall be put into the environment. * @param isa The isa which shall be put into the environment.
* @param file_handle The file handle
* @return The environment. * @return The environment.
*/ */
extern arch_env_t *arch_env_init(arch_env_t *env, const arch_isa_if_t *isa); extern arch_env_t *arch_env_init(arch_env_t *env, const arch_isa_if_t *isa, FILE *file_handle);
/** /**
* Add a node handler to the environment. * Add a node handler to the environment.
......
...@@ -189,7 +189,7 @@ void be_init(void) ...@@ -189,7 +189,7 @@ void be_init(void)
phi_class_init(); phi_class_init();
} }
static be_main_env_t *be_init_env(be_main_env_t *env) static be_main_env_t *be_init_env(be_main_env_t *env, FILE *file_handle)
{ {
memset(env, 0, sizeof(*env)); memset(env, 0, sizeof(*env));
obstack_init(&env->obst); obstack_init(&env->obst);
...@@ -197,7 +197,7 @@ static be_main_env_t *be_init_env(be_main_env_t *env) ...@@ -197,7 +197,7 @@ static be_main_env_t *be_init_env(be_main_env_t *env)
env->options = &be_options; env->options = &be_options;
FIRM_DBG_REGISTER(env->dbg, "be.main"); FIRM_DBG_REGISTER(env->dbg, "be.main");
arch_env_init(env->arch_env, isa_if); arch_env_init(env->arch_env, isa_if, file_handle);
/* Register the irn handler of the architecture */ /* Register the irn handler of the architecture */
if (arch_isa_get_irn_handler(env->arch_env->isa)) if (arch_isa_get_irn_handler(env->arch_env->isa))
...@@ -270,7 +270,7 @@ static void be_main_loop(FILE *file_handle) ...@@ -270,7 +270,7 @@ static void be_main_loop(FILE *file_handle)
arch_isa_t *isa; arch_isa_t *isa;
be_main_env_t env; be_main_env_t env;
be_init_env(&env); be_init_env(&env, file_handle);
isa = arch_env_get_isa(env.arch_env); isa = arch_env_get_isa(env.arch_env);
...@@ -293,7 +293,7 @@ static void be_main_loop(FILE *file_handle) ...@@ -293,7 +293,7 @@ static void be_main_loop(FILE *file_handle)
cg_if = isa->impl->get_code_generator_if(isa); cg_if = isa->impl->get_code_generator_if(isa);
/* get a code generator for this graph. */ /* get a code generator for this graph. */
birg.cg = cg_if->init(file_handle, &birg); birg.cg = cg_if->init(&birg);
/* create the code generator and generate code. */ /* create the code generator and generate code. */
prepare_graph(&birg); prepare_graph(&birg);
......
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