/**
* 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
#endif
#include <stdarg.h>
-#include <mcheck.h>
#include "obst.h"
#include "bitset.h"
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;
}
/* 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;