3 A random set of notes about sdcc and how it works.
7 The Register Allocation story.
9 Before I get into this there are a few important fields
10 on the iCode & oprtand data structures that need to be
15 ->key - is an unique number assigned to this
16 iCode when this icode is allocated.
18 ->seq - sequence number of the iCode given in
19 acesnding order of execution.
23 ->key - unique number for an operand when operand
26 OP_LIVEFROM(op) - sequence number of the iCode where it was
27 first defined. Computed in SDCClrange.c
29 OP_LIVETO(op) - sequence number of the iCode where it is
30 last used. Computed in SDCClrange.c
37 Adding memory maps for AVR, setup default map for
38 local & global variables in port.h will be initialised
39 by the _<port>_finaliseOptions() [good functions]..some
40 kludges remain because of the "overlay" segment for 8051.
42 The memory segment stuff will have to be made more flexible.
43 Currently there does not seem to be a 1-to-1 correspondence
44 between storage class & memory map. (should there be??).
46 Also Added check for memory map in SDCCmem.c allocLocal
47 and allocglobal for "eeprom" memory space (AVR).
53 Tracing parmBytes and function calls.
56 void printf(const char *format);
58 void puts(const char *s)
63 Generates the pseudo-code:
67 pop l (not hl - so parmBytes is too small)
69 parmBytes for a function call seems to be setup in geniCodeCall in
73 * Takes care of calls with side effects (?)
74 * Generates the icode to push the parameters (this also computes the
76 * Generates a CALL or PCALL depending on if its a function or pointer to.
78 * Adds the code for the call to the chain.
80 My bug is probably in geniCodeParms - it's probably computing the
81 size of pointers wrong.
84 * A 'parm' node causes this to be run on the tree branches.
85 * It switches on the stack mode and sendto mode, and adds the
86 instructions required to push or put.
87 * A push adds the result of 'getSize' to the stack size.
89 So the bug is probably in getSize. 's' is not an aggregate, so the
92 It seems that IS_SPEC() is being set, deferencing *s so that it's size
93 is sizeof(char) == 1. It's either a SPECIFIER or a DECLARATOR - seems that
94 were the wrong way around. This is set in SDCCsymt.c, SDCCval.c, and the
95 yacc file. SDCCsymt.c and SDCCval.c havnt really changed in 5 days - must
96 be SDCC.y. Nope, no changes. diff against 5 days ago shows only intersting
97 changes are in SDCCicode. Same with -14 days.
101 Next bug is global function parameters not being pushed correctly. i.e
103 unsigned int counter;
107 printf("Counter is %u\n", counter);
119 printf("Counter is %u\n", &counter);
121 First looking in SDCCicode.c for the stuff that generates function calls:
122 Probably a bug in geniCodeParams.
123 Nope, a bug in my stuff :)