+
+ /**
+ * 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)(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);
+};
+
+#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. */
+
+ arch_irn_handler_t const *handlers[ARCH_MAX_HANDLERS]; /**< The handlers are organized as
+ a stack. */
+
+ int handlers_tos; /**< The stack pointer of the handler
+ stack. */
+};
+
+/**
+ * Get the isa of an arch environment.
+ * @param env The environment.
+ * @return The isa with which the env was initialized with.
+ */
+#define arch_env_get_isa(env) ((env)->isa)
+
+/**
+ * Initialize the architecture environment struct.
+ * @param isa The isa which shall be put into the environment.
+ * @return The environment.
+ */
+extern arch_env_t *arch_env_init(arch_env_t *env, const arch_isa_if_t *isa);
+
+/**
+ * Add a node handler to the environment.
+ * @param env The environment.
+ * @param handler A node handler.
+ * @return The environment itself.
+ */
+extern arch_env_t *arch_env_add_irn_handler(arch_env_t *env,
+ const arch_irn_handler_t *handler);
+
+#endif /* _FIRM_BEARCH_H */