bescripts: Remove support for emit templates.
authorChristoph Mallon <christoph.mallon@gmx.de>
Sat, 1 Dec 2012 20:52:42 +0000 (21:52 +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 008ad0c..26d785c 100755 (executable)
@@ -31,8 +31,6 @@ our $target_dir = $ARGV[1];
 
 our $arch;
 our %nodes;
-our %emit_templates;
-our $finish_line_template = "be_emit_finish_line_gas(node);";
 
 my $return;
 
@@ -52,40 +50,6 @@ my @obst_func;   # stack for the emit functions
 my @obst_register;  # stack for emitter register code
 my $line;
 
-sub create_emitter {
-       my $result = shift;
-       my $indent = shift;
-       my $template = shift;
-       our %emit_templates;
-       our $arch;
-
-       $template = "\\t" . $template;
-
-       my @tokens = ($template =~ m/(?:[^%]|%%)+|\%[a-zA-Z_][a-zA-Z0-9_]*|%\./g);
-       for (@tokens) {
-               SWITCH: {
-                       if (/%\./)       { last SWITCH; }
-                       if (/^%([^%]+)/) {
-                               if(defined($emit_templates{$1})) {
-                                       push(@{$result}, "${indent}$emit_templates{$1}\n");
-                               } else {
-                                       print "Warning: No emit_template defined for '$1'\n";
-                                       push(@{$result}, "${indent}$1(node);\n");
-                               }
-                               last SWITCH;
-                       }
-                       $_ =~ s/%%/%/g;
-                       if (length($_) == 1) {
-                               push(@{$result}, "${indent}be_emit_char('$_');\n");
-                       } else {
-                               push(@{$result}, "${indent}be_emit_cstring(\"$_\");\n");
-                       }
-               }
-       }
-       push(@{$result}, "${indent}${finish_line_template}\n");
-}
-
-
 
 foreach my $op (keys(%nodes)) {
        my %n = %{ $nodes{"$op"} };
@@ -111,13 +75,7 @@ foreach my $op (keys(%nodes)) {
        my @emit = split(/\n/, $n{"emit"});
 
        foreach my $template (@emit) {
-               # substitute only lines, starting with a '.'
-               if ($template eq '') {
-                       # nothing
-               } elsif ($template =~ /^(\s*)\.\s*(.*)/) {
-                       my $indent = "\t$1";
-                       create_emitter(\@obst_func, $indent, $2);
-               } else {
+               if ($template ne '') {
                        push(@obst_func, "\t${arch}_emitf(node, \"$template\");\n");
                }
        }