[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

AW: [avr-gcc-list] Efficient I/O handling w. bitfields codegenproblem

From: Haase Bjoern (PT-BEU/MKP5) *
Subject: AW: [avr-gcc-list] Efficient I/O handling w. bitfields codegenproblem
Date: Fri, 3 Dec 2004 14:12:45 +0100

The reason probably is, that gcc allways tries to access structs by using 
pointers even when dealing
with structs that are global variables and could eventually be accessed 
The optimiziation patterns that replace the usual store instructions like "sts" 
or "st" by the
more efficient "out" instructions work only for variables accessed by direct 



-----Ursprüngliche Nachricht-----
Von: address@hidden
[mailto:address@hidden Auftrag von Ned Konz
Gesendet: Freitag, 3. Dezember 2004 01:08
An: address@hidden
Betreff: Re: [avr-gcc-list] Efficient I/O handling w. bitfields

On Thursday 02 December 2004 3:00 pm, E. Weddington wrote:
> The canonical way to change bits in ports in C language is not through
> the use of bitfields. You need to learn to use the C language's bitwise
> operators, in conjunction with a simple macro include in avr-libc:
> #include <avr/io.h>
> PORTA |= _BV(1);   // Set bit 1
> PORTA &= ~_BV(1);    // Clear bit 1

Actually, GCC does a nice job (when the optimizer is on) of using bitfields. 

It just looks like it's producing inefficient code to access const fields in 
const structs.

Ned Konz

avr-gcc-list mailing list

reply via email to

[Prev in Thread] Current Thread [Next in Thread]