4 A random set of notes about sdcc and how it works.
8 Tracing parmBytes and function calls.
11 void printf(const char *format);
13 void puts(const char *s)
18 Generates the pseudo-code:
22 pop l (not hl - so parmBytes is too small)
24 parmBytes for a function call seems to be setup in geniCodeCall in
28 * Takes care of calls with side effects (?)
29 * Generates the icode to push the parameters (this also computes the
31 * Generates a CALL or PCALL depending on if its a function or pointer to.
33 * Adds the code for the call to the chain.
35 My bug is probably in geniCodeParms - it's probably computing the
36 size of pointers wrong.
39 * A 'parm' node causes this to be run on the tree branches.
40 * It switches on the stack mode and sendto mode, and adds the
41 instructions required to push or put.
42 * A push adds the result of 'getSize' to the stack size.
44 So the bug is probably in getSize. 's' is not an aggregate, so the
47 It seems that IS_SPEC() is being set, deferencing *s so that it's size
48 is sizeof(char) == 1. It's either a SPECIFIER or a DECLARATOR - seems that
49 were the wrong way around. This is set in SDCCsymt.c, SDCCval.c, and the
50 yacc file. SDCCsymt.c and SDCCval.c havnt really changed in 5 days - must
51 be SDCC.y. Nope, no changes. diff against 5 days ago shows only intersting
52 changes are in SDCCicode. Same with -14 days.
56 Next bug is global function parameters not being pushed correctly. i.e
62 printf("Counter is %u\n", counter);
74 printf("Counter is %u\n", &counter);
76 First looking in SDCCicode.c for the stuff that generates function calls:
77 Probably a bug in geniCodeParams.
78 Nope, a bug in my stuff :)