2 * Register mapping for firm nodes. Stolen from bearch_firm :)
11 #include "TEMPLATE_map_regs.h"
12 #include "TEMPLATE_new_nodes.h"
14 /* Mapping to store registers in firm nodes */
16 struct TEMPLATE_irn_reg_assoc {
18 const arch_register_t *reg;
21 int TEMPLATE_cmp_irn_reg_assoc(const void *a, const void *b, size_t len) {
22 const struct TEMPLATE_irn_reg_assoc *x = a;
23 const struct TEMPLATE_irn_reg_assoc *y = b;
25 return x->irn != y->irn;
28 static struct TEMPLATE_irn_reg_assoc *get_irn_reg_assoc(const ir_node *irn, set *reg_set) {
29 struct TEMPLATE_irn_reg_assoc templ;
36 return set_insert(reg_set, &templ, sizeof(templ), hash);
39 void TEMPLATE_set_firm_reg(ir_node *irn, const arch_register_t *reg, set *reg_set) {
40 struct TEMPLATE_irn_reg_assoc *assoc = get_irn_reg_assoc(irn, reg_set);
44 const arch_register_t *TEMPLATE_get_firm_reg(const ir_node *irn, set *reg_set) {
45 struct TEMPLATE_irn_reg_assoc *assoc = get_irn_reg_assoc(irn, reg_set);
52 * Translates the projnum into a "real" argument position for register
53 * requirements dependend on the predecessor.
55 long TEMPLATE_translate_proj_pos(const ir_node *proj) {
56 ir_node *pred = get_Proj_pred(proj);
57 long nr = get_Proj_proj(proj);
59 if (is_TEMPLATE_Load(pred)) {
60 if (nr == pn_Load_res)
62 assert(0 && "unsupported Proj(Load) number");
64 else if (is_TEMPLATE_Store(pred)) {
67 else if (is_TEMPLATE_fDiv(pred)) {
68 if (nr == pn_Quot_res)
71 assert(0 && "there should be no more Projs for a fDiv");
74 // assert(0 && "unsupported Proj(X)");