gen_docu: fix missing attributes, show generation time at the end
[libfirm] / scripts / ir_spec.py
index 26993a5..c82d236 100755 (executable)
@@ -213,7 +213,6 @@ class Bound(Op):
        pinned_init = "op_pin_state_pinned"
        throws_init = "false"
        attr_struct = "bound_attr"
-       attrs_name  = "bound"
 
 class Builtin(Op):
        """performs a backend-specific builtin."""
@@ -222,8 +221,8 @@ class Builtin(Op):
        ]
        arity    = "variable"
        outs     = [
-               ("M",        "memory result"),
-               ("1_result", "first result"),
+               ("M", "memory result"),
+               # results follow here
        ]
        flags    = [ "uses_memory" ]
        attrs    = [
@@ -317,19 +316,7 @@ class Cmp(Binop):
        attr_struct = "cmp_attr"
 
 class Cond(Op):
-       """Conditionally change control flow. There are two versions of this node:
-
-       Boolean Cond:
-       Input:  A value of mode_b
-       Output: A tuple of two control flows. The first is taken if the input is
-               false, the second if it is true.
-
-       Switch Cond:
-       Input:  A value of mode_Iu
-       Output: A tuple of n control flows. If the Cond's input is i, control flow
-       will proceed along output i. If the input is >= n control flow proceeds
-       along output def_proj.
-       """
+       """Conditionally change control flow."""
        ins      = [
                ("selector",  "condition parameter"),
        ]
@@ -340,21 +327,42 @@ class Cond(Op):
        flags    = [ "cfopcode", "forking" ]
        pinned   = "yes"
        attrs    = [
-               dict(
-                       name    = "default_proj",
-                       type    = "long",
-                       init    = "0",
-                       comment = "Proj-number of default case for switch-Cond",
-               ),
                dict(
                        name    = "jmp_pred",
                        type    = "cond_jmp_predicate",
                        init    = "COND_JMP_PRED_NONE",
                        comment = "can indicate the most likely jump",
-               )
+               ),
        ]
        attr_struct = "cond_attr"
 
+class Switch(Op):
+       """Change control flow. The destination is choosen based on an integer input value which is looked up in a table.
+
+       Backends can implement this efficiently using a jump table."""
+       ins    = [
+               ("selector", "input selector"),
+       ]
+       outs   = [
+               ("default", "control flow if no other case matches"),
+       ]
+       flags  = [ "cfopcode", "forking" ]
+       pinned = "yes"
+       attrs  = [
+               dict(
+                       name    = "n_outs",
+                       type    = "unsigned",
+                       comment = "number of outputs (including pn_Switch_default)",
+               ),
+               dict(
+                       name    = "table",
+                       type    = "ir_switch_table*",
+                       comment = "table describing mapping from input values to Proj numbers",
+               ),
+       ]
+       attr_struct = "switch_attr"
+       attrs_name  = "switcha"
+
 class Confirm(Op):
        """Specifies constraints for a value. This allows explicit representation
        of path-sensitive properties. (Example: This value is always >= 0 on 1
@@ -380,7 +388,6 @@ class Confirm(Op):
                ),
        ]
        attr_struct = "confirm_attr"
-       attrs_name  = "confirm"
 
 class Const(Op):
        """Returns a constant value."""
@@ -411,7 +418,6 @@ class Conv(Unop):
                )
        ]
        attr_struct = "conv_attr"
-       attrs_name  = "conv"
 
 class CopyB(Op):
        """Copies a block of memory"""
@@ -434,7 +440,6 @@ class CopyB(Op):
                )
        ]
        attr_struct = "copyb_attr"
-       attrs_name  = "copyb"
        pinned      = "memory"
        pinned_init = "op_pin_state_pinned"
        throws_init = "false"
@@ -453,7 +458,6 @@ class Div(Op):
                ("X_except",  "control flow when exception occured"),
        ]
        flags = [ "fragile", "uses_memory" ]
-       attrs_name = "div"
        attrs = [
                dict(
                        type    = "ir_mode*",
@@ -624,6 +628,7 @@ class Mod(Op):
        """returns the remainder of its operands from an implied division.
 
        Examples:
+
        * mod(5,3)   produces 2
        * mod(5,-3)  produces 2
        * mod(-5,3)  produces -2
@@ -641,7 +646,6 @@ class Mod(Op):
                ("X_except",  "control flow when exception occured"),
        ]
        flags = [ "fragile", "uses_memory" ]
-       attrs_name = "mod"
        attrs = [
                dict(
                        type    = "ir_mode*",
@@ -871,21 +875,21 @@ class Sub(Binop):
 class SymConst(Op):
        """A symbolic constant.
 
-        - symconst_type_tag   The symbolic constant represents a type tag.  The
-                              type the tag stands for is given explicitly.
-        - symconst_type_size  The symbolic constant represents the size of a type.
-                              The type of which the constant represents the size
-                              is given explicitly.
-        - symconst_type_align The symbolic constant represents the alignment of a
-                              type.  The type of which the constant represents the
-                              size is given explicitly.
-        - symconst_addr_ent   The symbolic constant represents the address of an
-                              entity (variable or method).  The variable is given
-                              explicitly by a firm entity.
-        - symconst_ofs_ent    The symbolic constant represents the offset of an
-                              entity in its owner type.
-        - symconst_enum_const The symbolic constant is a enumeration constant of
-                              an enumeration type."""
+        - *symconst_type_tag*  The symbolic constant represents a type tag.  The
+                               type the tag stands for is given explicitly.
+        - *symconst_type_size* The symbolic constant represents the size of a type.
+                               The type of which the constant represents the size
+                               is given explicitly.
+        - *symconst_type_align* The symbolic constant represents the alignment of a
+                               type.  The type of which the constant represents the
+                               size is given explicitly.
+        - *symconst_addr_ent*  The symbolic constant represents the address of an
+                               entity (variable or method).  The variable is given
+                               explicitly by a firm entity.
+        - *symconst_ofs_ent*   The symbolic constant represents the offset of an
+                               entity in its owner type.
+        - *symconst_enum_const* The symbolic constant is a enumeration constant of
+                               an enumeration type."""
        mode       = "mode_P"
        flags      = [ "constlike", "start_block" ]
        knownBlock = True