avr-gcc-list
[Top][All Lists]
Advanced

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

Re: [avr-gcc-list] More on optimization (fwd)


From: Marcus Overhagen
Subject: Re: [avr-gcc-list] More on optimization (fwd)
Date: Fri, 11 Oct 2002 01:45:58 CEST (+0200)

------ Forwarded Message: ------
To: "Tvrtko A. Ursulin" <address@hidden>
From: "Marcus Overhagen" <address@hidden>
Subject: Re: [avr-gcc-list] More on optimization
Date: Thu, 10 Oct 2002 21:41:32 CEST (+0200)

> Declaring variables volatile really makes the compiler store them after 
> changing. But I am looking for something more than that and I hope doing 
That's what is needed, yes.


> For my usage, I would like something like this:
> 
> cli
> lds r24, 0x0060
Why don't you tell the compiler to do it?

for (;;) {
        register uint_8 temp;
        cli();
        temp = gvar;
        temp++;
        temp = foobar(temp);
        temp--;
        gvar = temp;
        sei();
}

should to what you want

> HEY-MISTER-COMPILER -> although var. at 0x0060 is volatile leave it be until 
> not explicitly said otherwise
Impossible (Well, you could use a pointer, and cast it into a nonvolatile 
pointer, 
but this would most likely result in even more instructions)

> some operations with/on r24...
> 
> HEY-MISTER-COMPILER -> i am done with this var, procees
> 
> sts 0x0060, r24
> sei
> etc...
Try my suggestion.

> In a way, this would signal the compiler that the entire block surrounded 
> with 
> HEY-MISTER-COMPILER is atomic eg. no interrupts. So no need to lds/sts more 
> than once.

> Am I doing something terribly wrong or it can be done? :)
It is not possible, as far as I know. Why don't you use a temporary variable 
when 
you know what you are doing?

Marcus



avr-gcc-list at http://avr1.org



reply via email to

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