improve mode/conv handling in backend (should result in less convs)
[libfirm] / ir / be / ia32 / ia32_new_nodes.c
index 8f6381c..9440be9 100644 (file)
@@ -24,7 +24,7 @@
  * @version     $Id$
  *
  * This file implements the creation of the achitecture specific firm opcodes
- * and the coresponding node constructors for the ia32 assembler irg.
+ * and the corresponding node constructors for the ia32 assembler irg.
  */
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -96,7 +96,9 @@ static void dump_reg_req(FILE *F, ir_node *n, const arch_register_req_t **reqs,
                        }
 
                        if (reqs[i]->type & arch_register_req_type_should_be_same) {
-                               ir_fprintf(F, " same as %+F", get_irn_n(n, reqs[i]->other_same));
+                               ir_fprintf(F, " same as %+F", get_irn_n(n, reqs[i]->other_same[0]));
+                               if (reqs[i]->other_same[1] != -1)
+                                       ir_fprintf(F, " or %+F", get_irn_n(n, reqs[i]->other_same[1]));
                        }
 
                        if (reqs[i]->type & arch_register_req_type_should_be_different) {
@@ -279,14 +281,8 @@ static int ia32_dump_node(ir_node *n, FILE *F, dump_reason_t reason) {
                        if(is_ia32_SwitchJmp(n) || is_ia32_CopyB(n) || is_ia32_CopyB_i(n)) {
                                fprintf(F, "pn_code = %ld\n", get_ia32_pncode(n));
                        } else {
-                               if(get_ia32_pncode(n) & ia32_pn_Cmp_Unsigned) {
-                                       long pnc = get_ia32_pncode(n);
-                                       fprintf(F, "pn_code = %ld (%s, unsigned)\n",
-                                               pnc, get_pnc_string(pnc & ~ia32_pn_Cmp_Unsigned));
-                               } else {
-                                       fprintf(F, "pn_code = %ld (%s)\n", get_ia32_pncode(n),
-                                               get_pnc_string(get_ia32_pncode(n)));
-                               }
+                               fprintf(F, "pn_code = %ld (%s)\n", get_ia32_pncode(n),
+                                       get_pnc_string(get_ia32_pncode(n)));
                        }
 
                        /* dump n_res */
@@ -795,22 +791,6 @@ int get_ia32_n_res(const ir_node *node) {
        return ARR_LEN(attr->slots);
 }
 
-/**
- * Returns the flavour of an ia32 node,
- */
-ia32_op_flavour_t get_ia32_flavour(const ir_node *node) {
-       const ia32_attr_t *attr = get_ia32_attr_const(node);
-       return attr->data.op_flav;
-}
-
-/**
- * Sets the flavour of an ia32 node to flavour_Div/Mod/DivMod/Mul/Mulh.
- */
-void set_ia32_flavour(ir_node *node, ia32_op_flavour_t op_flav) {
-       ia32_attr_t *attr  = get_ia32_attr(node);
-       attr->data.op_flav = op_flav;
-}
-
 /**
  * Returns the projnum code.
  */
@@ -986,12 +966,14 @@ int get_ia32_out_regnr(const ir_node *node, int pos) {
 
 void ia32_swap_left_right(ir_node *node)
 {
-       ir_node *left  = get_irn_n(node, n_ia32_binary_left);
-       ir_node *right = get_irn_n(node, n_ia32_binary_right);
+       ia32_attr_t *attr  = get_ia32_attr(node);
+       ir_node     *left  = get_irn_n(node, n_ia32_binary_left);
+       ir_node     *right = get_irn_n(node, n_ia32_binary_right);
+
        assert(is_ia32_commutative(node));
+       attr->data.ins_permuted = !attr->data.ins_permuted;
        set_irn_n(node, n_ia32_binary_left,  right);
        set_irn_n(node, n_ia32_binary_right, left);
-       set_ia32_pncode(node, get_inversed_pnc(get_ia32_pncode(node)));
 }
 
 /**
@@ -1119,13 +1101,16 @@ int ia32_compare_attr(const ia32_attr_t *a, const ia32_attr_t *b) {
        if(a->pn_code != b->pn_code)
                return 1;
 
-       if (a->data.tp != b->data.tp
-           || a->data.op_flav != b->data.op_flav)
+       if (a->data.tp != b->data.tp)
                return 1;
 
        if (a->data.except_label != b->data.except_label)
                return 1;
 
+       if (a->data.ins_permuted != b->data.ins_permuted
+                       || a->data.cmp_unsigned != b->data.cmp_unsigned)
+               return 1;
+
        return 0;
 }