This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Forcing memory mode to some addresses


1- Do you mean pointer to a volatile struct? I've defined a const
pointer to a volatile bitfield struct
volatile hardware_t * const MY_HARDWARE = (hardware_t *)0Xxxxx


2- What is the appropriate access for a 1bit field of the hardware_t structure ?
For example if I define :
typedef struct {
  unsigned s0:1;
  unsigned s1:1;
  unsigned s2:1;
  ...
} hardware_t;

with MY_HARDWARE->s0, gcc can generate QI or HI access, depending on cases...

Aurelien

2011/11/16 Ian Lance Taylor <iant@google.com>:
> Aurelien Buhrig <aurelien.buhrig.gcc@gmail.com> writes:
>
>> I would like to force accesses to some memory variables in a specific mode.
>> For example, I would like GCC to access a 16-bit wide hardware
>> register always in HImode when using a 16bit wide bitfield struct...
>> Currently, GCC can accesses part of this memory structure using
>> QImode, which is not always permitted.
>> Is there a way to do it using an attribute ? Or perhaps another way ?
>>
>> If a target specific attribute must be defined, what should it
>> control, and how to recognized it in my backend ?
>
> You should always use a volatile qualified pointer when accessing a
> hardware register. ?When you do that, gcc should always use the
> appropriate mode.
>
> Ian
>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]