I’ve just added the -cfg option to gsc to generate a visual representation of the control flow graph. This is useful for debugging the compiler, but it may also help understand the code generated by the compiler for specific (small) programs. This option generates a .cfg file that can be processed by the “dot” program. For example, the attached PDF file “fib.cfg.pdf” was generated using the commands:
% gsc -c -cfg fib.scm % dot -O -Tpdf fib.cfg
from the file:
(declare (standard-bindings) (block) (not safe) (fixnum) (not inline) (not interrupts-enabled) )
(define (fib n) (if (< n 2) n (+ (fib (- n 1)) (fib (- n 2)))))
Have fun!
Marc