2 * Register mapping for firm nodes. Stolen from bearch_firm :)
11 #include "arm_map_regs.h"
12 #include "arm_new_nodes.h"
14 #include "gen_arm_regalloc_if.h"
17 static const arch_register_t *gpreg_param_reg_std[] = {
24 const arch_register_t *arm_get_RegParam_reg(int n) {
25 assert(n < 4 && n >=0 && "register param > 3 angefordert");
26 return gpreg_param_reg_std[n];
29 /* Mapping to store registers in firm nodes */
31 struct arm_irn_reg_assoc {
33 const arch_register_t *reg;
36 int arm_cmp_irn_reg_assoc(const void *a, const void *b, size_t len) {
37 const struct arm_irn_reg_assoc *x = a;
38 const struct arm_irn_reg_assoc *y = b;
40 return x->irn != y->irn;
43 static struct arm_irn_reg_assoc *get_irn_reg_assoc(const ir_node *irn, set *reg_set) {
44 struct arm_irn_reg_assoc templ;
51 return set_insert(reg_set, &templ, sizeof(templ), hash);
54 void arm_set_firm_reg(ir_node *irn, const arch_register_t *reg, set *reg_set) {
55 struct arm_irn_reg_assoc *assoc = get_irn_reg_assoc(irn, reg_set);
59 const arch_register_t *arm_get_firm_reg(const ir_node *irn, set *reg_set) {
60 struct arm_irn_reg_assoc *assoc = get_irn_reg_assoc(irn, reg_set);
67 * Translates the proj number into a "real" argument position for register
68 * requirements depended on the predecessor.
70 long arm_translate_proj_pos(const ir_node *proj) {
71 ir_node *pred = get_Proj_pred(proj);
72 long nr = get_Proj_proj(proj);
74 if (is_irn_machine_op(pred)) {
75 switch (get_arm_irn_opcode(pred)) {
83 if (nr == pn_Load_res)
85 assert(0 && "unsupported Proj(Load) number");
96 if (nr == pn_Quot_res)
98 assert(0 && "there should be no more Projs for a fDiv");
105 // assert(0 && "unsupported Proj(X)");