Commit 7a594c85 authored by Matthias Braun's avatar Matthias Braun
Browse files

node generator: don't create pn_ and n_ enums if there are no members

[r28015]
parent 1a3a33b6
......@@ -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
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment