MIPS/GAS: Use a switch on relaxation type in microMIPS fixup creation
authorMaciej W. Rozycki <macro@imgtec.com>
Fri, 30 Jun 2017 23:42:19 +0000 (00:42 +0100)
committerMaciej W. Rozycki <macro@imgtec.com>
Fri, 30 Jun 2017 23:42:19 +0000 (00:42 +0100)
Use a switch on the relaxation type rather than a chain of conditionals
in microMIPS fixup creation, improving source code structure and aiding
the compiler with code generation.

gas/
* config/tc-mips.c (md_convert_frag): Use a switch on the
microMIPS relaxation type rather than a chain of conditionals.

gas/ChangeLog
gas/config/tc-mips.c

index 94a6a68651fa991b909447a973fc1ceea5522767..31de3e9961c4f7bda3236830017606c29c466491 100644 (file)
@@ -1,3 +1,8 @@
+2017-06-30  Maciej W. Rozycki  <macro@imgtec.com>
+
+       * config/tc-mips.c (md_convert_frag): Use a switch on the
+       microMIPS relaxation type rather than a chain of conditionals.
+
 2017-06-30  Maciej W. Rozycki  <macro@imgtec.com>
 
        * config/tc-mips.c (md_convert_frag): Rewrite `fix_new_exp'
index a58c484f1f42136d501d13d3d3ad4d4a66e7cdb1..4eeb5ee6b20f25be4d8a999d66ee51ca8996c918 100644 (file)
@@ -18342,16 +18342,21 @@ md_convert_frag (bfd *abfd ATTRIBUTE_UNUSED, segT asec, fragS *fragp)
          /* We generate a fixup instead of applying it right now,
             because if there is linker relaxation, we're going to
             need the relocations.  */
-         if (type == 'D')
-           fixp = fix_new (fragp, buf - fragp->fr_literal, 2,
-                           fragp->fr_symbol, fragp->fr_offset,
-                           TRUE, BFD_RELOC_MICROMIPS_10_PCREL_S1);
-         else if (type == 'E')
-           fixp = fix_new (fragp, buf - fragp->fr_literal, 2,
-                           fragp->fr_symbol, fragp->fr_offset,
-                           TRUE, BFD_RELOC_MICROMIPS_7_PCREL_S1);
-         else
-           abort ();
+         switch (type)
+           {
+           case 'D':
+             fixp = fix_new (fragp, buf - fragp->fr_literal, 2,
+                             fragp->fr_symbol, fragp->fr_offset,
+                             TRUE, BFD_RELOC_MICROMIPS_10_PCREL_S1);
+             break;
+           case 'E':
+             fixp = fix_new (fragp, buf - fragp->fr_literal, 2,
+                             fragp->fr_symbol, fragp->fr_offset,
+                             TRUE, BFD_RELOC_MICROMIPS_7_PCREL_S1);
+             break;
+           default:
+             abort ();
+           }
 
          fixp->fx_file = fragp->fr_file;
          fixp->fx_line = fragp->fr_line;