This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [Patch]Extend GAS arm_feature_set struct to provide more available bits
- From: Terry Guo <flameroc at gmail dot com>
- To: pinskia at gmail dot com
- Cc: Nicholas Clifton <nickc at redhat dot com>, Alan Modra <amodra at gmail dot com>, "binutils at sourceware dot org" <binutils at sourceware dot org>, Richard Earnshaw <Richard dot Earnshaw at arm dot com>, Ramana Radhakrishnan <ramana dot radhakrishnan at arm dot com>
- Date: Tue, 24 Mar 2015 17:10:32 +0800
- Subject: Re: [Patch]Extend GAS arm_feature_set struct to provide more available bits
- Authentication-results: sourceware.org; auth=none
- References: <007001d0572b$922edf60$b68c9e20$ at arm dot com> <54FECF9B dot 9010602 at redhat dot com> <CAGbRaL6Ypk7U1Tr8RW2atLjA6A+7N2+sEz6j-M7b4BME_4asjw at mail dot gmail dot com> <20150316074237 dot GC12856 at bubble dot grove dot modra dot org> <CAGbRaL6HiBoESpiwXAmQ3WVSKgKfii=QPRzr9k5YqDtVjAMt-w at mail dot gmail dot com> <20150316114857 dot GE12856 at bubble dot grove dot modra dot org> <CAGbRaL6SPjtQbcf=aB3MDyojN8dGo7U2AXE8p6ady=JZHnH5XA at mail dot gmail dot com> <DDAB9EBD-7138-493D-80E9-ED3D73541619 at gmail dot com>
>>
>> Hi Alan and Nick, I noticed that GDB now can be built with g++
>> https://sourceware.org/ml/gdb-patches/2015-03/msg00194.html. Is there
>> any plan to build whole binutils with g++? If so, I am thinking that
>> maybe I can use c++ bitset to handle those arm feature stuff which
>> should be more flexible and clean.
>
> Also c++ bitset is very inefficient for a few bits. If anything sbitmap or bitmap that is part of gcc is much better are more efficient. One of them (can't remember which one off hand) is a fixed size bitmask.
>
> Thanks,
> Andrew
It should be sbitmap, the simple bitmap. I noticed this one and once
thought to put it into libiberty to share between gcc and binutils. Is
it worth doing so?
There is another big change to existing code if we use sbitmap. In
current code, we define a lot of file-scope variables like below:
static const arm_feature_set fpu_default = FPU_DEFAULT;
static const arm_feature_set fpu_arch_vfp_v1 = FPU_ARCH_VFP_V1;
static const arm_feature_set fpu_arch_vfp_v2 = FPU_ARCH_VFP_V2;
static const arm_feature_set fpu_arch_vfp_v3 = FPU_ARCH_VFP_V3;
And more complicated case like below:
struct opcode32
{
arm_feature_set arch; /* Architecture defining this insn. */
unsigned long value; /* If arch is 0 then value is a sentinel. */
unsigned long mask; /* Recognise insn if (op & mask) == value. */
const char * assembler; /* How to disassemble this insn. */
};
static const struct opcode32 coprocessor_opcodes[] =
{
/* XScale instructions. */
{ARM_FEATURE_COPROC (ARM_CEXT_XSCALE),
0x0e200010, 0x0fff0ff0,
"mia%c\tacc0, %0-3r, %12-15r"},
{ARM_FEATURE_COPROC (ARM_CEXT_XSCALE),
0x0e280010, 0x0fff0ff0,
"miaph%c\tacc0, %0-3r, %12-15r"},
.....
};
If use sbitmap, we can't initialize them like this, we need to put
them into a function.
BR,
Terry