Added irn_handler field to arch_isa_t
authorSebastian Hack <hack@ipd.info.uni-karlsruhe.de>
Wed, 16 Nov 2005 14:19:55 +0000 (14:19 +0000)
committerSebastian Hack <hack@ipd.info.uni-karlsruhe.de>
Wed, 16 Nov 2005 14:19:55 +0000 (14:19 +0000)
ir/be/bearch.h
ir/be/bearch_firm.c
ir/be/bemain.c

index 7ab8ae1..113eb98 100644 (file)
@@ -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
index e31311a..159dc33 100644 (file)
@@ -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
 };
index 82ed7e4..3266f22 100644 (file)
@@ -8,7 +8,6 @@
 #endif
 
 #include <stdarg.h>
-#include <mcheck.h>
 
 #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;