+/**
+ * Different types of register allocation requirements.
+ */
+typedef enum _arch_register_req_type_t {
+ arch_register_req_type_none = 0, /**< No register requirement. */
+
+ arch_register_req_type_normal = 1, /**< All registers in the class
+ are allowed. */
+
+ arch_register_req_type_limited = 2, /**< Only a real subset of
+ the class is allowed. */
+
+ arch_register_req_type_should_be_same = 4, /**< The register should be equal
+ another one at the node. */
+
+ arch_register_req_type_should_be_different = 8, /**< The register must be unequal
+ to some other at the node. */
+
+} arch_register_req_type_t;
+
+#define arch_register_req_is_constr(x) \
+ ((x)->type & (arch_register_req_type_pair + arch_register_req_type_limited - 1) != 0)
+
+/**
+ * Expresses requirements to register allocation for an operand.
+ */
+typedef struct _arch_register_req_t {
+ arch_register_req_type_t type; /**< The type of the constraint. */
+ const arch_register_class_t *cls; /**< The register class this
+ constraint belongs to. */
+ union {
+ int (*limited)(const ir_node *irn, int pos, bitset_t *bs);
+ /**< In case of the 'limited'
+ constraint, this function
+ must put all allowable
+ registers in the bitset and
+ return the number of registers
+ in the bitset. */
+
+ int pos; /**< In case of the equal constraint,
+ this gives the position of the
+ operand to which the register of
+ this should be equal to. Same for
+ unequal. */
+ } data;
+} arch_register_req_t;
+
+/**
+ * Certain node classes which are relevent for the register allocator.
+ */
+typedef enum _arch_irn_class_t {
+ arch_irn_class_normal,
+ arch_irn_class_spill,
+ arch_irn_class_reload,
+ arch_irn_class_copy,
+ arch_irn_class_perm,
+ arch_irn_class_branch
+} arch_irn_class_t;
+
+/**
+ * Some flags describing a node in more detail.
+ */
+typedef enum _arch_irn_flags_t {
+ arch_irn_flags_spillable = 1,
+ arch_irn_flags_rematerializable = 2
+} arch_irn_flags_t;
+
+struct _arch_irn_ops_t {
+
+ /**
+ * Get the register requirements for a given operand.
+ * @param self The self pointer.
+ * @param irn The node.
+ * @param pos The operand's position
+ * (-1 for the result of the node, 0..n for the input
+ * operands).
+ * @return The register requirements for the selected operand.
+ * The pointer returned is never NULL.
+ */
+ const arch_register_req_t *(*get_irn_reg_req)(const arch_irn_ops_t *self,
+ arch_register_req_t *req, const ir_node *irn, int pos);
+
+ /**
+ * Set the register for an output operand.
+ * @param irn The node.
+ * @param reg The register allocated to that operand.
+ * @note If the operand is not a register operand,
+ * the call is ignored.
+ */
+ void (*set_irn_reg)(const arch_irn_ops_t *self, ir_node *irn, const arch_register_t *reg);
+
+ /**
+ * Get the register allocated for an output operand.
+ * @param irn The node.
+ * @return The register allocated at that operand. NULL, if
+ * the operand was no register operand or
+ * @c arch_register_invalid, if no register has yet been
+ * allocated for this node.
+ */
+ const arch_register_t *(*get_irn_reg)(const arch_irn_ops_t *self, const ir_node *irn);
+
+ /**
+ * Classify the node.
+ * @param irn The node.
+ * @return A classification.
+ */
+ arch_irn_class_t (*classify)(const arch_irn_ops_t *self, const ir_node *irn);
+
+ /**
+ * Get the flags of a node.
+ * @param self The irn ops themselves.
+ * @param irn The node.
+ * @return A set of flags.
+ */
+ arch_irn_flags_t (*get_flags)(const arch_irn_ops_t *self, const ir_node *irn);
+
+};
+
+/**
+ * Get the register requirements for a node.
+ * @param env The architecture environment.
+ * @param req A pointer to a requirements structure, where the data can
+ * be put into.
+ * @param irn The node.
+ * @param pos The position of the operand you're interested in.
+ * @return A pointer to the register requirements which may <b>not</b>
+ * neccessarily be equal to @p req. If NULL is returned, the
+ * operand was no register operand.
+ */
+extern const arch_register_req_t *
+arch_get_register_req(const arch_env_t *env, arch_register_req_t *req,
+ const ir_node *irn, int pos);
+
+/**
+ * Check if an operand is a register operand.
+ * @param env The environment.
+ * @param irn The node.
+ * @param pos The position of the operand.
+ * @return 1, if the operand is significant for register allocation, 0
+ * if not.
+ */
+extern int arch_is_register_operand(const arch_env_t *env,
+ const ir_node *irn, int pos);
+
+/**
+ * Get the number of allocatable registers concerning
+ * a register class for an operand of a node.
+ * @param env The environment.
+ * @param irn The node.
+ * @param pos The postition of the node's operand.
+ * @param cls The register class.
+ * @param bs The bitset all allocatable registers shall be put into.
+ * Note, that you can also pass NULL here. If you don't,
+ * make sure, the bitset is as large as the register class
+ * has registers.
+ * @return The amount of registers allocatable for that operand.
+ */
+extern int arch_get_allocatable_regs(const arch_env_t *env, const ir_node *irn,
+ int pos, const arch_register_class_t *cls, bitset_t *bs);
+
+/**
+ * Check, if a register is assignable to an operand of a node.
+ * @param env The architecture environment.
+ * @param irn The node.
+ * @param pos The position of the operand.
+ * @param reg The register.
+ * @return 1, if the register might be allocated to the operand 0 if not.
+ */
+extern int arch_reg_is_allocatable(const arch_env_t *env,
+ const ir_node *irn, int pos, const arch_register_t *reg);
+
+/**
+ * Get the register class of an operand of a node.
+ * @param env The architecture environment.
+ * @param irn The node.
+ * @param pos The position of the operand.
+ * @return The register class of the operand or NULL, if
+ * operand is a non-register operand.
+ */
+extern const arch_register_class_t *
+arch_get_irn_reg_class(const arch_env_t *env, const ir_node *irn, int pos);