From: Matthias Braun Date: Wed, 22 Sep 2010 14:07:37 +0000 (+0000) Subject: node generator: don't create pn_ and n_ enums if there are no members X-Git-Url: http://nsz.repo.hu/git/?a=commitdiff_plain;h=7a594c85a94ddeacfe70c6bb1a8b90d2129c2fdf;p=libfirm node generator: don't create pn_ and n_ enums if there are no members [r28015] --- diff --git a/ir/be/scripts/generate_new_opcodes.pl b/ir/be/scripts/generate_new_opcodes.pl index e10460e2e..7b960869f 100755 --- a/ir/be/scripts/generate_new_opcodes.pl +++ b/ir/be/scripts/generate_new_opcodes.pl @@ -530,18 +530,20 @@ foreach my $op (keys(%nodes)) { $num_outs = $#outs + 1; - $obst_proj .= "\nenum pn_${op} {\n"; - - for (my $idx = 0; $idx <= $#outs; $idx++) { - # check, if we have additional flags annotated to out - if ($outs[$idx] =~ /:((S|I)(\|(S|I))*)/) { - push(@out_flags, $1); - $outs[$idx] =~ s/:((S|I)(\|(S|I))*)//; + if ($num_outs > 0) { + $obst_proj .= "\nenum pn_${op} {\n"; + + for (my $idx = 0; $idx <= $#outs; $idx++) { + # check, if we have additional flags annotated to out + if ($outs[$idx] =~ /:((S|I)(\|(S|I))*)/) { + push(@out_flags, $1); + $outs[$idx] =~ s/:((S|I)(\|(S|I))*)//; + } + $obst_proj .= "\tpn_${op}_".$outs[$idx]." = ${idx},\n"; } - $obst_proj .= "\tpn_${op}_".$outs[$idx]." = ${idx},\n"; - } - $obst_proj .= "};\n"; + $obst_proj .= "};\n"; + } # outs have names, it must be a mode_T node if (!defined($n{mode})) { $n{mode} = "mode_T"; @@ -555,11 +557,13 @@ foreach my $op (keys(%nodes)) { die "Fatal error: Op ${op} has different number of ins and arity\n"; } - $obst_proj .= "\nenum n_$op {\n"; - for (my $idx = 0; $idx <= $#ins; $idx++) { - $obst_proj .= "\tn_${op}_".$ins[$idx]." = ${idx},\n"; + if ($#ins >= 0) { + $obst_proj .= "\nenum n_$op {\n"; + for (my $idx = 0; $idx <= $#ins; $idx++) { + $obst_proj .= "\tn_${op}_".$ins[$idx]." = ${idx},\n"; + } + $obst_proj .= "};\n"; } - $obst_proj .= "};\n"; } # Create opcode