Choice of optimisations (was Re: how to generate code for (a,b):=(b,a))

peach@storm.ca (Peach Microsystems)
16 May 1997 23:44:01 -0400

          From comp.compilers

Related articles
how to generate code for (a,b):=(b,a) anton@mips.complang.tuwien.ac.at (1997-05-05)
Re: how to generate code for (a,b):=(b,a) dlmoore@ix.netcom.com (David L Moore) (1997-05-08)
Choice of optimisations (was Re: how to generate code for (a,b):=(b,a) peach@storm.ca (1997-05-16)
| List of all articles for this month |

From: peach@storm.ca (Peach Microsystems)
Newsgroups: comp.compilers
Date: 16 May 1997 23:44:01 -0400
Organization: Peach Microsystems
References: 97-05-058 97-05-129
Keywords: optimize, code

David L Moore <dlmoore@ix.netcom.com> wrote:


:When you don't have any free registers, it should be possible to achieve
:the same result with a series of xors instead of moves. For example, two
:registers can be exchanged with the sequence:
: xor a,b
: xor b,a
: xor a,b
:


Are there (should there be?) compilers that let the programmer
give more than one version of something & let the compiler pick?


e.g you give code above & a version using a temporary variable.
Programmer knows two blocks are equivalent. Compiler chooses
whichever it can optimise better.


Methinks this would give some lovely headaches in debugging,
but would it also mean faster code?
--


Post a followup to this message

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