-<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
-<html>
- <head>
- <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">
- <title>The GHC Commentary - Spineless Tagless C</title>
- </head>
-
- <body BGCOLOR="FFFFFF">
- <h1>The GHC Commentary - Spineless Tagless C</h1>
- <p>
- The C code generated by GHC doesn't use higher-level features of C to be
- able to control as precisely as possible what code is generated.
- Moreover, it uses special features of gcc (such as, first class labels)
- to produce more efficient code.
- <p>
- STG C makes ample use of C's macro language to define idioms, which also
- reduces the size of the generated C code (thus, reducing I/O times).
- These macros are defined in the C headers located in GHC's <a
- href="http://cvs.haskell.org/cgi-bin/cvsweb.cgi/fptools/ghc/includes/"><code>includes</code></a>
- directory.
-
- <h4><code>TailCalls.h</code></h4>
- <p>
- <a
- href="http://cvs.haskell.org/cgi-bin/cvsweb.cgi/fptools/ghc/includes/TailCalls.h"><code>TailCalls.h</code></a>
- defines how tail calls are implemented - and in particular - optimised
- in GHC generated code. The default case, for an architecture for which
- GHC is not optimised, is to use the mini interpreter described in the <a
- href="http://research.microsoft.com/copyright/accept.asp?path=/users/simonpj/papers/spineless-tagless-gmachine.ps.gz&pub=34">STG paper.</a>
- <p>
- For supported architectures, various tricks are used to generate
- assembler implementing proper tail calls. On i386, gcc's first class
- labels are used to directly jump to a function pointer. Furthermore,
- markers of the form <code>--- BEGIN ---</code> and <code>--- END
- ---</code> are added to the assembly right after the function prologue
- and before the epilogue. These markers are used by <a
- href="../the-beast/mangler.html">the Evil Mangler.</a>
-
- <p><small>
-<!-- hhmts start -->
-Last modified: Wed Aug 8 19:28:29 EST 2001
-<!-- hhmts end -->
- </small>
- </body>
-</html>