Re: bitfields: types vs modes?

2009-07-16 Thread DJ Delorie
At the risk of being naive: implement it. I'm not quite sure what you're looking for here? Ok, time to ask for a hint. I started at get_best_mode(), adding a TREE argument for the type, and worked my way out, adding arguments to functions as needed to propogate the type information. It's

Re: bitfields: types vs modes?

2009-07-14 Thread DJ Delorie
I think the ARM specification is pretty sensible, and would make a good cross-platform approach. Could you distill it for us? The relevant bits are from AAPCS \S 7.1.7.5, and quoted below. I finally got the last of the feedback I needed from our customers, and they agree that the

Re: bitfields: types vs modes?

2009-07-14 Thread Mark Mitchell
DJ Delorie wrote: I think the ARM specification is pretty sensible, and would make a good cross-platform approach. I finally got the last of the feedback I needed from our customers, and they agree that the AAPCS functionality is suitable for their ports as well. Great! What's the next

Re: bitfields: types vs modes?

2009-07-14 Thread DJ Delorie
At the risk of being naive: implement it. I'm not quite sure what you're looking for here? I'd rather have some confidence that the way I choose to implement it would be acceptable to those who would be reviewing it ;-) I'll give it a shot at the same point in the code where we call the

Re: bitfields: types vs modes?

2009-05-21 Thread Mark Mitchell
DJ Delorie wrote: I think the ARM specification is pretty sensible, and would make a good cross-platform approach. Could you distill it for us? The relevant bits are from AAPCS \S 7.1.7.5, and quoted below. The term container here means the declared type of the bit-field. (There's a

Re: bitfields: types vs modes?

2009-05-20 Thread DJ Delorie
We seem to have dropped this discussion. I now have *two* customers asking for this functionality. Can we pick it up again? We need to decide: 1. If the functionality will be allowed in gcc at all 2. What info the target needs to be provided to make the choices it wants 3. What, if any,

Re: bitfields: types vs modes?

2009-05-20 Thread Mark Mitchell
Ian Lance Taylor wrote: 1. If the functionality will be allowed in gcc at all 2. What info the target needs to be provided to make the choices it wants 3. What, if any, common code can be shared between the CPUs Since the ARM ABI apparently specifies something about volatile bitfields, I

Re: bitfields: types vs modes?

2009-05-20 Thread DJ Delorie
I think the ARM specification is pretty sensible, and would make a good cross-platform approach. Could you distill it for us? If it's acceptable to my two customers, it would be a good starting point to define an API for the targets.

Re: bitfields: types vs modes?

2009-04-06 Thread Mark Mitchell
Ian Lance Taylor wrote: So... can I/we move forward on this? Or will such a change be rejected? It's hard for me to get excited about something like this. It's straightforward a programmer to write code that is clearly correct in this sort of situation: just don't use a bitfield. In

Re: bitfields: types vs modes?

2009-04-06 Thread DJ Delorie
http://infocenter.arm.com/help/topic/com.arm.doc.ihi0042c/IHI0042C_aapcs.pdf and, in particular, \S 7.1.7.5, entitled Volatile bit-fields. A first question is if these are the semantics that you're looking for in your project. If so, then we could collaborate with you on implementing

Re: bitfields: types vs modes?

2009-04-06 Thread Mark Mitchell
DJ Delorie wrote: Yes, that's pretty much what they asked for. However, it is still somewhat ambiguous - for example, if you have an 8-bit int field, which 4 bytes are read to get that field? I haven't gone back just now to try to find the right words in the ABI, so I don't know for sure

Re: bitfields: types vs modes?

2009-03-31 Thread DJ Delorie
So... can I/we move forward on this? Or will such a change be rejected? BTW, Since sending this I discovered that gcc treats these differently wrt TARGET_NARROW_VOLATILE_BITFIELD: volatile struct { unsigned int a:8; unsigned int b:24; } t1; volatile struct { unsigned int a:7; unsigned

Re: bitfields: types vs modes?

2009-03-31 Thread Ian Lance Taylor
DJ Delorie d...@redhat.com writes: So... can I/we move forward on this? Or will such a change be rejected? BTW, Since sending this I discovered that gcc treats these differently wrt TARGET_NARROW_VOLATILE_BITFIELD: volatile struct { unsigned int a:8; unsigned int b:24; } t1;

Re: bitfields: types vs modes?

2009-03-11 Thread Paul Brook
On Tuesday 10 March 2009, DJ Delorie wrote: One of our customers has a chip with memory-mapped peripheral registers that need to be accessed in a specific mode. The registers represent bitfields within the hardware, so a volatile struct is an obvious choice to represent them in C. Comments?

Re: bitfields: types vs modes?

2009-03-11 Thread Laurent GUERBY
On Wed, 2009-03-11 at 01:05 -0400, DJ Delorie wrote: Can you provide example code? I'm confused enough to believe that you *should* get this effect with PCC_BITFIELD_TYPE_MATTERS (modulo current bugs). Imagine a device with four 8-bit registers followed by a 32-bit register with an

Re: bitfields: types vs modes?

2009-03-11 Thread Hans-Peter Nilsson
On Wed, 11 Mar 2009, Paul Brook wrote: PR23623 (I suspect the status on that bug is incorrect, it's nt actually fixed). The ARM EABI defines semantics for volatile bitfields, and gcc gets this wrong. If the ARM EABI really documents the semantics for that, implement-c.texi:Qualifiers does need

Re: bitfields: types vs modes?

2009-03-10 Thread Hans-Peter Nilsson
On Tue, 10 Mar 2009, DJ Delorie wrote: One of our customers has a chip with memory-mapped peripheral registers that need to be accessed in a specific mode. The registers represent bitfields within the hardware, so a volatile struct is an obvious choice to represent them in C. Thank you for

Re: bitfields: types vs modes?

2009-03-10 Thread DJ Delorie
Can you provide example code? I'm confused enough to believe that you *should* get this effect with PCC_BITFIELD_TYPE_MATTERS (modulo current bugs). Imagine a device with four 8-bit registers followed by a 32-bit register with an 8-bit field: bytestatus (read-only, clears after reading)

bitfields: types vs modes?

2009-03-09 Thread DJ Delorie
One of our customers has a chip with memory-mapped peripheral registers that need to be accessed in a specific mode. The registers represent bitfields within the hardware, so a volatile struct is an obvious choice to represent them in C. However, gcc has a very simplistic heuristic for deciding