Re: [coldfire-gnu-discuss] Control deferred writes?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [coldfire-gnu-discuss] Control deferred writes?



David Brown wrote:

[...]

> control the ordering of the writes, the only issue is to control the 
> compiler-generated write instructions.
> 
> There are three tools for doing that.  One is to write at least some 
> parts of your code in assembly, as suggested.

I already squeeze out every cycle by using assembly code where 
necessary, but I prefer the compiler to yield good results.

> Use of "volatile" is important.  All "volatile" writes will be generated 
> in the order expected by the program, and you will get no more nor less 
> than you ask for.  But note that non-volatile reads and writes can be 

The "problem" is the concentration of deferred writes to volatile 
objects (e.g. at sequence points).

Volatile writes shall not be optimized out or reordered, so if there 
is a write to a volatile, why defer it at all?

[...]

> Use volatile accesses, and memory blocks if needed, to enforce the write 
> ordering that you require.  Then let the compiler handle the rest as 
> best it can.

Maybe gcc could do better.

Oliver
-- 
Oliver Betz, Muenchen