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

mwilliam@duncan.cs.utk.edu (Myles Barrett Williams)
3 Mar 1996 19:45:28 -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)
[47 later articles]
| List of all articles for this month |
From: mwilliam@duncan.cs.utk.edu (Myles Barrett Williams)
Newsgroups: comp.compilers,comp.dsp
Date: 3 Mar 1996 19:45:28 -0500
Organization: Computer Science Dept, University of Tennessee, Knoxville
References: 96-03-006
Keywords: optimize, code
In-reply-to: ravindra@hal.com's message of 1 Mar 1996 13:52:30 -0500

ravindra@hal.com (Ravindra Divekar) writes:
      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?


Depending on what's important in your current project, it's not
necessarily a problem.


When someone writes a compiler, they have to come up with a method to
implement each feature of the language in assembly. For example, the
function call mechanism typically introduces significant overhead, but
it's necessary in order to have a generalized way of passing the
arguments to a subroutine.


On the other hand, when you code in assembly you are not constrained
by anyone else's model. Your function call mechanism can be different
for different functions, and you can usually trim a couple of
instructions here and there. But devising your own programming model
takes some extra development time.


Does the compiled code fit into your EPROM?


Did you get the program developed faster than you would have in
assembly?


Will your program still be useful when a client wants to do the same
thing on another processor?


If you can answer yes to the first question, you have nothing to worry
about. The other two questions are icing on the cake.
--
Myles Williams
http://funnelweb.utcc.utk.edu/~williams/
--


Post a followup to this message

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