+#include "hashptr.h"
+#include "fourcc.h"
+#include "set.h"
+#include "list.h"
+#include "ident.h"
+
+#include "belistsched.h"
+
+typedef struct _arch_register_class_t arch_register_class_t;
+typedef struct _arch_register_t arch_register_t;
+typedef struct _arch_enum_t arch_enum_t;
+typedef struct _arch_enum_member_t arch_enum_member_t;
+typedef struct _arch_isa_if_t arch_isa_if_t;
+typedef struct _arch_isa_t arch_isa_t;
+typedef struct _arch_env_t arch_env_t;
+typedef struct _arch_irn_ops_t arch_irn_ops_t;
+typedef struct _arch_irn_handler_t arch_irn_handler_t;
+typedef struct _arch_code_generator_t arch_code_generator_t;
+typedef struct _arch_code_generator_if_t arch_code_generator_if_t;
+
+struct _be_node_factory_t;
+
+typedef enum _arch_register_type_t {
+ arch_register_type_none = 0,
+ arch_register_type_write_invariant,
+ arch_register_type_caller_saved, /**< The register must be saved by the caller
+ upon a function call. It thus can be overwritten
+ in the called function. */
+ arch_register_type_callee_saved, /**< The register must be saved by the called function,
+ it thus survives a function call. */
+ arch_register_type_ignore /**< Do not consider this register when allocating. */
+} arch_register_type_t;
+
+/**
+ * A register.
+ */
+struct _arch_register_t {
+ const char *name; /**< The name of the register. */
+ const arch_register_class_t *reg_class; /**< The class the register belongs to. */
+ int index; /**< The index of the register in the class. */
+ arch_register_type_t type; /**< The type of the register. */
+ void *data; /**< Custom data. */
+};
+
+static INLINE const arch_register_class_t *
+_arch_register_get_class(const arch_register_t *reg)
+{
+ return reg->reg_class;
+}
+
+static INLINE int _arch_register_get_index(const arch_register_t *reg)
+{
+ return reg->index;
+}
+
+#define arch_register_get_class(reg) _arch_register_get_class(reg)
+#define arch_register_get_index(reg) _arch_register_get_index(reg)
+#define arch_register_get_name(reg) ((reg)->name)
+
+/**
+ * A class of registers.
+ * Like general purpose or floating point.
+ */
+struct _arch_register_class_t {
+ const char *name; /**< The name of the register class. */
+ int n_regs; /**< Number of registers in this class. */
+ const arch_register_t *regs; /**< The array of registers. */
+};
+
+#define arch_register_class_n_regs(cls) ((cls)->n_regs)
+
+/**
+ * Put all registers in a class into a bitset.
+ * @param cls The class.
+ * @param bs The bitset. May be NULL.
+ * @return The number of registers in the class.
+ */
+extern int arch_register_class_put(const arch_register_class_t *cls, bitset_t *bs);
+
+static INLINE const arch_register_t *
+_arch_register_for_index(const arch_register_class_t *cls, int idx)
+{
+ assert(0 <= idx && idx < cls->n_regs);
+ return &cls->regs[idx];
+}
+
+#define arch_register_for_index(cls, idx) \
+ _arch_register_for_index(cls, idx)
+
+/**
+ * Get the register set for a register class.
+ * @param cls The register class.
+ * @return The set containing all registers in the class.
+ */
+#define arch_get_register_set_for_class(cls) ((cls)->set)