From aedba58f1f041b80aed30209f7fd4adae13da3c6 Mon Sep 17 00:00:00 2001 From: Sebastian Hack Date: Wed, 16 Nov 2005 14:19:55 +0000 Subject: [PATCH] Added irn_handler field to arch_isa_t --- ir/be/bearch.h | 10 +++++++++- ir/be/bearch_firm.c | 9 +++++---- ir/be/bemain.c | 15 ++++++++++----- 3 files changed, 24 insertions(+), 10 deletions(-) diff --git a/ir/be/bearch.h b/ir/be/bearch.h index 7ab8ae153..113eb98a8 100644 --- a/ir/be/bearch.h +++ b/ir/be/bearch.h @@ -468,11 +468,19 @@ struct _arch_isa_if_t { /** * Prepare a graph. - * This function is called each time, the backend starts running over + * This function is called each time, the back end starts running over * a graph. * @param irg The graph. */ void (*prepare_graph)(ir_graph *irg); + + /** + * The irn handler for this architecture. + * The irn handler is registered by the Firm back end + * when the architecture is initialized. + * (May be NULL). + */ + const arch_irn_handler_t *irn_handler; }; #define ARCH_MAX_HANDLERS 8 diff --git a/ir/be/bearch_firm.c b/ir/be/bearch_firm.c index e31311a74..159dc331c 100644 --- a/ir/be/bearch_firm.c +++ b/ir/be/bearch_firm.c @@ -484,8 +484,9 @@ static void firm_prepare_graph(ir_graph *irg) } const arch_isa_if_t firm_isa = { - firm_init, - firm_get_n_reg_class, - firm_get_reg_class, - firm_prepare_graph + firm_init, + firm_get_n_reg_class, + firm_get_reg_class, + firm_prepare_graph, + &firm_irn_handler }; diff --git a/ir/be/bemain.c b/ir/be/bemain.c index 82ed7e44a..3266f22d4 100644 --- a/ir/be/bemain.c +++ b/ir/be/bemain.c @@ -8,7 +8,6 @@ #endif #include -#include #include "obst.h" #include "bitset.h" @@ -83,9 +82,16 @@ static be_main_env_t *be_init_env(be_main_env_t *env) env->node_factory = obstack_alloc(&env->obst, sizeof(*env->node_factory)); be_node_factory_init(env->node_factory, isa); - arch_env_add_irn_handler(env->arch_env, &firm_irn_handler); - arch_env_add_irn_handler(env->arch_env, - be_node_get_irn_handler(env->node_factory)); + /* Register the irn handler of the architecture */ + if (isa->irn_handler) + arch_env_add_irn_handler(env->arch_env, isa->irn_handler); + + /* + * Register the node handler of the back end infrastructure. + * This irn handler takes care of the platform independent + * spill, reload and perm nodes. + */ + arch_env_add_irn_handler(env->arch_env, be_node_get_irn_handler(env->node_factory)); return env; } @@ -145,7 +151,6 @@ static void be_main_loop(void) /* For all graphs */ for(i = 0, n = get_irp_n_irgs(); i < n; ++i) { - int j, m; ir_graph *irg = get_irp_irg(i); be_main_session_env_t session; -- 2.20.1