]> git.gag.com Git - fw/sdcc/blobdiff - doc/random-notes.txt
Added support for the gb, touched some files in testing the port.
[fw/sdcc] / doc / random-notes.txt
diff --git a/doc/random-notes.txt b/doc/random-notes.txt
new file mode 100644 (file)
index 0000000..4c77790
--- /dev/null
@@ -0,0 +1,55 @@
+Random notes
+------------
+
+A random set of notes about sdcc and how it works.
+
+Michael:
+--------
+Tracing parmBytes and function calls.
+
+Bug:
+void printf(const char *format);
+
+void puts(const char *s)
+{
+       printf(s);
+}
+
+Generates the pseudo-code:
+         hl = s
+         push hl
+         call printf
+         pop l (not hl - so parmBytes is too small)
+
+parmBytes for a function call seems to be setup in geniCodeCall in
+SDCCicode.c.
+
+geniCodeCall:
+* Takes care of calls with side effects (?)
+* Generates the icode to push the parameters (this also computes the 
+  resulting stack size)
+* Generates a CALL or PCALL depending on if its a function or pointer to.
+* Computes the result
+* Adds the code for the call to the chain.
+
+My bug is probably in geniCodeParms - it's probably computing the
+size of pointers wrong.
+
+geniCodeParms:
+* A 'parm' node causes this to be run on the tree branches.
+* It switches on the stack mode and sendto mode, and adds the
+  instructions required to push or put.
+* A push adds the result of 'getSize' to the stack size.
+
+So the bug is probably in getSize.  's' is not an aggregate, so the
+bug is in getSize().
+
+It seems that IS_SPEC() is being set, deferencing *s so that it's size
+is sizeof(char) == 1.  It's either a SPECIFIER or a DECLARATOR - seems that
+were the wrong way around.  This is set in SDCCsymt.c, SDCCval.c, and the 
+yacc file. SDCCsymt.c and SDCCval.c havnt really changed in 5 days - must
+be SDCC.y.  Nope, no changes.  diff against 5 days ago shows only intersting
+changes are in SDCCicode.  Same with -14 days.
+
+
+