Re: Which part of optimization is most important in a compiler?

Brooks Moses <bmoses-nospam@mail.dpdx.net>
Tue, 25 Mar 2008 14:46:17 -0700

          From comp.compilers

Related articles
Which part of optimization is most important in a compiler? joggingsong@gmail.com (2008-03-23)
Re: Which part of optimization is most important in a compiler? torbenm@app-2.diku.dk (2008-03-25)
Re: Which part of optimization is most important in a compiler? bmoses-nospam@mail.dpdx.net (Brooks Moses) (2008-03-25)
Re: Which part of optimization is most important in a compiler? kevin.phillips83@yahoo.com (kphillips) (2008-03-27)
Re: Which part of optimization is most important in a compiler? pertti.kellomaki@tut.fi (=?ISO-8859-1?Q?Pertti_Kellom=E4ki?=) (2008-03-28)
Re: Which part of optimization is most important in a compiler? n.pipenbrinck@cubic.org (Nils) (2008-03-30)
Re: Which part of optimization is most important in a compiler? joggingsong@gmail.com (2008-04-02)
| List of all articles for this month |

From: Brooks Moses <bmoses-nospam@mail.dpdx.net>
Newsgroups: comp.compilers
Date: Tue, 25 Mar 2008 14:46:17 -0700
Organization: Compilers Central
References: 08-03-094
Keywords: optimize
Posted-Date: 26 Mar 2008 23:09:16 EDT

joggingsong@gmail.com wrote:
> I haven't taken the compiler course at college. Because my job is
> to optimize code on DSP, I hope to understand compiler deep and begin
> to read a compiler textbook. There are a lot of materials in a book,
> but the overview of advanced compiling is not given in the book.
>
> Maybe every part is important for a optimized compiler. I hope to know
> which part of a compiler is most important in a compiler. Instruction
> scheduling, or register allocation?


"Most important" is an impossible question to answer -- it depends on
which one is being done badly. If the instruction scheduling is done
badly, the compiled program will spend all its time with stalled
pipelines and run slowly, and the best register allocation in the world
won't fix it. If the register allocation is done badly, the compiled
program will spend all its time in memory fetches and stores and run
slowly, and the best instruction scheduling in the world won't fix it.


It also depends heavily on the processor architecture and the program.
On a Cell SPE, instruction ordering can make an order-of-magnitude
difference in execution time, but with 128 registers, allocating the
registers in an optimum way is often not especially critical. On a
processor that does instruction-reordering in hardware but has a
half-dozen registers, however, the register allocation is critical and
the instruction ordering much less so. I don't know where your DSP
would fit in this spectrum.


With that said, a program with poor instruction scheduling will still
run, whereas the registers have to be allocated _somehow_ in order to
get a running program, so you might as well learn about register
allocation first.


Also, if you have any experience with writing assembly-code programs for
your DSP, that should give you some insight into what's most important
to get things to run fast on your processor. (If you don't have
experience with that, it's probably useful to get some -- it's hard to
write a program to produce something that you don't know how to produce
yourself!)


- Brooks




--
The "bmoses-nospam" address is valid; no unmunging needed.


Post a followup to this message

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