[05/20] Merge the handle_serialized_line function into the preceding loop

Message ID 1395664691-60544-5-git-send-email-martin@martin.st
State Committed
Commit 3a516909c15adbe3c9bca84c79776ecb956b0b8c
Headers show

Commit Message

Martin Storsjö March 24, 2014, 12:37 p.m.
Since the second pass loop doesn't handle expanding repetitions
any longer, there's no need to have this as a separate function.
---
 gas-preprocessor.pl | 18 ++++++------------
 1 file changed, 6 insertions(+), 12 deletions(-)

Comments

Janne Grunau March 24, 2014, 2:32 p.m. | #1
On 2014-03-24 14:37:56 +0200, Martin Storsjö wrote:
> Since the second pass loop doesn't handle expanding repetitions
> any longer, there's no need to have this as a separate function.
> ---
>  gas-preprocessor.pl | 18 ++++++------------
>  1 file changed, 6 insertions(+), 12 deletions(-)
> 
> diff --git a/gas-preprocessor.pl b/gas-preprocessor.pl
> index 5a048ec..190ef87 100755
> --- a/gas-preprocessor.pl
> +++ b/gas-preprocessor.pl
> @@ -684,23 +684,17 @@ foreach my $line (@pass1_lines) {
>          }
>      }
>  
> -    handle_serialized_line($line);
> -}
> -
> -sub handle_serialized_line {
> -    my $line = @_[0];
> -
>      # Strip out the .set lines from the armasm output
> -    return if (handle_set($line) and $as_type eq "armasm");
> +    next if (handle_set($line) and $as_type eq "armasm");
>  
>      if ($line =~ /\.unreq\s+(.*)/) {
>          if (defined $neon_alias_reg{$1}) {
>              delete $neon_alias_reg{$1};
>              delete $neon_alias_type{$1};
> -            return;
> +            next;
>          } elsif (defined $aarch64_req_alias{$1}) {
>              delete $aarch64_req_alias{$1};
> -            return;
> +            next;
>          }
>      }
>      # old gas versions store upper and lower case names on .req,
> @@ -715,7 +709,7 @@ sub handle_serialized_line {
>      if ($line =~ /(\w+)\s+\.(dn|qn)\s+(\w+)(?:\.(\w+))?(\[\d+\])?/) {
>          $neon_alias_reg{$1} = "$3$5";
>          $neon_alias_type{$1} = $4;
> -        return;
> +        next;
>      }
>      if (scalar keys %neon_alias_reg > 0 && $line =~ /^\s+v\w+/) {
>          # This line seems to possibly have a neon instruction
> @@ -736,7 +730,7 @@ sub handle_serialized_line {
>          # clang's integrated aarch64 assembler in Xcode 5 does not support .req/.unreq
>          if ($line =~ /\b(\w+)\s+\.req\s+(\w+)\b/) {
>              $aarch64_req_alias{$1} = $2;
> -            return;
> +            next;
>          }
>          foreach (keys %aarch64_req_alias) {
>              my $alias = $_;
> @@ -809,7 +803,7 @@ sub handle_serialized_line {
>          if ($line =~ s/^(\w+):/$1/) {
>              # Skip labels that have already been declared with a PROC,
>              # labels must not be declared multiple times.
> -            return if (defined $labels_seen{$1});
> +            next if (defined $labels_seen{$1});
>              $labels_seen{$1} = 1;
>          } elsif ($line !~ /(\w+) PROC/) {
>              # If not a label, make sure the line starts with whitespace,

ok

Janne

Patch

diff --git a/gas-preprocessor.pl b/gas-preprocessor.pl
index 5a048ec..190ef87 100755
--- a/gas-preprocessor.pl
+++ b/gas-preprocessor.pl
@@ -684,23 +684,17 @@  foreach my $line (@pass1_lines) {
         }
     }
 
-    handle_serialized_line($line);
-}
-
-sub handle_serialized_line {
-    my $line = @_[0];
-
     # Strip out the .set lines from the armasm output
-    return if (handle_set($line) and $as_type eq "armasm");
+    next if (handle_set($line) and $as_type eq "armasm");
 
     if ($line =~ /\.unreq\s+(.*)/) {
         if (defined $neon_alias_reg{$1}) {
             delete $neon_alias_reg{$1};
             delete $neon_alias_type{$1};
-            return;
+            next;
         } elsif (defined $aarch64_req_alias{$1}) {
             delete $aarch64_req_alias{$1};
-            return;
+            next;
         }
     }
     # old gas versions store upper and lower case names on .req,
@@ -715,7 +709,7 @@  sub handle_serialized_line {
     if ($line =~ /(\w+)\s+\.(dn|qn)\s+(\w+)(?:\.(\w+))?(\[\d+\])?/) {
         $neon_alias_reg{$1} = "$3$5";
         $neon_alias_type{$1} = $4;
-        return;
+        next;
     }
     if (scalar keys %neon_alias_reg > 0 && $line =~ /^\s+v\w+/) {
         # This line seems to possibly have a neon instruction
@@ -736,7 +730,7 @@  sub handle_serialized_line {
         # clang's integrated aarch64 assembler in Xcode 5 does not support .req/.unreq
         if ($line =~ /\b(\w+)\s+\.req\s+(\w+)\b/) {
             $aarch64_req_alias{$1} = $2;
-            return;
+            next;
         }
         foreach (keys %aarch64_req_alias) {
             my $alias = $_;
@@ -809,7 +803,7 @@  sub handle_serialized_line {
         if ($line =~ s/^(\w+):/$1/) {
             # Skip labels that have already been declared with a PROC,
             # labels must not be declared multiple times.
-            return if (defined $labels_seen{$1});
+            next if (defined $labels_seen{$1});
             $labels_seen{$1} = 1;
         } elsif ($line !~ /(\w+) PROC/) {
             # If not a label, make sure the line starts with whitespace,