Re: C code .vs. Assembly code for Microcontrollers/DSPs ?

fink@post.tau.ac.il (Udi Finkelstein)
5 Mar 1996 12:24:31 -0500

          From comp.compilers

Related articles
C code .vs. Assembly code for Microcontrollers/DSPs ? ravindra@hal.com (1996-03-01)
Re: C code .vs. Assembly code for Microcontrollers/DSPs ? dstarr@pop-3.std.com (David J. Starr) (1996-03-03)
Re: C code .vs. Assembly code for Microcontrollers/DSPs ? mwilliam@duncan.cs.utk.edu (1996-03-03)
Re: C code .vs. Assembly code for Microcontrollers/DSPs ? eyal@dsp.co.il (Eyal Ben-Avraham) (1996-03-03)
Re: C code .vs. Assembly code for Microcontrollers/DSPs ? jens.hansson@mailbox.swipnet.se (1996-03-03)
Re: C code .vs. Assembly code for Microcontrollers/DSPs ? torbenm@diku.dk (1996-03-04)
Re: C code .vs. Assembly code for Microcontrollers/DSPs ? andrew@memex.co.uk (Andrew Cruickshank) (1996-03-04)
Re: C code .vs. Assembly code for Microcontrollers/DSPs ? fink@post.tau.ac.il (1996-03-05)
Re: C code .vs. Assembly code for Microcontrollers/DSPs ? torbenm@diku.dk (1996-03-05)
Re: C code .vs. Assembly code for Microcontrollers/DSPs ? hatrjo@hat-fi.kone.com (Risto Jokinen) (1996-03-05)
Re: C code .vs. Assembly code for Microcontrollers/DSPs ? max@gac.edu (1996-03-06)
Re: C code .vs. Assembly code for Microcontrollers/DSPs ? rhn@sgi.com (Ron Nicholson) (1996-03-06)
Re: C code .vs. Assembly code for Microcontrollers/DSPs ? yatesc@csee.usf.edu (1996-03-06)
Re: C code .vs. Assembly code for Microcontrollers/DSPs ? cdg@nullstone.com (1996-03-07)
[42 later articles]
| List of all articles for this month |

From: fink@post.tau.ac.il (Udi Finkelstein)
Newsgroups: comp.compilers,comp.dsp
Date: 5 Mar 1996 12:24:31 -0500
Organization: Tel-Aviv University Computation Center
References: 96-03-006
Keywords: optimize, code, DSP

ravindra@hal.com (Ravindra Divekar) wrote:


>I've heard people say so many times, that hand-crafted (assembly) code
>is more compact than compiled C code for microcontrollers or DSPs.
>
>So where is the problem?
>
>Is it a limitation of existing compiler technology (so much for the
>optimization hype) ?


Most DSP's are optimized for handcrafted assembly. Some has on chip
code stack which is only a few levels deep for subroutine calls. You
can't assume it's deep enough for any arbitrary code (and you can't
make the stack segment larger...). Most DSP's doesn't have enough
general purpose registers, and in fact don't have any notion of a data
stack or a stack frame! The problem can be solved in the same way as
it was solved in the 8051 C compilers (give the programmer better
control), analyze the call tree (see if it can fit the small 256 byte
stack), place automatic variable in fixed memory addresses if no
recursion is done, etc.


>Is it the choice of high level language i.e. C/C++ that matters ?


C++ is even worse. why bother?


>Is it the nature of application (scientific/real-time/control/float.pt)
>that creates porting problems?


No, it's the nature of the compiler vs. the nature of the chips!


>Or is it just the architectural features of typical microcontrollers that
>make things difficult ?


Yes. They are optimized for small programs, and not for general
purpose compiler support (arbitrary large stacks, uniform register
bank, indexing variables off a stack pointer, etc.)


Udi
--


Post a followup to this message

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