diff options
author | Alan Modra <amodra@gmail.com> | 2022-05-27 12:37:21 +0930 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2022-05-27 22:08:59 +0930 |
commit | 0e3c1eebb22e0ade28b619fb41f42d66ed6fb145 (patch) | |
tree | 8a886ac9438d7e9268807c07585eef11a146714d /gas | |
parent | aa9b5dbc0f30855aa23034cbd78a1f2025cb9fa9 (diff) | |
download | gdb-0e3c1eebb22e0ade28b619fb41f42d66ed6fb145.zip gdb-0e3c1eebb22e0ade28b619fb41f42d66ed6fb145.tar.gz gdb-0e3c1eebb22e0ade28b619fb41f42d66ed6fb145.tar.bz2 |
Remove use of bfd_uint64_t and similar
Requiring C99 means that uses of bfd_uint64_t can be replaced with
uint64_t, and similarly for bfd_int64_t, BFD_HOST_U_64_BIT, and
BFD_HOST_64_BIT. This patch does that, removes #ifdef BFD_HOST_*
and tidies a few places that print 64-bit values.
Diffstat (limited to 'gas')
-rw-r--r-- | gas/config/tc-arm.c | 28 | ||||
-rw-r--r-- | gas/config/tc-csky.c | 10 | ||||
-rw-r--r-- | gas/config/tc-sparc.c | 35 | ||||
-rw-r--r-- | gas/config/tc-tilegx.c | 20 | ||||
-rw-r--r-- | gas/config/tc-tilepro.c | 20 | ||||
-rw-r--r-- | gas/config/tc-z80.c | 8 | ||||
-rw-r--r-- | gas/config/te-vms.c | 2 | ||||
-rw-r--r-- | gas/config/te-vms.h | 2 |
8 files changed, 55 insertions, 70 deletions
diff --git a/gas/config/tc-arm.c b/gas/config/tc-arm.c index 1721097..2e6d175 100644 --- a/gas/config/tc-arm.c +++ b/gas/config/tc-arm.c @@ -3565,7 +3565,7 @@ add_to_lit_pool (unsigned int nbytes) imm1 = inst.operands[1].imm; imm2 = (inst.operands[1].regisimm ? inst.operands[1].reg : inst.relocs[0].exp.X_unsigned ? 0 - : ((bfd_int64_t) inst.operands[1].imm) >> 32); + : (int64_t) inst.operands[1].imm >> 32); if (target_big_endian) { imm1 = imm2; @@ -8819,15 +8819,14 @@ neon_cmode_for_move_imm (unsigned immlo, unsigned immhi, int float_p, return FAIL; } -#if defined BFD_HOST_64_BIT /* Returns TRUE if double precision value V may be cast to single precision without loss of accuracy. */ static bool -is_double_a_single (bfd_uint64_t v) +is_double_a_single (uint64_t v) { int exp = (v >> 52) & 0x7FF; - bfd_uint64_t mantissa = v & 0xFFFFFFFFFFFFFULL; + uint64_t mantissa = v & 0xFFFFFFFFFFFFFULL; return ((exp == 0 || exp == 0x7FF || (exp >= 1023 - 126 && exp <= 1023 + 127)) @@ -8838,11 +8837,11 @@ is_double_a_single (bfd_uint64_t v) (ignoring the least significant bits in exponent and mantissa). */ static int -double_to_single (bfd_uint64_t v) +double_to_single (uint64_t v) { unsigned int sign = (v >> 63) & 1; int exp = (v >> 52) & 0x7FF; - bfd_uint64_t mantissa = v & 0xFFFFFFFFFFFFFULL; + uint64_t mantissa = v & 0xFFFFFFFFFFFFFULL; if (exp == 0x7FF) exp = 0xFF; @@ -8865,7 +8864,6 @@ double_to_single (bfd_uint64_t v) mantissa >>= 29; return (sign << 31) | (exp << 23) | mantissa; } -#endif /* BFD_HOST_64_BIT */ enum lit_type { @@ -8914,11 +8912,7 @@ move_or_literal_pool (int i, enum lit_type t, bool mode_3) if (inst.relocs[0].exp.X_op == O_constant || inst.relocs[0].exp.X_op == O_big) { -#if defined BFD_HOST_64_BIT - bfd_uint64_t v; -#else - valueT v; -#endif + uint64_t v; if (inst.relocs[0].exp.X_op == O_big) { LITTLENUM_TYPE w[X_PRECISION]; @@ -8933,7 +8927,6 @@ move_or_literal_pool (int i, enum lit_type t, bool mode_3) else l = generic_bignum; -#if defined BFD_HOST_64_BIT v = l[3] & LITTLENUM_MASK; v <<= LITTLENUM_NUMBER_OF_BITS; v |= l[2] & LITTLENUM_MASK; @@ -8941,11 +8934,6 @@ move_or_literal_pool (int i, enum lit_type t, bool mode_3) v |= l[1] & LITTLENUM_MASK; v <<= LITTLENUM_NUMBER_OF_BITS; v |= l[0] & LITTLENUM_MASK; -#else - v = l[1] & LITTLENUM_MASK; - v <<= LITTLENUM_NUMBER_OF_BITS; - v |= l[0] & LITTLENUM_MASK; -#endif } else v = inst.relocs[0].exp.X_add_number; @@ -9041,7 +9029,7 @@ move_or_literal_pool (int i, enum lit_type t, bool mode_3) ? inst.operands[1].reg : inst.relocs[0].exp.X_unsigned ? 0 - : ((bfd_int64_t)((int) immlo)) >> 32; + : (int64_t) (int) immlo >> 32; int cmode = neon_cmode_for_move_imm (immlo, immhi, false, &immbits, &op, 64, NT_invtype); @@ -9090,7 +9078,6 @@ move_or_literal_pool (int i, enum lit_type t, bool mode_3) discrepancy between the output produced by an assembler built for a 32-bit-only host and the output produced from a 64-bit host, but this cannot be helped. */ -#if defined BFD_HOST_64_BIT else if (!inst.operands[1].issingle && ARM_CPU_HAS_FEATURE (cpu_variant, fpu_vfp_ext_v3)) { @@ -9103,7 +9090,6 @@ move_or_literal_pool (int i, enum lit_type t, bool mode_3) return true; } } -#endif } } diff --git a/gas/config/tc-csky.c b/gas/config/tc-csky.c index 2371eeb..5b824d8 100644 --- a/gas/config/tc-csky.c +++ b/gas/config/tc-csky.c @@ -215,7 +215,7 @@ enum unsigned int mach_flag = 0; unsigned int arch_flag = 0; unsigned int other_flag = 0; -BFD_HOST_U_64_BIT isa_flag = 0; +uint64_t isa_flag = 0; unsigned int dsp_flag = 0; typedef struct stack_size_entry @@ -245,7 +245,7 @@ struct csky_macro_info const char *name; /* How many operands : if operands == 5, all of 1,2,3,4 are ok. */ long oprnd_num; - BFD_HOST_U_64_BIT isa_flag; + uint64_t isa_flag; /* Do the work. */ void (*handle_func)(void); }; @@ -591,14 +591,14 @@ struct csky_cpu_feature { const char unique; unsigned int arch_flag; - bfd_uint64_t isa_flag; + uint64_t isa_flag; }; struct csky_cpu_version { int r; int p; - bfd_uint64_t isa_flag; + uint64_t isa_flag; }; #define CSKY_FEATURE_MAX 10 @@ -608,7 +608,7 @@ struct csky_cpu_info { const char *name; unsigned int arch_flag; - bfd_uint64_t isa_flag; + uint64_t isa_flag; struct csky_cpu_feature features[CSKY_FEATURE_MAX]; struct csky_cpu_version ver[CSKY_CPU_REVERISON_MAX]; }; diff --git a/gas/config/tc-sparc.c b/gas/config/tc-sparc.c index 222223f..4e443b1 100644 --- a/gas/config/tc-sparc.c +++ b/gas/config/tc-sparc.c @@ -75,10 +75,10 @@ static enum { MM_TSO, MM_PSO, MM_RMO } sparc_memory_model = MM_RMO; #ifndef TE_SOLARIS /* Bitmask of instruction types seen so far, used to populate the GNU attributes section with hwcap information. */ -static bfd_uint64_t hwcap_seen; +static uint64_t hwcap_seen; #endif -static bfd_uint64_t hwcap_allowed; +static uint64_t hwcap_allowed; static int architecture_requested; static int warn_on_bump; @@ -498,15 +498,15 @@ md_parse_option (int c, const char *arg) || opcode_arch > max_architecture) max_architecture = opcode_arch; - /* The allowed hardware capabilities are the implied by the - opcodes arch plus any extra capabilities defined in the GAS - arch. */ - hwcap_allowed - = (hwcap_allowed - | (((bfd_uint64_t) sparc_opcode_archs[opcode_arch].hwcaps2) << 32) - | (((bfd_uint64_t) sa->hwcap2_allowed) << 32) - | sparc_opcode_archs[opcode_arch].hwcaps - | sa->hwcap_allowed); + /* The allowed hardware capabilities are the implied by the + opcodes arch plus any extra capabilities defined in the GAS + arch. */ + hwcap_allowed + = (hwcap_allowed + | ((uint64_t) sparc_opcode_archs[opcode_arch].hwcaps2 << 32) + | ((uint64_t) sa->hwcap2_allowed << 32) + | sparc_opcode_archs[opcode_arch].hwcaps + | sa->hwcap_allowed); architecture_requested = 1; } break; @@ -1607,7 +1607,7 @@ md_assemble (char *str) } static const char * -get_hwcap_name (bfd_uint64_t mask) +get_hwcap_name (uint64_t mask) { if (mask & HWCAP_MUL32) return "mul32"; @@ -3171,8 +3171,7 @@ sparc_ip (char *str, const struct sparc_opcode **pinsn) msg_str = sasi->name; } - bfd_uint64_t hwcaps - = (((bfd_uint64_t) insn->hwcaps2) << 32) | insn->hwcaps; + uint64_t hwcaps = ((uint64_t) insn->hwcaps2 << 32) | insn->hwcaps; #ifndef TE_SOLARIS if (hwcaps) @@ -3211,10 +3210,10 @@ sparc_ip (char *str, const struct sparc_opcode **pinsn) } current_architecture = needed_architecture; hwcap_allowed - = (hwcap_allowed - | hwcaps - | (((bfd_uint64_t) sparc_opcode_archs[current_architecture].hwcaps2) << 32) - | sparc_opcode_archs[current_architecture].hwcaps); + = (hwcap_allowed + | hwcaps + | ((uint64_t) sparc_opcode_archs[current_architecture].hwcaps2 << 32) + | sparc_opcode_archs[current_architecture].hwcaps); } /* Conflict. */ /* ??? This seems to be a bit fragile. What if the next entry in diff --git a/gas/config/tc-tilegx.c b/gas/config/tc-tilegx.c index b627b70..4fcc38c 100644 --- a/gas/config/tc-tilegx.c +++ b/gas/config/tc-tilegx.c @@ -789,16 +789,16 @@ emit_tilegx_instruction (tilegx_bundle_bits bits, static void check_illegal_reg_writes (void) { - BFD_HOST_U_64_BIT all_regs_written = 0; + uint64_t all_regs_written = 0; int j; for (j = 0; j < current_bundle_index; j++) { const struct tilegx_instruction *instr = ¤t_bundle[j]; int k; - BFD_HOST_U_64_BIT regs = - ((BFD_HOST_U_64_BIT)1) << instr->opcode->implicitly_written_register; - BFD_HOST_U_64_BIT conflict; + uint64_t regs = + (uint64_t) 1 << instr->opcode->implicitly_written_register; + uint64_t conflict; for (k = 0; k < instr->opcode->num_operands; k++) { @@ -808,12 +808,12 @@ check_illegal_reg_writes (void) if (operand->is_dest_reg) { int regno = instr->operand_values[k].X_add_number; - BFD_HOST_U_64_BIT mask = ((BFD_HOST_U_64_BIT)1) << regno; + uint64_t mask = (uint64_t) 1 << regno; - if ((mask & ( (((BFD_HOST_U_64_BIT)1) << TREG_IDN1) - | (((BFD_HOST_U_64_BIT)1) << TREG_UDN1) - | (((BFD_HOST_U_64_BIT)1) << TREG_UDN2) - | (((BFD_HOST_U_64_BIT)1) << TREG_UDN3))) != 0 + if ((mask & ( ((uint64_t) 1 << TREG_IDN1) + | ((uint64_t) 1 << TREG_UDN1) + | ((uint64_t) 1 << TREG_UDN2) + | ((uint64_t) 1 << TREG_UDN3))) != 0 && !allow_suspicious_bundles) { as_bad (_("Writes to register '%s' are not allowed."), @@ -825,7 +825,7 @@ check_illegal_reg_writes (void) } /* Writing to the zero register doesn't count. */ - regs &= ~(((BFD_HOST_U_64_BIT)1) << TREG_ZERO); + regs &= ~((uint64_t) 1 << TREG_ZERO); conflict = all_regs_written & regs; if (conflict != 0 && !allow_suspicious_bundles) diff --git a/gas/config/tc-tilepro.c b/gas/config/tc-tilepro.c index af0be42..ca092d7 100644 --- a/gas/config/tc-tilepro.c +++ b/gas/config/tc-tilepro.c @@ -677,16 +677,16 @@ emit_tilepro_instruction (tilepro_bundle_bits bits, static void check_illegal_reg_writes (void) { - BFD_HOST_U_64_BIT all_regs_written = 0; + uint64_t all_regs_written = 0; int j; for (j = 0; j < current_bundle_index; j++) { const struct tilepro_instruction *instr = ¤t_bundle[j]; int k; - BFD_HOST_U_64_BIT regs = - ((BFD_HOST_U_64_BIT)1) << instr->opcode->implicitly_written_register; - BFD_HOST_U_64_BIT conflict; + uint64_t regs = + (uint64_t) 1 << instr->opcode->implicitly_written_register; + uint64_t conflict; for (k = 0; k < instr->opcode->num_operands; k++) { @@ -696,12 +696,12 @@ check_illegal_reg_writes (void) if (operand->is_dest_reg) { int regno = instr->operand_values[k].X_add_number; - BFD_HOST_U_64_BIT mask = ((BFD_HOST_U_64_BIT)1) << regno; + uint64_t mask = (uint64_t) 1 << regno; - if ((mask & ( (((BFD_HOST_U_64_BIT)1) << TREG_IDN1) - | (((BFD_HOST_U_64_BIT)1) << TREG_UDN1) - | (((BFD_HOST_U_64_BIT)1) << TREG_UDN2) - | (((BFD_HOST_U_64_BIT)1) << TREG_UDN3))) != 0 + if ((mask & ( ((uint64_t) 1 << TREG_IDN1) + | ((uint64_t) 1 << TREG_UDN1) + | ((uint64_t) 1 << TREG_UDN2) + | ((uint64_t) 1 << TREG_UDN3))) != 0 && !allow_suspicious_bundles) { as_bad (_("Writes to register '%s' are not allowed."), @@ -713,7 +713,7 @@ check_illegal_reg_writes (void) } /* Writing to the zero register doesn't count. */ - regs &= ~(((BFD_HOST_U_64_BIT)1) << TREG_ZERO); + regs &= ~((uint64_t) 1 << TREG_ZERO); conflict = all_regs_written & regs; if (conflict != 0 && !allow_suspicious_bundles) diff --git a/gas/config/tc-z80.c b/gas/config/tc-z80.c index 81fbfe3..714e704 100644 --- a/gas/config/tc-z80.c +++ b/gas/config/tc-z80.c @@ -3910,11 +3910,11 @@ z80_tc_label_is_local (const char *name) #define EXP_MIN -0x10000 #define EXP_MAX 0x10000 static int -str_to_broken_float (bool *signP, bfd_uint64_t *mantissaP, int *expP) +str_to_broken_float (bool *signP, uint64_t *mantissaP, int *expP) { char *p; bool sign; - bfd_uint64_t mantissa = 0; + uint64_t mantissa = 0; int exponent = 0; int i; @@ -4029,7 +4029,7 @@ str_to_broken_float (bool *signP, bfd_uint64_t *mantissaP, int *expP) static const char * str_to_zeda32(char *litP, int *sizeP) { - bfd_uint64_t mantissa; + uint64_t mantissa; bool sign; int exponent; unsigned i; @@ -4088,7 +4088,7 @@ str_to_zeda32(char *litP, int *sizeP) static const char * str_to_float48(char *litP, int *sizeP) { - bfd_uint64_t mantissa; + uint64_t mantissa; bool sign; int exponent; unsigned i; diff --git a/gas/config/te-vms.c b/gas/config/te-vms.c index 015c958..6661a3b 100644 --- a/gas/config/te-vms.c +++ b/gas/config/te-vms.c @@ -339,7 +339,7 @@ vms_file_stats_name (const char *dirname, return 0; } -bfd_uint64_t +uint64_t vms_dwarf2_file_time_name (const char *filename, const char *dirname) { long long cdt; diff --git a/gas/config/te-vms.h b/gas/config/te-vms.h index ffe7f5e..08f2185 100644 --- a/gas/config/te-vms.h +++ b/gas/config/te-vms.h @@ -20,7 +20,7 @@ #define TE_VMS #include "obj-format.h" -extern bfd_uint64_t vms_dwarf2_file_time_name (const char *, const char *); +extern uint64_t vms_dwarf2_file_time_name (const char *, const char *); extern long vms_dwarf2_file_size_name (const char *, const char *); extern char *vms_dwarf2_file_name (const char *, const char *); |