+};
+
+/**
+ * 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;
+};