diff options
author | Alan Modra <amodra@gmail.com> | 2021-03-29 09:52:56 +1030 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2021-03-29 11:22:22 +1030 |
commit | 63b4cc53dc41c755f8b30d85edf29c153f76eba3 (patch) | |
tree | 8a43529c805f57a538e4a13333016edabca9b7ca /gas/config/tc-csky.c | |
parent | 854f1e4be9172c835d1b89973d29ce66f9e65479 (diff) | |
download | fsf-binutils-gdb-63b4cc53dc41c755f8b30d85edf29c153f76eba3.zip fsf-binutils-gdb-63b4cc53dc41c755f8b30d85edf29c153f76eba3.tar.gz fsf-binutils-gdb-63b4cc53dc41c755f8b30d85edf29c153f76eba3.tar.bz2 |
TRUE/FALSE simplification
There is really no need to write code like "foo != 0 ? TRUE : FALSE"
unless we had stupidly defined FALSE as something other than 0 or TRUE
as something other than 1. The simpler "foo != 0" does just as well.
Similarly "(condition == TRUE)" or "(condition == FALSE) can be
simplified to "(condition)" and "(!condition)" respectively.
I'll note that there is reason to use "integer_expression != 0" when
assigning a bfd_boolean rather than the simpler "integer_expression",
if you expect the variable to have 0 or 1 value. It's probably even a
good idea to not rely on implicit conversion if bfd_boolean were _Bool.
bfd/
* aoutx.h (aout_link_write_symbols): Don't cast boolean expression
to bfd_boolean.
* elf32-or1k.c (or1k_set_got_and_rela_sizes): Dont compare booleans
against FALSE.
* elf32-arc.c (name_for_global_symbol): Don't compare boolean to TRUE.
(is_reloc_PC_relative): Don't use "boolean_condition ? TRUE : FALSE".
(is_reloc_SDA_relative, is_reloc_for_GOT): Likewise.
(is_reloc_for_PLT, is_reloc_for_TLS): Likewise.
* elf32-arm.c (stm32l4xx_need_create_replacing_stub): Likewise.
* elf32-nds32.c (insert_nds32_elf_blank): Likewise.
* elf32-rx.c (rx_set_section_contents): Likewise.
* elfnn-aarch64.c (elfNN_aarch64_final_link_relocate): Likewise.
* elfxx-mips.c (_bfd_mips_elf_ignore_undef_symbol): Likewise.
* mach-o.c (bfd_mach_o_read_command): Likewise.
* targets.c (bfd_get_target_info): Likewise.
binutils/
* dlltool.c (main): Don't use "boolean_condition ? TRUE : FALSE".
* dwarf.c (read_and_display_attr_value): Likewise.
(display_debug_str_offsets): Likewise.
* objdump.c (dump_bfd): Likewise.
* readelf.c (dump_section_as_strings): Likewise.
(dump_section_as_bytes): Likewise.
gas/
* atof-generic.c (FALSE, TRUE): Don't define.
* config/obj-elf.h (FALSE, TRUE): Don't define.
* config/obj-som.h (FALSE, TRUE): Don't define.
* config/tc-hppa.h (FALSE, TRUE): Don't define.
* config/tc-pdp11.c (FALSE, TRUE): Don't define.
* config/tc-iq2000.h (obj_fix_adjustable): Delete.
* config/tc-m32r.h (TC_FIX_ADJUSTABLE): Delete.
* config/tc-mt.h (obj_fix_adjustable): Delete.
* config/tc-nds32.h (TC_FIX_ADJUSTABLE): Delete.
* config/tc-arc.c (parse_opcode_flags): Simplify boolean expression.
(relaxable_flag, relaxable_operand, assemble_insn): Likewise.
(tokenize_extregister): Likewise.
* config/tc-csky.c (parse_opcode, get_operand_value): Likewise.
(parse_operands_op, parse_operands, md_assemble): Likewise.
* config/tc-d10v.c (build_insn): Likewise.
* config/tc-score.c (s3_gen_insn_frag): Likewise.
* config/tc-score7.c (s7_gen_insn_frag, s7_relax_frag): Likewise.
* config/tc-tic6x.c (tic6x_update_features, md_assemble): Likewise.
* config/tc-z80.c (emit_byte): Likewise.
include/
* opcode/aarch64.h (alias_opcode_p): Simplify boolean expression.
(opcode_has_alias, pseudo_opcode_p, optional_operand_p): Likewise.
(opcode_has_special_coder): Likewise.
ld/
* emultempl/aix.em (gld${EMULATION_NAME}_before_allocation): Simplify
boolean expression.
* lexsup.c (parse_args): Likewise.
* pe-dll.c (pe_dll_id_target): Likewise.
opcodes/
* aarch64-opc.c (vector_qualifier_p): Simplify boolean expression.
(fp_qualifier_p, get_data_pattern): Likewise.
(aarch64_get_operand_modifier_from_value): Likewise.
(aarch64_extend_operator_p, aarch64_shift_operator_p): Likewise.
(operand_variant_qualifier_p): Likewise.
(qualifier_value_in_range_constraint_p): Likewise.
(aarch64_get_qualifier_esize): Likewise.
(aarch64_get_qualifier_nelem): Likewise.
(aarch64_get_qualifier_standard_value): Likewise.
(get_lower_bound, get_upper_bound): Likewise.
(aarch64_find_best_match, match_operands_qualifier): Likewise.
(aarch64_print_operand): Likewise.
* aarch64-opc.h (operand_has_inserter, operand_has_extractor): Likewise.
(operand_need_sign_extension, operand_need_shift_by_two): Likewise.
(operand_need_shift_by_four, operand_maybe_stack_pointer): Likewise.
* arm-dis.c (print_insn_mve, print_insn_thumb32): Likewise.
* tic6x-dis.c (tic6x_check_fetch_packet_header): Likewise.
(print_insn_tic6x): Likewise.
Diffstat (limited to 'gas/config/tc-csky.c')
-rw-r--r-- | gas/config/tc-csky.c | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/gas/config/tc-csky.c b/gas/config/tc-csky.c index 7a74eab..583fb8b 100644 --- a/gas/config/tc-csky.c +++ b/gas/config/tc-csky.c @@ -3314,7 +3314,7 @@ parse_opcode (char *str) { /* Is csky force 32 or 16 instruction? */ if (IS_CSKY_V2 (mach_flag) - && *opcode_end == '.' && has_suffix == FALSE) + && *opcode_end == '.' && !has_suffix) { has_suffix = TRUE; if (IS_OPCODE32F (opcode_end)) @@ -3334,7 +3334,7 @@ parse_opcode (char *str) } /* Is csky force 32 or 16 instruction? */ - if (has_suffix == FALSE) + if (!has_suffix) { if (IS_CSKY_V2 (mach_flag) && IS_OPCODE32F (opcode_end)) { @@ -3350,7 +3350,7 @@ parse_opcode (char *str) name[nlen] = '\0'; /* Generate macro_name for finding hash in macro hash_table. */ - if (has_suffix == TRUE) + if (has_suffix) nlen += 2; strncpy (macro_name, str, nlen); macro_name[nlen] = '\0'; @@ -3439,7 +3439,7 @@ get_operand_value (struct csky_opcode_info *op, return FALSE; } - if (get_operand_value (op, oper, &soprnd->subs[0]) == FALSE) + if (!get_operand_value (op, oper, &soprnd->subs[0])) { *s = rc; return FALSE; @@ -3452,7 +3452,7 @@ get_operand_value (struct csky_opcode_info *op, return FALSE; } - if (get_operand_value (op, oper, &soprnd->subs[1]) == FALSE) + if (!get_operand_value (op, oper, &soprnd->subs[1])) { *s = rc; return FALSE; @@ -3610,7 +3610,7 @@ get_operand_value (struct csky_opcode_info *op, int val = csky_insn.val[csky_insn.idx - 1]; log = csky_log_2 (val); csky_insn.val[csky_insn.idx - 1] = log; - return (log == -1 ? FALSE : TRUE); + return log != -1; } else return FALSE; @@ -3632,7 +3632,7 @@ get_operand_value (struct csky_opcode_info *op, } else csky_insn.val[csky_insn.idx - 1] = log; - return (log == -1 ? FALSE : TRUE); + return log != -1; } else return FALSE; @@ -3794,11 +3794,11 @@ get_operand_value (struct csky_opcode_info *op, else { csky_insn.val[csky_insn.idx] = 0; - if (is_psr_bit (oper) != FALSE) + if (is_psr_bit (oper)) while (**oper == ',') { *oper += 1; - if (is_psr_bit (oper) == FALSE) + if (!is_psr_bit (oper)) { ret = FALSE; break; @@ -3806,7 +3806,7 @@ get_operand_value (struct csky_opcode_info *op, } else ret = FALSE; - if (ret == TRUE && IS_CSKY_V1 (mach_flag) + if (ret && IS_CSKY_V1 (mach_flag) && csky_insn.val[csky_insn.idx] > 8) ret = FALSE; } @@ -4315,7 +4315,7 @@ parse_operands_op (char *str, struct csky_opcode_info *op) oper++; flag_pass = get_operand_value (&op[i], &oper, &op[i].oprnd.oprnds[j]); - if (flag_pass == FALSE) + if (!flag_pass) break; while (ISSPACE (*oper)) oper++; @@ -4342,7 +4342,7 @@ parse_operands_op (char *str, struct csky_opcode_info *op) } /* Parse operands in one table end. */ - if (flag_pass == TRUE) + if (flag_pass) { /* Parse operands success, set opcode_idx. */ csky_insn.opcode_idx = i; @@ -4366,7 +4366,7 @@ parse_operands (char *str) if (csky_insn.flag_force == INSN_OPCODE16F && (csky_insn.opcode->isa_flag16 & isa_flag) != 0) { - if (parse_operands_op (oper, csky_insn.opcode->op16) == TRUE) + if (parse_operands_op (oper, csky_insn.opcode->op16)) { csky_insn.isize = 2; return TRUE; @@ -4376,7 +4376,7 @@ parse_operands (char *str) else if (csky_insn.flag_force == INSN_OPCODE32F && (csky_insn.opcode->isa_flag32 & isa_flag) != 0) { - if (parse_operands_op (oper, csky_insn.opcode->op32) == TRUE) + if (parse_operands_op (oper, csky_insn.opcode->op32)) { csky_insn.isize = 4; return TRUE; @@ -4386,13 +4386,13 @@ parse_operands (char *str) else { if ((csky_insn.opcode->isa_flag16 & isa_flag) != 0 - && parse_operands_op (oper, csky_insn.opcode->op16) == TRUE) + && parse_operands_op (oper, csky_insn.opcode->op16)) { csky_insn.isize = 2; return TRUE; } if ((csky_insn.opcode->isa_flag32 & isa_flag) != 0 - && parse_operands_op (oper, csky_insn.opcode->op32) == TRUE) + && parse_operands_op (oper, csky_insn.opcode->op32)) { csky_insn.isize = 4; return TRUE; @@ -4559,7 +4559,7 @@ md_assemble (char *str) while (ISSPACE (* str)) str++; /* Get opcode from str. */ - if (parse_opcode (str) == FALSE) + if (!parse_opcode (str)) { csky_show_error (ERROR_OPCODE_ILLEGAL, 0, NULL, NULL); return; @@ -4586,7 +4586,7 @@ md_assemble (char *str) } /* Parse the operands according to operand type. */ - if (parse_operands (csky_insn.opcode_end) == FALSE) + if (!parse_operands (csky_insn.opcode_end)) { csky_show_error (error_state.err_num, error_state.opnum, (void *)error_state.arg1, (void *)error_state.arg1); @@ -4608,7 +4608,7 @@ md_assemble (char *str) } /* Adjust for xtrb0/xtrb1/xtrb2/xtrb3/divs/divu in csky v1 ISA. */ - if (mov_r1_after == TRUE) + if (mov_r1_after) { unsigned int mov_insn = CSKYV1_INST_MOV_RX_R1; mov_insn |= csky_insn.val[0]; @@ -4618,7 +4618,7 @@ md_assemble (char *str) md_number_to_chars (csky_insn.output, mov_insn, 2); csky_insn.isize += 2; } - if (mov_r1_before == TRUE) + if (mov_r1_before) csky_insn.isize += 2; /* Check literal. */ |