Re: Compiler Optimizing assembler (David Keppel)
3 Nov 1996 13:08:46 -0500

          From comp.compilers

Related articles
Compiler Optimizing assembler (Werner Strydom) (1996-11-03)
Re: Compiler Optimizing assembler (1996-11-03)
Re: Compiler Optimizing assembler (1996-11-03)
Re: Compiler Optimizing assembler (David L Moore) (1996-11-03)
Re: Compiler Optimizing assembler (1996-11-05)
Re: Compiler Optimizing assembler (1996-11-05)
Re: Compiler Optimizing assembler (K. Sridharan) (1996-11-07)
Re: Compiler Optimizing assembler (Walter Banks) (1996-11-07)
Re: Compiler Optimizing assembler (1996-11-10)
| List of all articles for this month |

From: (David Keppel)
Newsgroups: comp.compilers
Date: 3 Nov 1996 13:08:46 -0500
Organization: Computer Science & Engineering, U of Washington, Seattle
References: 96-11-029
Keywords: tools, optimize, assembler

Werner Strydom <> wrote:
>[Optimizing assembly code?]

A classic paper is

%A Christopher W. Fraser
%A Eugene W. Myers
%A Alan L. Wendt
%T Analyzing and Compressing Assembly Code
%J Proceedings of the ACM SIGPLAN 1984 Symposium on Compiler Construction
%J SIGPLAN Notices
%V 19
%N 6
%D June 1984
%P 117-121

I know that Henry Massalin wrote a machine-code peephole optimizer for
the 68000 family for Synthesis in order to "fix up" things that
spanned code generation units. I don't believe there are any
published descriptions of the peephole optimizer itself, but he
reported to me (as I recall) that it took about 20 instructions to
consider a 3-instruction window, more to rewrite it.

Lots of modern assemblers have built-in optimizers. I believe that
some of them perform *simple* code motion/duplication across branches
(delay slot optimizations).

There is a body of work on decompilers, which take ASM and convert it
to abstract representation; in principle you can perform both
retrageting and optimization. I doubt any of them perform more
sophisticated loop transformations.

There is always the issue of whether any of your asm has "tricks" in
it that could break the optimizer strategy. For example a "table of
code" with a computed branch into the middle of the table.

Assembly *is* "just another programming language", so, in principle,
all of the standard optimizations should apply. For example, some
optimizing compilers convert loops to goto nests in the front end and
then transform them back to loops in the back end; you could
presumably just skip the front-end transformation.

;-D on ( Pessimizing humans ) Pardo

Post a followup to this message

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