Start block isn't a special case anymore (and now get the old node nr).
[libfirm] / ir / be / mips / mips_spec.pl
index e93e2be..c1dfb2d 100644 (file)
@@ -7,80 +7,6 @@
 $arch = "mips";
 $new_emit_syntax = 1;
 
-# The node description is done as a perl hash initializer with the
-# following structure:
-#
-# %nodes = (
-#
-# <op-name> => {
-#   op_flags  => "N|L|C|X|I|F|Y|H|c|K",
-#   "arity"     => "0|1|2|3 ... |variable|dynamic|any",
-#   "state"     => "floats|pinned|mem_pinned|exc_pinned",
-#   "args"      => [
-#                    { "type" => "type 1", "name" => "name 1" },
-#                    { "type" => "type 2", "name" => "name 2" },
-#                    ...
-#                  ],
-#   "comment"   => "any comment for constructor",
-#   reg_req   => { in => [ "reg_class|register" ], out => [ "reg_class|register|in_rX" ] },
-#   "cmp_attr"  => "c source code for comparing node attributes",
-#   emit      => "emit code with templates",
-#   "rd_constructor" => "c source code which constructs an ir_node"
-# },
-#
-# ... # (all nodes you need to describe)
-#
-# ); # close the %nodes initializer
-
-# op_flags: flags for the operation, OPTIONAL (default is "N")
-# the op_flags correspond to the firm irop_flags:
-#   N   irop_flag_none
-#   L   irop_flag_labeled
-#   C   irop_flag_commutative
-#   X   irop_flag_cfopcode
-#   I   irop_flag_ip_cfopcode
-#   F   irop_flag_fragile
-#   Y   irop_flag_forking
-#   H   irop_flag_highlevel
-#   c   irop_flag_constlike
-#   K   irop_flag_keep
-#
-#   R   rematerializeable
-#   N   not spillable
-#   I   ignore for register allocation
-#
-# state: state of the operation, OPTIONAL (default is "floats")
-#
-# arity: arity of the operation, MUST NOT BE OMITTED
-#
-# args:  the OPTIONAL arguments of the node constructor (debug, irg and block
-#        are always the first 3 arguments and are always autmatically
-#        created)
-#        If this key is missing the following arguments will be created:
-#        for i = 1 .. arity: ir_node *op_i
-#        ir_mode *mode
-#
-# outs:  if a node defines more than one output, the names of the projections
-#        nodes having outs having automatically the mode mode_T
-#
-# comment: OPTIONAL comment for the node constructor
-#
-# rd_constructor: for every operation there will be a
-#      new_rd_<arch>_<op-name> function with the arguments from above
-#      which creates the ir_node corresponding to the defined operation
-#      you can either put the complete source code of this function here
-#
-#      This key is OPTIONAL. If omitted, the following constructor will
-#      be created:
-#      if (!op_<arch>_<op-name>) assert(0);
-#      for i = 1 to arity
-#         set in[i] = op_i
-#      done
-#      res = new_ir_node(db, irg, block, op_<arch>_<op-name>, mode, arity, in)
-#      return res
-#
-# NOTE: rd_constructor and args are only optional if and only if arity is 0,1,2 or 3
-
 # register types:
 #   0 - no special type
 #   1 - caller save (register must be saved by the caller of a function)
@@ -89,7 +15,7 @@ $new_emit_syntax = 1;
 # NOTE: Last entry of each class is the largest Firm-Mode a register can hold\
 %reg_classes = (
        "gp" => [
-               { name => "zero", type => 4+2 },  # always zero
+               { name => "zero", type => 4 },  # always zero
                { name => "at", type => 4 }, # reserved for assembler
                { name => "v0", realname => "2", type => 1 }, # first return value
                { name => "v1", realname => "3", type => 1 }, # second return value
@@ -127,19 +53,19 @@ $new_emit_syntax = 1;
 ); # %reg_classes
 
 %emit_templates = (
-    S0  => "${arch}_emit_source_register(env, node, 0);",
-    S1  => "${arch}_emit_source_register(env, node, 1);",
-    S2  => "${arch}_emit_source_register(env, node, 2);",
-       SI1 => "${arch}_emit_source_register_or_immediate(env, node, 1);",
-    D0  => "${arch}_emit_dest_register(env, node, 0);",
-    D1  => "${arch}_emit_dest_register(env, node, 1);",
-    D2  => "${arch}_emit_dest_register(env, node, 2);",
-       A0  => "${arch}_emit_load_store_address(env, node, 0);",
-       I   => "${arch}_emit_immediate_suffix(env, node, 1);",
-       C   => "${arch}_emit_immediate(env, node);",
-       JumpTarget => "${arch}_emit_jump_target(env, node);",
-       JumpTarget1 => "${arch}_emit_jump_target_proj(env, node, 1);",
-       JumpOrFallthrough => "${arch}_emit_jump_or_fallthrough(env, node, 0);",
+    S0  => "${arch}_emit_source_register(node, 0);",
+    S1  => "${arch}_emit_source_register(node, 1);",
+    S2  => "${arch}_emit_source_register(node, 2);",
+       SI1 => "${arch}_emit_source_register_or_immediate(node, 1);",
+    D0  => "${arch}_emit_dest_register(node, 0);",
+    D1  => "${arch}_emit_dest_register(node, 1);",
+    D2  => "${arch}_emit_dest_register(node, 2);",
+       A0  => "${arch}_emit_load_store_address(node, 0);",
+       I   => "${arch}_emit_immediate_suffix(node, 1);",
+       C   => "${arch}_emit_immediate(node);",
+       JumpTarget => "${arch}_emit_jump_target(node);",
+       JumpTarget1 => "${arch}_emit_jump_target_proj(node, 1);",
+       JumpOrFallthrough => "${arch}_emit_jump_or_fallthrough(node, 0);",
 );
 
 $default_attr_type = "mips_attr_t";
@@ -148,12 +74,12 @@ $default_copy_attr = "mips_copy_attr";
 $mode_gp = "mode_Iu";
 
 %init_attr = (
-       mips_attr_t            => "\tinit_mips_attributes(res, flags, in_reqs, out_reqs, exec_units, n_res, latency);",
+       mips_attr_t            => "\tinit_mips_attributes(res, flags, in_reqs, out_reqs, exec_units, n_res);",
 
-       mips_immediate_attr_t  => "\tinit_mips_attributes(res, flags, in_reqs, out_reqs, exec_units, n_res, latency);\n".
+       mips_immediate_attr_t  => "\tinit_mips_attributes(res, flags, in_reqs, out_reqs, exec_units, n_res);\n".
                                 "\tinit_mips_immediate_attributes(res, imm_type, entity, val);",
 
-       mips_load_store_attr_t => "\tinit_mips_attributes(res, flags, in_reqs, out_reqs, exec_units, n_res, latency);\n".
+       mips_load_store_attr_t => "\tinit_mips_attributes(res, flags, in_reqs, out_reqs, exec_units, n_res);\n".
                                 "\tinit_mips_load_store_attributes(res, entity, offset);",
 );
 
@@ -179,8 +105,7 @@ $mode_gp = "mode_Iu";
 Immediate => {
        state     => "pinned",
        op_flags  => "c",
-       irn_flags => "I",
-       reg_req   => { out => [ "gp_NOREG" ] },
+       reg_req   => { out => [ "gp_NOREG:I" ] },
        attr      => "mips_immediate_type_t imm_type, ir_entity *entity, long val",
        attr_type => "mips_immediate_attr_t",
        mode      => $mode_gp,
@@ -345,8 +270,7 @@ mfhi => {
 zero => {
        state     => "pinned",
        op_flags  => "c",
-       irn_flags => "I",
-       reg_req   => { out => [ "zero" ] },
+       reg_req   => { out => [ "zero:I" ] },
        emit      => '',
        mode      => $mode_gp
 },