+ * 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_t;
+
+/*
+ * Some words about positions and indices:
+ *
+ * Firm has the policy "One node per value", that's why there are
+ * Proj nodes. This view has its advantages, but in a backend
+ * setting where we talk about instructions (which can also have
+ * multiple results and not a single Tuple value) this is sometimes
+ * hard.
+ *
+ * Each node representing an instruction must provide information
+ * about the kind of its operands (where operands mean both input
+ * and output operands). Such an operand is addressed with a position
+ * which is infact a tuple {in, out} x N. The fact that a position
+ * is an input/output operand is encoded in the sign, so input operands
+ * go from 0..n-1 and output operands from -1..-m if the
+ * instruction has n input and m output operands.
+ */
+
+#define _BEARCH_TRANSFORM_INDEX(cmp, index) ((index) cmp 0 ? -((index) + 1) : (index))
+
+/**
+ * Make an in position from an index.
+ * @param index The index.
+ * @return The position representing the index as an in operand.
+ */
+#define arch_pos_make_in(index) _BEARCH_TRANSFORM_INDEX(<, index)
+
+/**
+ * Make an out position from an index.
+ * @param index The index.
+ * @return The position representing the index as an out operand.
+ */
+#define arch_pos_make_out(index) _BEARCH_TRANSFORM_INDEX(>=, index)
+
+/**
+ * Check, if a position denotes an input operand.
+ * @param pos The position.
+ * @return 1, if the position denotes an input operand 0 if not.
+ */
+#define arch_pos_is_in(pos) ((pos) >= 0)
+
+/**
+ * Check, if a position denotes an output operand.
+ * @param pos The position.
+ * @return 1, if the position denotes an output operand 0 if not.
+ */
+#define arch_pos_is_out(pos) (!arch_pos_is_in(pos))
+
+/**
+ * Get the index of a position.
+ * @param pos The position.
+ * @return The index of the position.
+ */
+#define arch_pos_get_index(pos) _BEARCH_TRANSFORM_INDEX(<, pos)
+
+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.
+ * @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);
+
+ /**
+ * Get the number of operands of a node.
+ * @param irn The node.
+ * @param in_out Denotes wither input (a number >= 0) or
+ * output (a number < 0).
+ * @return The number of operands for either in, or output.
+ */
+ int (*get_n_operands)(const arch_irn_ops_t *self, const ir_node *irn, int in_out);
+
+ /**
+ * Set the register for an output operand.
+ * @param irn The node.
+ * @param pos The position of the output operand.
+ * @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,
+ int idx, const arch_register_t *reg);
+
+ /**
+ * Get the register allocated for an output operand.
+ * @param irn The node.
+ * @param pos The index of the output operand.
+ * @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, int idx);
+
+ /**
+ * 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 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.