[sdiy] The Chameleon Guitar
Rainer Buchty
rainer at buchty.net
Thu Apr 9 00:47:06 CEST 2009
On Thu, 9 Apr 2009, Matthew Smith wrote:
> But, as I said, it all depends on the quality of the C compiler, hence
> my use of capitals in the first paragraph.
Not only that, it also depends on how you program.
Using C, you tend to use local variables, structures, and pointers to
these. Just like they teach you the proper way. In these days, you're
also less concerned about data types. It's an integer value, so let's
use "int", no matter if only a char is required.
On assembly level, especially when working in a space-limited
environment, you often enough use global variables/structures and access
them directly. Likewise, you tend to avoid bigger data types wherever
possible, especially those not directly supported by the target
hardware.
And, of course, the code for directly messing around with individual
variables is leaner than working your way through a pointer to a
structure containing these variables, which has been handed over via the
stack.
I was just messing around with gcc6809 today, and the (at first thought)
overly bloated generated assembly code was just because of such issues.
Here, the compiler does what it is told, it creates a stack frame,
transfers the input variables, sets up a frame for local variables, and
then tries to resolve everything from there.
IOW, it just does what it was told to do by the C code.
Rainer
More information about the Synth-diy
mailing list