[gambit-list] -cfg option

Marc Feeley feeley at iro.umontreal.ca
Wed Jul 19 01:59:52 EDT 2017


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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: fib.cfg.pdf
Type: application/pdf
Size: 21339 bytes
Desc: not available
URL: <http://mailman.iro.umontreal.ca/pipermail/gambit-list/attachments/20170719/a3d6ca16/attachment.pdf>
-------------- next part --------------




More information about the Gambit-list mailing list