bescripts: Set be_emit_nothing() as emitter, if the emitter string of a node is empty.
authorChristoph Mallon <christoph.mallon@gmx.de>
Sat, 1 Dec 2012 22:08:00 +0000 (23:08 +0100)
committerChristoph Mallon <christoph.mallon@gmx.de>
Sun, 2 Dec 2012 08:56:25 +0000 (09:56 +0100)
ir/be/scripts/generate_emitter.pl

index 26d785c..4730f19 100755 (executable)
@@ -48,7 +48,6 @@ my $target_h = $target_dir."/gen_".$arch."_emitter.h";
 # stacks for output
 my @obst_func;   # stack for the emit functions
 my @obst_register;  # stack for emitter register code
-my $line;
 
 
 foreach my $op (keys(%nodes)) {
@@ -57,19 +56,14 @@ foreach my $op (keys(%nodes)) {
        # skip this node description if no emit information is available
        next if (!defined($n{"emit"}));
 
-       $line = "static void emit_${arch}_${op}(const ir_node *node)";
-
-       push(@obst_register, "\tbe_set_emitter(op_${arch}_${op}, emit_${arch}_${op});\n");
-
-       if($n{"emit"} eq "") {
-               push(@obst_func, $line."\n");
-               push(@obst_func, "{\n");
-               push(@obst_func, "\t(void) node;\n");
-               push(@obst_func, "}\n\n");
+       if ($n{"emit"} eq "") {
+               push(@obst_register, "\tbe_set_emitter(op_${arch}_${op}, be_emit_nothing);\n");
                next;
        }
 
-       push(@obst_func, $line."\n");
+       push(@obst_register, "\tbe_set_emitter(op_${arch}_${op}, emit_${arch}_${op});\n");
+
+       push(@obst_func, "static void emit_${arch}_${op}(const ir_node *node)\n");
        push(@obst_func, "{\n");
 
        my @emit = split(/\n/, $n{"emit"});