-static void TEMPLATE_after_ra(void *self) {
- (void) self;
- /* Some stuff you need to do immediatly after register allocation */
-}
-
-
-
-/**
- * Emits the code, closes the output file and frees
- * the code generator interface.
- */
-static void TEMPLATE_emit_and_done(void *self) {
- TEMPLATE_code_gen_t *cg = self;
- ir_graph *irg = cg->irg;
-
- TEMPLATE_gen_routine(cg, irg);
-
- cur_reg_set = NULL;
-
- /* de-allocate code generator */
- del_set(cg->reg_set);
- free(cg);
-}
-
-static void *TEMPLATE_cg_init(be_irg_t *birg);
-
-static const arch_code_generator_if_t TEMPLATE_code_gen_if = {
- TEMPLATE_cg_init,
- NULL, /* before abi introduce hook */
- TEMPLATE_prepare_graph,
- NULL, /* spill hook */
- TEMPLATE_before_sched, /* before scheduling hook */
- TEMPLATE_before_ra, /* before register allocation hook */
- TEMPLATE_after_ra, /* after register allocation hook */
- TEMPLATE_finish_irg,
- TEMPLATE_emit_and_done
-};
-
-/**
- * Initializes the code generator.
- */
-static void *TEMPLATE_cg_init(be_irg_t *birg) {
- const arch_env_t *arch_env = be_get_birg_arch_env(birg);
- TEMPLATE_isa_t *isa = (TEMPLATE_isa_t *) arch_env->isa;
- TEMPLATE_code_gen_t *cg = xmalloc(sizeof(*cg));
-
- cg->impl = &TEMPLATE_code_gen_if;
- cg->irg = be_get_birg_irg(birg);
- cg->reg_set = new_set(TEMPLATE_cmp_irn_reg_assoc, 1024);
- cg->arch_env = arch_env;
- cg->isa = isa;
- cg->birg = birg;
- FIRM_DBG_REGISTER(cg->mod, "firm.be.TEMPLATE.cg");
-
- cur_reg_set = cg->reg_set;
-
- TEMPLATE_irn_ops.cg = cg;
-
- return (arch_code_generator_t *)cg;