aboutsummaryrefslogtreecommitdiff
path: root/gas
diff options
context:
space:
mode:
authorMaciej W. Rozycki <macro@imgtec.com>2017-07-01 00:42:19 +0100
committerMaciej W. Rozycki <macro@imgtec.com>2017-07-01 00:42:19 +0100
commit834a65aadfda9755d8bd6ec76ba8b3a6d20a1beb (patch)
tree8d65445d801839f09d4dae726dceb10c241be8f1 /gas
parentbbd27b7684baf424bdaa7f0a1d39a2cd5b0d6134 (diff)
downloadgdb-834a65aadfda9755d8bd6ec76ba8b3a6d20a1beb.zip
gdb-834a65aadfda9755d8bd6ec76ba8b3a6d20a1beb.tar.gz
gdb-834a65aadfda9755d8bd6ec76ba8b3a6d20a1beb.tar.bz2
MIPS/GAS: Use a switch on relaxation type in microMIPS fixup creation
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.
Diffstat (limited to 'gas')
-rw-r--r--gas/ChangeLog5
-rw-r--r--gas/config/tc-mips.c25
2 files changed, 20 insertions, 10 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index 94a6a68..31de3e9 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,5 +1,10 @@
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'
calls in terms of `fix_new'.
diff --git a/gas/config/tc-mips.c b/gas/config/tc-mips.c
index a58c484..4eeb5ee 100644
--- a/gas/config/tc-mips.c
+++ b/gas/config/tc-mips.c
@@ -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;