add exc_attr to all be_nodes so you can dynamically pin/unpin them
[libfirm] / scripts / ir_spec.py
index 4bf7842..4a763d1 100755 (executable)
@@ -302,26 +302,18 @@ class Cast(Unop):
        init     = "assert(is_atomic_type(type));"
 
 class Cmp(Binop):
-       """Returns the relation of 2 operands"""
-       outs  = [
-               ("False", "always false",                            "0"),
-               ("Eq",    "equal",                                   "1"),
-               ("Lt",    "less",                                    "2"),
-               ("Le",    "less or equal",                           "pn_Cmp_Eq|pn_Cmp_Lt"),
-               ("Gt",    "greater",                                 "4"),
-               ("Ge",    "greater or equal",                        "pn_Cmp_Eq|pn_Cmp_Gt"),
-               ("Lg",    "less or greater ('not equal' for integer numbers)", "pn_Cmp_Lt|pn_Cmp_Gt"),
-               ("Leg",   "less, equal or greater ('not unordered')", "pn_Cmp_Lt|pn_Cmp_Eq|pn_Cmp_Gt"),
-               ("Uo",    "unordered",                               "8"),
-               ("Ue",    "unordered or equal",                      "pn_Cmp_Uo|pn_Cmp_Eq"),
-               ("Ul",    "unordered or less",                       "pn_Cmp_Uo|pn_Cmp_Lt"),
-               ("Ule",   "unordered, less or equal",                "pn_Cmp_Uo|pn_Cmp_Lt|pn_Cmp_Eq"),
-               ("Ug",    "unordered or greater",                    "pn_Cmp_Uo|pn_Cmp_Gt"),
-               ("Uge",   "onordered, greater or equal",             "pn_Cmp_Uo|pn_Cmp_Gt|pn_Cmp_Eq"),
-               ("Ne",    "unordered, less or greater ('not equal' for floatingpoint numbers)", "pn_Cmp_Uo|pn_Cmp_Lt|pn_Cmp_Gt"),
-               ("True",  "always true",                             "15"),
-       ]
+       """Compares its two operands and checks wether a specified
+          relation (like less or equal) is fulfilled."""
        flags = []
+       mode  = "mode_b"
+       attrs = [
+               dict(
+                       type    = "ir_relation",
+                       name    = "relation",
+                       comment = "Comparison relation"
+               )
+       ]
+       attr_struct = "cmp_attr"
 
 class Cond(Op):
        """Conditionally change control flow. There are two versions of this node:
@@ -381,9 +373,9 @@ class Confirm(Op):
        pinned   = "yes"
        attrs    = [
                dict(
-                       name    = "cmp",
-                       type    = "pn_Cmp",
-                       comment = "compare operation",
+                       name    = "relation",
+                       type    = "ir_relation",
+                       comment = "relation of value to bound",
                ),
        ]
        attr_struct = "confirm_attr"
@@ -446,7 +438,7 @@ class CopyB(Op):
        pinned_init = "op_pin_state_pinned"
 
 class Div(Op):
-       """returns the quotient of its 2 operands, integer version"""
+       """returns the quotient of its 2 operands"""
        ins   = [
                ("mem",   "memory dependency"),
                ("left",  "first operand"),
@@ -459,7 +451,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,35 +464,7 @@ class Div(Op):
                        init = "0",
                )
        ]
-       attr_struct = "divmod_attr"
-       pinned      = "exception"
-       op_index    = 1
-       arity_override = "oparity_binary"
-
-class DivMod(Op):
-       """divides its 2 operands and computes the remainder of the division"""
-       ins   = [
-               ("mem",   "memory dependency"),
-               ("left",  "first operand"),
-               ("right", "second operand"),
-       ]
-       outs  = [
-               ("M",         "memory result",                         "pn_Generic_M"),
-               ("X_regular", "control flow when no exception occurs", "pn_Generic_X_regular"),
-               ("X_except",  "control flow when exception occured",   "pn_Generic_X_except"),
-               ("res_div",   "result of computation a/b",             "pn_Generic_other"),
-               ("res_mod",   "result of computation a%b"),
-       ]
-       flags = [ "fragile", "uses_memory" ]
-       attrs_name = "divmod"
-       attrs = [
-               dict(
-                       type    = "ir_mode*",
-                       name    = "resmode",
-                       comment = "mode of the result value",
-               ),
-       ]
-       attr_struct = "divmod_attr"
+       attr_struct = "div_attr"
        pinned      = "exception"
        op_index    = 1
        arity_override = "oparity_binary"
@@ -666,7 +630,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*",
@@ -674,7 +638,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"
@@ -766,33 +730,6 @@ class Proj(Op):
        ]
        attr_struct = "proj_attr"
 
-class Quot(Op):
-       """returns the quotient of its 2 operands, floatingpoint version"""
-       ins   = [
-          ("mem",   "memory dependency"),
-          ("left",  "first operand"),
-          ("right", "second operand"),
-       ]
-       outs  = [
-               ("M",         "memory result",                         "pn_Generic_M"),
-               ("X_regular", "control flow when no exception occurs", "pn_Generic_X_regular"),
-               ("X_except",  "control flow when exception occured",   "pn_Generic_X_except"),
-               ("res",       "result of computation",                 "pn_Generic_other"),
-       ]
-       flags = [ "fragile", "uses_memory" ]
-       attrs_name = "divmod"
-       attrs = [
-               dict(
-                       type    = "ir_mode*",
-                       name    = "resmode",
-                       comment = "mode of the result value",
-               ),
-       ]
-       attr_struct = "divmod_attr"
-       pinned      = "exception"
-       op_index    = 1
-       arity_override = "oparity_binary"
-
 class Raise(Op):
        """Raises an exception. Unconditional change of control flow. Writes an
        explicit Except variable to memory to pass it to the exception handler.
@@ -964,7 +901,7 @@ class Tuple(Op):
        following Proj nodes have not to be changed. (They are hard to find due to
        the implementation with pointers in only one direction.) The Tuple node is
        smaller than any other node, so that a node can be changed into a Tuple by
-       just changing it's opcode and giving it a new in array."""
+       just changing its opcode and giving it a new in array."""
        arity  = "variable"
        mode   = "mode_T"
        pinned = "no"