Split the divmod attribute into one div and one mod attribute.
authorMichael Beck <beck@ipd.info.uni-karlsruhe.de>
Thu, 24 Feb 2011 22:20:25 +0000 (22:20 +0000)
committerMichael Beck <beck@ipd.info.uni-karlsruhe.de>
Sat, 26 Feb 2011 09:27:57 +0000 (10:27 +0100)
[r28457]

ir/ir/ircons.c
ir/ir/iropt.c
ir/ir/irtypes.h
scripts/ir_spec.py

index 0e02e3c..2973c8b 100644 (file)
@@ -457,9 +457,9 @@ ir_node *new_rd_DivRL(dbg_info *dbgi, ir_node *block, ir_node * irn_mem, ir_node
        in[2] = irn_right;
 
        res = new_ir_node(dbgi, irg, block, op_Div, mode_T, 3, in);
-       res->attr.divmod.resmode = resmode;
-       res->attr.divmod.no_remainder = 1;
-       res->attr.divmod.exc.pin_state = pin_state;
+       res->attr.div.resmode = resmode;
+       res->attr.div.no_remainder = 1;
+       res->attr.div.exc.pin_state = pin_state;
        res = optimize_node(res);
        irn_verify_irg(res, irg);
        return res;
index a34c03a..fde585d 100644 (file)
@@ -5980,26 +5980,20 @@ static int node_cmp_exception(ir_node *a, ir_node *b)
 /** Compares the attributes of two Div nodes. */
 static int node_cmp_attr_Div(ir_node *a, ir_node *b)
 {
-       const divmod_attr *ma = &a->attr.divmod;
-       const divmod_attr *mb = &b->attr.divmod;
+       const div_attr *ma = &a->attr.div;
+       const div_attr *mb = &b->attr.div;
        return ma->exc.pin_state != mb->exc.pin_state ||
                   ma->resmode       != mb->resmode ||
                   ma->no_remainder  != mb->no_remainder;
 }  /* node_cmp_attr_Div */
 
-/** Compares the attributes of two Div or Mod nodes. */
-static int node_cmp_attr_Div_Mod(ir_node *a, ir_node *b)
-{
-       const divmod_attr *ma = &a->attr.divmod;
-       const divmod_attr *mb = &b->attr.divmod;
-       return ma->exc.pin_state != mb->exc.pin_state ||
-                  ma->resmode       != mb->resmode;
-}  /* node_cmp_attr_Div_Mod */
-
 /** Compares the attributes of two Mod nodes. */
 static int node_cmp_attr_Mod(ir_node *a, ir_node *b)
 {
-       return node_cmp_attr_Div_Mod(a, b);
+       const mod_attr *ma = &a->attr.mod;
+       const mod_attr *mb = &b->attr.mod;
+       return ma->exc.pin_state != mb->exc.pin_state ||
+                  ma->resmode       != mb->resmode;
 }  /* node_cmp_attr_Mod */
 
 /** Compares the attributes of two Confirm nodes. */
index a4f4151..e767f1f 100644 (file)
@@ -289,12 +289,18 @@ typedef struct conv_attr {
        char           strict;        /**< If set, this is a strict Conv that cannot be removed. */
 } conv_attr;
 
-/** Div/Mod attribute. */
-typedef struct divmod_attr {
+/** Div attribute. */
+typedef struct div_attr {
        except_attr    exc;           /**< The exception attribute. MUST be the first one. */
        ir_mode        *resmode;      /**< Result mode for the division. */
        char           no_remainder;  /**< Set, if known that a division can be done without a remainder. */
-} divmod_attr;
+} div_attr;
+
+/** Mod attribute. */
+typedef struct mod_attr {
+       except_attr    exc;           /**< The exception attribute. MUST be the first one. */
+       ir_mode        *resmode;      /**< Result mode for the division. */
+} mod_attr;
 
 /** Inline Assembler support attribute. */
 typedef struct asm_attr {
@@ -336,7 +342,8 @@ typedef union ir_attr {
        copyb_attr     copyb;         /**< For CopyB operation */
        bound_attr     bound;         /**< For Bound operation */
        conv_attr      conv;          /**< For Conv operation */
-       divmod_attr    divmod;        /**< For Div/Mod operation */
+       div_attr       div;           /**< For Div operation */
+       mod_attr       mod;           /**< For Mod operation */
        asm_attr       assem;         /**< For ASM operation. */
 } ir_attr;
 
index 9296d84..0d8f646 100755 (executable)
@@ -459,7 +459,7 @@ class Div(Op):
                ("res",       "result of computation",                 "pn_Generic_other"),
        ]
        flags = [ "fragile", "uses_memory" ]
-       attrs_name = "divmod"
+       attrs_name = "div"
        attrs = [
                dict(
                        type    = "ir_mode*",
@@ -472,7 +472,7 @@ class Div(Op):
                        init = "0",
                )
        ]
-       attr_struct = "divmod_attr"
+       attr_struct = "div_attr"
        pinned      = "exception"
        op_index    = 1
        arity_override = "oparity_binary"
@@ -638,7 +638,7 @@ class Mod(Op):
                ("res",       "result of computation",                 "pn_Generic_other"),
        ]
        flags = [ "fragile", "uses_memory" ]
-       attrs_name = "divmod"
+       attrs_name = "mod"
        attrs = [
                dict(
                        type    = "ir_mode*",
@@ -646,7 +646,7 @@ class Mod(Op):
                        comment = "mode of the result",
                ),
        ]
-       attr_struct = "divmod_attr"
+       attr_struct = "mod_attr"
        pinned      = "exception"
        op_index    = 1
        arity_override = "oparity_binary"