|Summary: Optimizing operations of the Sun SPARC assembler email@example.com (1991-11-03)|
|From:||firstname.lastname@example.org (Tommy Thorn)|
|Keywords:||assembler, SPARC, optimize, summary|
|Organization:||DAIMI: Computer Science Department, Aarhus University, Denmark|
|Date:||Sun, 3 Nov 91 22:59:36 GMT|
Thanx to all that replied.
Perhaps I should have stated my assumption, that the assembler was run
with the -O flag, as I got five replies stating that the assembler didn't
perform any kind of optimizations at all.
Well, at least at our sparc-stations running SunOS 4.1.1, it's fairly easy
to verify that the assembler does indeed perform some kind of
optimizations. See my example at the end.
As email@example.com (Thomas Colthurst) writes:
The description I have of the SUN compiling system states that the
postpass optimizer is integrated into the assembler, and presumably
activated by the -O[n] option. Specifically, the postpass assembler
"does a series of quite standard machine-dependent optimizations,
eliminating jumps to jumps, deleting redundant loads, stores and
unreachable code, inverting loops and so on, as indicated in Section 21.4.
In additon, the postpass optimizer does instruction scheduling and leaf
The instruction scheduling not only fills delay-slots, but also arranges
integer and floating-point instructions so they can execute in parallel.
My description (taken from the upcoming _Optimization in Compilers_ ACM
book in a chapter written by Steven S. Muchnick) claims that this can
reduce execution time by 8 to 20%.
Of course, the as man page warns that optimization can be used safely only
when assembling code produced by a Sun compiler.
David Lively <dfl@Think.COM> says:
I asked the Sun compiler folks a while back (July '90) about using the
optimizer on their assembler, and they replied that the assembler
optimizer was only intended to be used on assembly code produced by their
compilers, not on user (or other compiler) code. We tried it anyway on
the serial portion of the code produced by one of our compilers, and found
that while it worked well in most cases, it didn't work for nearly all of
the cases since we were presumably violating some assumptions they make.
So it seems you have to do it yourself :-<
As promised, here comes an example:
extern char b;
for (i = 0; i < 10; i++)
/* generated by the compiler, that is:cpp,ccom,iropt,cg
(condensed a lot, but haven't touched instructions)
LF13 = -64
/* sending this though as -O2 -S generates
.seg "text" ! [internal]
LY1: ! [internal]
nop ! [internal]
.seg "data" ! [internal]
Tommy Thorn email: firstname.lastname@example.org
Computer Science Department
Return to the
Search the comp.compilers archives again.