This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: GCC 3.3 compile speed regression - AN ANSWER
- From: <tm_gccmail at mail dot kloo dot net>
- To: Linus Torvalds <torvalds at transmeta dot com>
- Cc: Matt Austern <austern at apple dot com>, jsm28 at cam dot ac dot uk,gcc at gcc dot gnu dot org
- Date: Wed, 12 Feb 2003 00:36:40 -0800 (PST)
- Subject: Re: GCC 3.3 compile speed regression - AN ANSWER
On Tue, 11 Feb 2003, Linus Torvalds wrote:
>
> But it still boils down to the same thing: you don't want to go over the
> data structures and convert them in between phases. You generate a ton of
> data the first time through, you'd rather not touch it later (much less
> convert it) unless you really need to.
>
> Linus
By programming in C, you are requiring a compilation pass. Pedantically,
if you really want to minimize the number of transformations performed on
your code, you could program in assembly language.
So, why don't you program in assembly? It's because C is a more convenient
representation for expressing program functionality. It is a clean way of
representing the logical steps to perform a specific task without
being concerned about processor details such as a the number of registers,
the types of addressing modes available, the calling convention, etc.
Likewise, within a compiler, the code is converted into different formats
at different times because it's easier to perform various types of
analysis and program transformations on certain representations of data.
The tree format is great for optimizing code at an expression level, and
removing redundant instances of computation within a single
expression. It's also very good for inlining functions and other things.
The tree format, however, is lousy for doing instruction scheduling,
because it's difficult to represent which computations must be
performed in what sequence across multiple expressions.
On the other hand, RTL is very awkward for common subexpression removal
because it's difficult to recognized repeated patterns of computation. It
is very good for instruction scheduling because each RTL expression
corresponds directly to a machine instruction, and therefore it's only
necessary to reorder the list of RTL expressions.
What is the best programming language today? There is no best programming
language today. If you are doing systems programming and OSes, then C is a
good choice. If you are processing textfiles, then AWK may be better. For
numerical processing, maybe FORTRAN. You choose the most appropriate
representation of expressing program functionality given a certain
task.
Likewise, certain data formats are better for performing certain
optimizing tasks within a compiler; therefore the program representation
is converted to different formats within a compiler.
Toshi