3 ms·
GHC (Haskell) compiles to a Haskell program modelling C--, a subset of C. From there, it is rendered as actual C and compiled using GCC. I believe there's mor
by jewbacca 16y ago
GHC (Haskell) compiles to a Haskell program modelling C--, a subset of C. From there, it is rendered as actual C and compiled using GCC.
I believe there's more recently an option involving LLVM, though I'm not sure if this replaces the C-- step or is an alternative to GCC.
- steveklabnik 16y agoMan, it is really hard to google for '-f-via-c.' I believe that it has been deprecated now that the LLVM backend is more mature. I'm not 100% sure, though. EDIT: found it! http://www.haskell.org/ghc/docs/7.0.1/html/users_guide/release-7-0-1.html http://www.haskell.org/ghc/docs/7.0.1/html/users_guide/relea... (in the 1.5.6 section) > The registerised via-C backend, and the -fvia-C flag, have been deprecated. The poor floating-point performance in the x86 native code generator has now been fixed, so we don't believe there is still any reason to use the via-C backend.
- masklinn 16y ago-fvia-c was not the main mode of operation even in 6.x, it had an NCG long before the LLVM backend.
- andolanra 16y agoC-- isn't a strict subset of C; it changes a lot, but it takes the idea of a C subset as its starting point and then makes a wide swath of changes as needed. It's also designed to be non-portable (apparently to make sure that architecture-dependent optimizations can be performed if necessary), although from my limited experience with the specification I doubt it'd be hard to write semi-portable C-- and modify it as necessary at the loss of some optimizations.