Re: Which part of optimization is most important in a compiler?
- From: Brooks Moses <bmoses-nospam@xxxxxxxxxxxxx>
- Date: Tue, 25 Mar 2008 14:46:17 -0700
joggingsong@xxxxxxxxx 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.
.
- References:
- Which part of optimization is most important in a compiler?
- From: joggingsong
- Which part of optimization is most important in a compiler?
- Prev by Date: Re: Which part of optimization is most important in a compiler?
- Next by Date: Re: Generate text, given a regex
- Previous by thread: Re: Which part of optimization is most important in a compiler?
- Next by thread: Generate text, given a regex
- Index(es):
Relevant Pages
|
|