#include "irnode.h"
#include "irmode.h"
+#include "bitset.h"
#include "hashptr.h"
#include "fourcc.h"
#include "set.h"
#include "list.h"
#include "ident.h"
-struct _bitset_t;
-
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_irn_ops_t arch_irn_ops_t;
typedef struct _arch_irn_handler_t arch_irn_handler_t;
+struct _be_node_factory_t;
+
typedef enum _arch_register_type_t {
arch_register_type_none = 0,
arch_register_type_write_invariant,
* @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,
- struct _bitset_t *bs);
+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)
const arch_register_class_t *cls; /** The register class this
constraint belongs to. */
union {
- int (*limited)(const ir_node *irn, int pos, struct _bitset_t *bs);
+ int (*limited)(const ir_node *irn, int pos, bitset_t *bs);
/** In case of the 'limited'
constraint, this function
must put all allowable
arch_irn_class_spill,
arch_irn_class_reload,
arch_irn_class_copy,
- arch_irn_class_perm
+ 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;
+
/*
* Some words about positions and indices:
*
*/
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);
+
};
+extern int
+arch_get_n_operands(const arch_env_t *env, const ir_node *irm, int in_out);
+
/**
* Get the register requirements for a node.
* @param env The architecture environment.
* @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, struct _bitset_t *bs);
+ int pos, const arch_register_class_t *cls, bitset_t *bs);
/**
* Check, if a register is assignable to an operand of a node.
* Get the register class of an operand of a node.
* @param env The architecture environment.
* @param irn The node.
- * @param idx The position of the operand.
+ * @param pos The position of the operand.
* @return The register class of the operand or NULL, if
* operand is a non-register operand.
*/
extern void arch_set_irn_register(const arch_env_t *env,
ir_node *irn, int idx, const arch_register_t *reg);
+/**
+ * Classify a node.
+ * @param env The architecture environment.
+ * @param irn The node.
+ * @return A classification of the node.
+ */
+extern arch_irn_class_t arch_irn_classify(const arch_env_t *env, const ir_node *irn);
+
+/**
+ * Get the flags of a node.
+ * @param env The architecture environment.
+ * @param irn The node.
+ * @return The flags.
+ */
+extern arch_irn_flags_t arch_irn_get_flags(const arch_env_t *env, const ir_node *irn);
+
#define arch_irn_has_reg_class(env, irn, pos, cls) \
((cls) == arch_get_irn_reg_class(env, irn, pos))
*/
const arch_register_class_t *(*get_reg_class)(int i);
+ /**
+ * Prepare a graph.
+ * This function is called each time, the backend starts running over
+ * a graph.
+ * @param irg The graph.
+ */
+ void (*prepare_graph)(ir_graph *irg);
};
#define ARCH_MAX_HANDLERS 8
* Keep this everywhere you're going.
*/
struct _arch_env_t {
- const arch_isa_if_t *isa; /** The isa about which everything is. */
+ const struct _be_node_factory_t *node_factory; /**< The node factory for be nodes. */
+ const arch_isa_if_t *isa; /**< The isa about which everything is. */
- arch_irn_handler_t const *handlers[ARCH_MAX_HANDLERS]; /** The handlers are organized as
- a stack. */
+ 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
+ int handlers_tos; /**< The stack pointer of the handler
stack. */
};