]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit - gdb/ChangeLog
gnulib: import count-one-bits module and use it
authorSimon Marchi <simon.marchi@efficios.com>
Fri, 14 Feb 2020 19:41:07 +0000 (14:41 -0500)
committerSimon Marchi <simon.marchi@efficios.com>
Fri, 14 Feb 2020 19:41:07 +0000 (14:41 -0500)
commit5f661e03972e3412778c0bee8d20522b9bffea76
tree287495c0d6f9659408ec5becf385f73387e5cf42
parent8084e579e114e607cb65482c43566e2c5c844bf6
gnulib: import count-one-bits module and use it

For a fix I intend to submit, I would need a function that counts the
number of set bits in a word.  There is  __builtin_popcount that is
supported by gcc and clang, but there is also a gnulib module that wraps
that and provides a fallback for other compilers, so I think it would be
good to use it.

I also noticed that there is a bitcount function in arch/arm.c, so I
thought that as a first step I would replace that one with the gnulib
count-one-bits module.  This is what this patch does.

The gnulib module provides multiple functions, with various parameter
length (unsigned int, unsigned long int, unsigned long long int), I
chose the one that made sense for each call site based on the argument
type.

gnulib/ChangeLog:

* update-gnulib.sh (IMPORTED_GNULIB_MODULES): Import
count-one-bits module.
* configure: Re-generate.
* aclocal.m4: Re-generate.
* Makefile.in: Re-generate.
* import/count-one-bits.c: New file.
* import/count-one-bits.h: New file.
* import/Makefile.am: Re-generate.
* import/Makefile.in: Re-generate.
* import/m4/gnulib-cache.m4: Re-generate.
* import/m4/gnulib-comp.m4: Re-generate.
* import/m4/count-one-bits.m4: New file.

gdb/ChangeLog:

* arm-tdep.c: Include count-one-bits.h.
(cleanup_block_store_pc): Use count_one_bits.
(cleanup_block_load_pc): Use count_one_bits.
(arm_copy_block_xfer): Use count_one_bits.
(thumb2_copy_block_xfer): Use count_one_bits.
(thumb_copy_pop_pc_16bit): Use count_one_bits.
* arch/arm-get-next-pcs.c: Include count-one-bits.h.
(thumb_get_next_pcs_raw): Use count_one_bits.
(arm_get_next_pcs_raw): Use count_one_bits_l.
* arch/arm.c (bitcount): Remove.
* arch/arm.h (bitcount): Remove.
17 files changed:
gdb/ChangeLog
gdb/arch/arm-get-next-pcs.c
gdb/arch/arm.c
gdb/arch/arm.h
gdb/arm-tdep.c
gnulib/ChangeLog
gnulib/Makefile.in
gnulib/aclocal.m4
gnulib/configure
gnulib/import/Makefile.am
gnulib/import/Makefile.in
gnulib/import/count-one-bits.c [new file with mode: 0644]
gnulib/import/count-one-bits.h [new file with mode: 0644]
gnulib/import/m4/count-one-bits.m4 [new file with mode: 0644]
gnulib/import/m4/gnulib-cache.m4
gnulib/import/m4/gnulib-comp.m4
gnulib/update-gnulib.sh