Re: Optimizing in assembly language

"Eric Boon" <Eric.Boon@ICT.nl>
22 Mar 2001 01:21:59 -0500

          From comp.compilers

Related articles
[8 earlier articles]
Re: Optimizing in assembly language rhyde@transdimension.com (Randall Hyde) (2001-03-10)
Re: Optimizing in assembly language me@nospam.net (Scottie) (2001-03-10)
Re: Optimizing in assembly language thp@hill.cs.ucr.edu (Tom Payne) (2001-03-12)
Re: Optimizing in assembly language rhyde@transdimension.com (Randall Hyde) (2001-03-14)
Re: Optimizing in assembly language bonzini@gnu.org (2001-03-22)
Re: Optimizing in assembly language thp@hill.cs.ucr.edu (Tom Payne) (2001-03-22)
Re: Optimizing in assembly language Eric.Boon@ICT.nl (Eric Boon) (2001-03-22)
Re: Optimizing in assembly language uabbwat@uab.ericsson.se (Barry Watson) (2001-03-26)
Re: Optimizing in assembly language Martin.Ward@durham.ac.uk (2001-03-26)
Re: Optimizing in assembly language joachim_d@gmx.de (Joachim Durchholz) (2001-03-26)
Re: Optimizing in assembly language sunni@speakeasy.net (Shankar Unni) (2001-03-26)
Re: Optimizing in assembly language rhyde@transdimension.com (Randall Hyde) (2001-03-27)
| List of all articles for this month |
From: "Eric Boon" <Eric.Boon@ICT.nl>
Newsgroups: comp.compilers
Date: 22 Mar 2001 01:21:59 -0500
Organization: ICT Automatisering NV, NL
References: 01-03-006 01-03-080
Keywords: assembler, optimize, architecture
Posted-Date: 22 Mar 2001 01:21:59 EST

Scottie wrote:


>IIRC DEC/Mips used at least a bit of this approach. There were some
>problems, the most obvious of which were related to use of memory as
>semaphores. Code motion to improve memory bandwith removed full
>protection of critical sections.
> ...
> while (lock != 0)
> ...
> ;
> lock = 1
> ...update data with mutiple instruction...
> lock = 0
> ...
>Dead store elimination, if implemented, can remove locks on
>resources above entirely, leaving code like:
> ...
> while (lock != 0)
> ...
> ;
> ...update data with multiple instruction...
> lock = 0
> ...
>or even (on discovering the protect loop always exits with lock==0):
> ...
> while (lock != 0)
> ...
> ;
> update data with more than one indivisible instruction
> ...


That problem can be overcome easily by qualifying 'lock' as a
'volatile' variable, a variable of which the value can be changed
externally. That's very useful for e.g. memory mapped I/O,
semaphores:-), etc. Anything a program does to a volatile variable
should be left untouched by an optimizer.


        Eric


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.