-#define arch_irn_has_reg_class(env, irn, pos, cls) \
- ((cls) == arch_get_irn_reg_class(env, irn, pos))
-
-/**
- * Somebody who can be asked about nodes.
- */
-struct _arch_irn_handler_t {
-
- /**
- * Get the operations of an irn.
- * @param self The handler from which the method is invoked.
- * @param irn Some node.
- * @return Operations for that irn.
- */
- const void *(*get_irn_ops)(const arch_irn_handler_t *handler,
- const ir_node *irn);
-
-};
-
-/**
- * The code generator.
- */
-struct _arch_code_generator_if_t {
-
-
- /**
- * Initialize the code generator.
- * @param file The file to dump to.
- * @param irg The function to generate code for.
- * @param env The architecture environment.
- * @return A newly created code generator.
- */
- void *(*init)(FILE *file, ir_graph *irg, const arch_env_t *env);
-
- /**
- * Called, when the graph is being normalized.
- */
- void (*prepare_graph)(void *self);
-
- /**
- * Called before scheduling.
- */
- void (*before_sched)(void *self);
-
- /**
- * Called before register allocation.
- */
- void (*before_ra)(void *self);
-
- /**
- * Called after register allocation to lower Spills to Stores
- */
- ir_node *(*lower_spill)(void *self, ir_node *spill);
-
- /**
- * Called after register allocation to lower Reloads to Loads
- */
- ir_node *(*lower_reload)(void *self, ir_node *reload);
-
- /**
- * Called after everything happened.
- * The code generator must also be de-allocated here.
- */
- void (*done)(void *self);
-
-};
-
-#define _arch_cg_call(cg, func) \
-do { \
- if((cg)->impl->func) \
- (cg)->impl->func(cg); \
-} while(0)
-
-#define arch_code_generator_prepare_graph(cg) _arch_cg_call(cg, prepare_graph)
-#define arch_code_generator_before_sched(cg) _arch_cg_call(cg, before_sched)
-#define arch_code_generator_before_ra(cg) _arch_cg_call(cg, before_ra)
-#define arch_code_generator_done(cg) _arch_cg_call(cg, done)
-
-/**
- * Code generator base class.
- */
-struct _arch_code_generator_t {
- const arch_code_generator_if_t *impl;
-};
-
-/**
- * ISA base class.
- */
-struct _arch_isa_t {
- const arch_isa_if_t *impl;
-};
-
-/**
- * Architecture interface.
- */
-struct _arch_isa_if_t {
-
-#ifdef WITH_LIBCORE
- void (*register_options)(lc_opt_entry_t *grp);
-#endif
-
- /**
- * Initialize the isa interface.
- */
- void *(*init)(void);
-
- /**
- * Free the isa instance.
- */
- void (*done)(void *self);
-
- /**
- * Get the the number of register classes in the isa.
- * @return The number of register classes.
- */
- int (*get_n_reg_class)(const void *self);
-
- /**
- * Get the i-th register class.
- * @param i The number of the register class.
- * @return The register class.
- */
- const arch_register_class_t *(*get_reg_class)(const void *self, int i);
-
- /**
- * 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 *(*get_irn_handler)(const void *self);
-
- /**
- * Get the code generator interface.
- * @param self The this pointer.
- * @return Some code generator interface.
- */
- const arch_code_generator_if_t *(*get_code_generator_if)(void *self);
-
- /**
- * Get the list scheduler to use.
- * @param self The isa object.
- * @return The list scheduler selector.
- */
- const list_sched_selector_t *(*get_list_sched_selector)(const void *self);
-
- /**
- * Get the proj number assigned to the register.
- * @param self The isa object.
- * @param reg The register
- * @return The proj number assigned to this register
- */
- long (*get_projnum_for_register)(const void *self, const arch_register_t *reg);
-};
-
-#define arch_isa_get_n_reg_class(isa) ((isa)->impl->get_n_reg_class(isa))
-#define arch_isa_get_reg_class(isa,i) ((isa)->impl->get_reg_class(isa, i))
-#define arch_isa_get_irn_handler(isa) ((isa)->impl->get_irn_handler(isa))
-#define arch_isa_make_code_generator(isa,irg) ((isa)->impl->make_code_generator(isa, irg))
-
-#define ARCH_MAX_HANDLERS 8
-
-/**
- * Environment for the architecture infrastructure.
- * Keep this everywhere you're going.
- */
-struct _arch_env_t {
- const struct _be_node_factory_t *node_factory; /**< The node factory for be nodes. */
- arch_isa_t *isa; /**< The isa about which everything is. */