From df2faee01a5832057bb3ca0ba5f67e979c916e19 Mon Sep 17 00:00:00 2001 From: Christoph Mallon Date: Sun, 2 Dec 2012 14:16:38 +0100 Subject: [PATCH] bescripts: Copy all common node attributes into the constructor variants. --- ir/be/scripts/generate_new_opcodes.pl | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/ir/be/scripts/generate_new_opcodes.pl b/ir/be/scripts/generate_new_opcodes.pl index d4f3a18b4..9f40503d8 100755 --- a/ir/be/scripts/generate_new_opcodes.pl +++ b/ir/be/scripts/generate_new_opcodes.pl @@ -436,6 +436,21 @@ EOF $obst_constructor .= "}\n\n"; } +my @node_attrs = ( + "args", + "arity", + "attr", + "comment", + "custominit", + "init_attr", + "ins", + "irn_flags", + "mode", + "out_arity", + "outs", + "reg_req", +); + $obst_enum_op .= "typedef enum ${arch}_opcodes {\n"; foreach my $op (keys(%nodes)) { my %n = %{ $nodes{"$op"} }; @@ -584,9 +599,7 @@ EOF } else { # Create 1 default constructor my %constructor = (); - foreach my $a ("comment", "ins", "outs", "args", "attr", - "reg_req", "init_attr", "irn_flags", "mode", "arity", - "out_arity", "custominit") { + foreach my $a (@node_attrs) { if (defined($n{$a})) { $constructor{$a} = $n{$a}; } @@ -597,8 +610,7 @@ EOF foreach my $constr (keys(%constructors)) { my %cstr = %{ $constructors{$constr} }; # Copy some values from outer node if they don't exists in the constr - foreach my $a ("ins", "outs", "irn_flags", "mode", "args", "attr", - "custominit") { + foreach my $a (@node_attrs) { if (!defined($cstr{$a}) && defined($n{$a})) { $cstr{$a} = $n{$a}; } -- 2.20.1