some cleanups for middleend node creation in backends
authorMatthias Braun <matze@braunis.de>
Tue, 13 Sep 2011 14:50:59 +0000 (16:50 +0200)
committerMatthias Braun <matze@braunis.de>
Thu, 15 Sep 2011 07:55:21 +0000 (09:55 +0200)
Some backends create nodes in their lower_for_target phases already.
These nodes are placeholders for real backend nodes later, in contrast
they do not have register requirements or backend attributes. Simplified
this by allowing custom dumpers for them and leaving out the backend
node structs.

ir/be/ia32/ia32_spec.pl
ir/be/scripts/generate_new_opcodes.pl
ir/be/sparc/sparc_new_nodes.c
ir/be/sparc/sparc_spec.pl

index 6715190..acaffc1 100644 (file)
@@ -309,14 +309,15 @@ Adc => {
 },
 
 l_Add => {
-       op_flags  => [ "constlike" ],
-       reg_req   => { in => [ "none", "none" ], out => [ "none" ] },
        ins       => [ "left", "right" ],
+       attr_type => "",
+       dump_func => "NULL",
 },
 
 l_Adc => {
-       reg_req   => { in => [ "none", "none", "none" ], out => [ "none" ] },
        ins       => [ "left", "right", "eflags" ],
+       attr_type => "",
+       dump_func => "NULL",
 },
 
 Mul => {
@@ -335,14 +336,10 @@ Mul => {
 },
 
 l_Mul => {
-       # we should not rematrialize this node. It produces 2 results and has
-       # very strict constraints
-       op_flags  => [ "constlike" ],
-       cmp_attr  => "return 1;",
-       reg_req   => { in => [ "none", "none" ],
-                      out => [ "none", "none", "none", "none" ] },
        ins       => [ "left", "right" ],
        outs      => [ "res_low", "flags", "M", "res_high" ],
+       attr_type => "",
+       dump_func => "NULL",
 },
 
 IMul => {
@@ -376,12 +373,10 @@ IMul1OP => {
 },
 
 l_IMul => {
-       op_flags  => [ "constlike" ],
-       cmp_attr  => "return 1;",
-       reg_req   => { in => [ "none", "none" ],
-                      out => [ "none", "none", "none", "none" ] },
        ins       => [ "left", "right" ],
        outs      => [ "res_low", "flags", "M", "res_high" ],
+       attr_type => "",
+       dump_func => "NULL",
 },
 
 And => {
@@ -579,13 +574,15 @@ Sbb0 => {
 },
 
 l_Sub => {
-       reg_req   => { in => [ "none", "none" ], out => [ "none" ] },
        ins       => [ "minuend", "subtrahend" ],
+       attr_type => "",
+       dump_func => "NULL",
 },
 
 l_Sbb => {
-       reg_req   => { in => [ "none", "none", "none" ], out => [ "none" ] },
        ins       => [ "minuend", "subtrahend", "eflags" ],
+       attr_type => "",
+       dump_func => "NULL",
 },
 
 IDiv => {
@@ -977,6 +974,14 @@ Test8Bit => {
        modified_flags => $status_flags
 },
 
+l_Setcc => {
+       ins       => [ "cond" ],
+       outs      => [ "res" ],
+       mode      => "mode_Bu",
+       attr_type => "",
+       dump_func => "NULL",
+},
+
 Setcc => {
        #irn_flags => [ "rematerializable" ],
        reg_req   => { in => [ "eflags" ], out => [ "eax ebx ecx edx" ] },
@@ -1919,18 +1924,16 @@ CvtSI2SD => {
 
 
 l_LLtoFloat => {
-       op_flags => [ "labeled" ],
-       cmp_attr => "return 1;",
        ins      => [ "val_high", "val_low" ],
-       reg_req  => { in => [ "none", "none" ], out => [ "none" ] }
+       attr_type => "",
+       dump_func => "NULL",
 },
 
 l_FloattoLL => {
-       op_flags => [ "labeled" ],
-       cmp_attr => "return 1;",
        ins      => [ "val" ],
        outs     => [ "res_high", "res_low" ],
-       reg_req  => { in => [ "none" ], out => [ "none", "none" ] }
+       attr_type => "",
+       dump_func => "NULL",
 },
 
 CopyB => {
index 08ce0c9..af8e2f9 100755 (executable)
@@ -655,12 +655,14 @@ EOF
        }
 
        # set default values for state and flags if not given
-       $n{"state"}    = "floats" if (! exists($n{"state"}));
-       $n{"op_flags"} = ["none"] if (! exists($n{"op_flags"}));
+       $n{"state"}     = "floats" if (! exists($n{"state"}));
+       $n{"op_flags"}  = ["none"] if (! exists($n{"op_flags"}));
+       $n{"dump_func"} = "${arch}_dump_node" if (!exists($n{"dump_func"}));
+       my $dump_func = $n{"dump_func"};
 
        push(@obst_new_irop, "\n\tmemset(&ops, 0, sizeof(ops));\n");
        push(@obst_new_irop, "\tops.be_ops        = be_ops;\n");
-       push(@obst_new_irop, "\tops.dump_node     = $arch\_dump_node;\n");
+       push(@obst_new_irop, "\tops.dump_node     = ${dump_func};\n");
 
        if (defined($cmp_attr_func)) {
                push(@obst_new_irop, "\tops.node_cmp_attr = ${cmp_attr_func};\n");
index 558872e..20db725 100644 (file)
@@ -93,9 +93,6 @@ static void sparc_dump_node(FILE *F, ir_node *n, dump_reason_t reason)
                break;
 
        case dump_node_info_txt:
-               if (is_sparc_AddX_t(n) || is_sparc_AddCC_t(n))
-                       break;
-
                arch_dump_reqs_and_registers(F, n);
                sparc_attr = get_sparc_attr_const(n);
                if (sparc_attr->immediate_value_entity) {
index 005dc2e..6c1df1f 100644 (file)
@@ -284,11 +284,13 @@ AddCC_t => {
        ins       => [ "left", "right" ],
        outs      => [ "res", "flags" ],
        attr_type => "",
+       dump_node => "NULL",
 },
 
 AddX_t => {
        ins       => [ "left", "right", "flags_input" ],
        attr_type => "",
+       dump_node => "NULL",
 },
 
 Sub => {
@@ -316,11 +318,13 @@ SubCC_t => {
        ins       => [ "left", "right" ],
        outs      => [ "res", "flags" ],
        attr_type => "",
+       dump_node => "NULL",
 },
 
 SubX_t => {
        ins       => [ "left", "right", "flags_input" ],
        attr_type => "",
+       dump_node => "NULL",
 },
 
 # Load / Store