This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[committed 3/3] MIPS/GAS: Use a switch on relaxation type in microMIPS fixup creation
- From: "Maciej W. Rozycki" <macro at imgtec dot com>
- To: <binutils at sourceware dot org>
- Date: Sat, 1 Jul 2017 00:47:41 +0100
- Subject: [committed 3/3] MIPS/GAS: Use a switch on relaxation type in microMIPS fixup creation
- Authentication-results: sourceware.org; auth=none
- References: <alpine.DEB.2.00.1706302350270.31404@tp.orcam.me.uk>
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.
---
binutils-umips-gas-convert-frag-switch.diff
Index: binutils/gas/config/tc-mips.c
===================================================================
--- binutils.orig/gas/config/tc-mips.c 2017-06-30 02:47:05.459654372 +0100
+++ binutils/gas/config/tc-mips.c 2017-06-30 02:47:09.890228568 +0100
@@ -18342,16 +18342,21 @@ md_convert_frag (bfd *abfd ATTRIBUTE_UNU
/* 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;