#include <stdbool.h>
#include "firm_types.h"
-#include "obst.h"
#include "raw_bitset.h"
#include "be_types.h"
arch_register_type_none = 0,
/** Do not consider this register when allocating. */
arch_register_type_ignore = 1U << 0,
- /** The emitter can choose an arbitrary register. The register fulfills any
- * register constraints as long as the register class matches */
- arch_register_type_joker = 1U << 1,
/** This is just a virtual register. Virtual registers fulfill any register
* constraints as long as the register class matches. It is a allowed to
* have multiple definitions for the same virtual register at a point */
- arch_register_type_virtual = 1U << 2,
+ arch_register_type_virtual = 1U << 1,
/** The register represents a state that should be handled by bestate
* code */
- arch_register_type_state = 1U << 3,
+ arch_register_type_state = 1U << 2,
} arch_register_type_t;
ENUM_BITSET(arch_register_type_t)
extern arch_register_req_t const arch_no_requirement;
#define arch_no_register_req (&arch_no_requirement)
-/**
- * Print information about a register requirement in human readable form
- * @param F output stream/file
- * @param req The requirements structure to format.
- */
-void arch_dump_register_req(FILE *F, const arch_register_req_t *req,
- const ir_node *node);
-
void arch_dump_register_reqs(FILE *F, const ir_node *node);
void arch_dump_reqs_and_registers(FILE *F, const ir_node *node);
int arch_get_sp_bias(ir_node *irn);
int arch_get_op_estimated_cost(const ir_node *irn);
-arch_inverse_t *arch_get_inverse(const ir_node *irn, int i,
- arch_inverse_t *inverse,
- struct obstack *obstack);
int arch_possible_memory_operand(const ir_node *irn,
unsigned int i);
void arch_perform_memory_operand(ir_node *irn, ir_node *spill,
return info->in_reqs;
}
-const arch_register_req_t *arch_get_irn_register_req(const ir_node *node);
+static inline reg_out_info_t *get_out_info(const ir_node *node)
+{
+ size_t pos = 0;
+ const backend_info_t *info;
+ assert(get_irn_mode(node) != mode_T);
+ if (is_Proj(node)) {
+ pos = get_Proj_proj(node);
+ node = get_Proj_pred(node);
+ }
+
+ info = be_get_info(node);
+ assert(pos < ARR_LEN(info->out_infos));
+ return &info->out_infos[pos];
+}
+
+static inline const arch_register_req_t *arch_get_irn_register_req(const ir_node *node)
+{
+ reg_out_info_t *out = get_out_info(node);
+ return out->req;
+}
/**
* Get the flags of a node.
* @param irn The node.
* @return The flags.
*/
-arch_irn_flags_t arch_get_irn_flags(const ir_node *irn);
+static inline arch_irn_flags_t arch_get_irn_flags(const ir_node *node)
+{
+ backend_info_t const *const info = be_get_info(node);
+ return info->flags;
+}
void arch_set_irn_flags(ir_node *node, arch_irn_flags_t flags);
void arch_add_irn_flags(ir_node *node, arch_irn_flags_t flags);
return true;
}
-/**
- * An inverse operation returned by the backend
- */
-struct arch_inverse_t {
- int n; /**< count of nodes returned in nodes array */
- int costs; /**< costs of this remat */
-
- /** nodes for this inverse operation. shall be in schedule order.
- * last element is the target value */
- ir_node **nodes;
-};
-
struct arch_irn_ops_t {
/**
*/
int (*get_sp_bias)(const ir_node *irn);
- /**
- * Returns an inverse operation which yields the i-th argument
- * of the given node as result.
- *
- * @param irn The original operation
- * @param i Index of the argument we want the inverse operation to
- * yield
- * @param inverse struct to be filled with the resulting inverse op
- * @param obstack The obstack to use for allocation of the returned nodes
- * array
- * @return The inverse operation or NULL if operation invertible
- */
- arch_inverse_t *(*get_inverse)(const ir_node *irn, int i,
- arch_inverse_t *inverse,
- struct obstack *obstack);
-
/**
* Get the estimated cycle count for @p irn.
*
static inline bool arch_irn_is_ignore(const ir_node *irn)
{
const arch_register_req_t *req = arch_get_irn_register_req(irn);
- return req->type & arch_register_req_type_ignore;
+ return arch_register_req_is(req, ignore);
}
static inline bool arch_irn_consider_in_reg_alloc(
const arch_register_class_t *cls, const ir_node *node)
{
const arch_register_req_t *req = arch_get_irn_register_req(node);
- return
- req->cls == cls &&
- !(req->type & arch_register_req_type_ignore);
+ return req->cls == cls && !arch_register_req_is(req, ignore);
}
/**
} \
} while (0)
-#define be_foreach_definition(node, ccls, value, code) \
- be_foreach_definition_(node, ccls, value, \
- if (req_->type & arch_register_req_type_ignore) \
- continue; \
- code \
+#define be_foreach_definition(node, ccls, value, code) \
+ be_foreach_definition_(node, ccls, value, \
+ if (arch_register_req_is(req_, ignore)) \
+ continue; \
+ code \
)
static inline const arch_register_class_t *arch_get_irn_reg_class(