understanding ghc compilation driver architecture

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

understanding ghc compilation driver architecture

Carter Schonwald
hey All,
I've been spending a bunch of time the past week or so understanding the
ghc compilation driver design and also some bits of of the RTS.

1) there seems to be bit of cruft, or at least some comments in the code is
no longer true in various places.  eg
http://hackage.haskell.org/trac/ghc/ticket/7907 is a teeny patch to make
one comment about stgclosure c types more accurate. Another example is
https://github.com/ghc/ghc/blob/master/compiler/main/DriverPipeline.hs#L803which
mentions the -fvia-c backend in  2-3 places

2) when the ghc driver is used to manage building c code for subsequent ffi
usage, it doesn't seem possible to use a c compiler to do  *.c ->
*.o/dylib, instead it is only possible to do *.c->  *.s  -> *.o/dylib.

I'm curious about reasons c,s,o  choice that are still in play. It makes
total sense historically from when the -fvia-c backend, but I'm trying to
understand why it is still done this way. (and yes, I'm aware that its
pretty easy to have the c compilation be done out of band using a more
standard make like tool, I'm simply curious about the current design,
because theres not really any information in the commentary thats still
current)

thanks
-Carter
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/ghc-devs/attachments/20130515/f4d2cc78/attachment.htm>

Reply | Threaded
Open this post in threaded view
|

understanding ghc compilation driver architecture

Ian Lynagh-2
On Wed, May 15, 2013 at 12:45:01AM -0400, Carter Schonwald wrote:
>
> https://github.com/ghc/ghc/blob/master/compiler/main/DriverPipeline.hs#L803which
> mentions the -fvia-c backend in  2-3 places

I've updated that, ta.

> 2) when the ghc driver is used to manage building c code for subsequent ffi
> usage, it doesn't seem possible to use a c compiler to do  *.c ->
> *.o/dylib, instead it is only possible to do *.c->  *.s  -> *.o/dylib.
>
> I'm curious about reasons c,s,o  choice that are still in play.

Well, it means that GHC can be used to compile hand-written asm, and it
also means that you can do "ghc -S". Also, there's been no reason to
change it.


--
Ian Lynagh, Haskell Consultant
Well-Typed LLP, http://www.well-typed.com/


Reply | Threaded
Open this post in threaded view
|

understanding ghc compilation driver architecture

Carter Schonwald
Good answers. Thanks!
I'm still learning a lot of the ghc code base, so I may have a few other
questions like this as I try to familiarize with ghc code.

Is the dev list an ok forum for these sorts of questions?

On Saturday, May 18, 2013, Ian Lynagh wrote:

> On Wed, May 15, 2013 at 12:45:01AM -0400, Carter Schonwald wrote:
> >
> >
> https://github.com/ghc/ghc/blob/master/compiler/main/DriverPipeline.hs#L803which
> > mentions the -fvia-c backend in  2-3 places
>
> I've updated that, ta.
>
> > 2) when the ghc driver is used to manage building c code for subsequent
> ffi
> > usage, it doesn't seem possible to use a c compiler to do  *.c ->
> > *.o/dylib, instead it is only possible to do *.c->  *.s  -> *.o/dylib.
> >
> > I'm curious about reasons c,s,o  choice that are still in play.
>
> Well, it means that GHC can be used to compile hand-written asm, and it
> also means that you can do "ghc -S". Also, there's been no reason to
> change it.
>
>
> --
> Ian Lynagh, Haskell Consultant
> Well-Typed LLP, http://www.well-typed.com/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/ghc-devs/attachments/20130518/8d46a54e/attachment-0001.htm>

Reply | Threaded
Open this post in threaded view
|

understanding ghc compilation driver architecture

Ian Lynagh-2
On Sat, May 18, 2013 at 05:42:35PM -0400, Carter Schonwald wrote:
>
> I'm still learning a lot of the ghc code base, so I may have a few other
> questions like this as I try to familiarize with ghc code.
>
> Is the dev list an ok forum for these sorts of questions?

Yes, ask away. And hopefully, someone will answer  :-)


Thanks
Ian
--
Ian Lynagh, Haskell Consultant
Well-Typed LLP, http://www.well-typed.com/