Assembly decoding help?

Stefan O'Rear stefanor at cox.net
Tue Mar 4 20:38:09 EST 2008


On Tue, Mar 04, 2008 at 05:07:03PM -0800, Justin Bailey wrote:
> I'm trying to get a feel for the assembly output by GHC on my
> platform. Below is a module containing one function and the associated
> assembly. I've put in comments what I think is going on, but I'd
> appreciate it if anyone could give me some pointers. I'd really like
> to know three things:
> 
>   * Why does _Add_unsafeShiftR_info check if (%esi) is 3?
>   * What's going on in _s86_info?
>   * At the end of _s87_info, 8 is added to %ebp and then jumped to. Is
> that a jump to the I# constructor and, if so, how did it's address get
> to that offset from %ebp?
> 
> Thanks in advance for any assistance!

It would be more helpful if you didn't try to go from Haskell to
assembly in one step - it's a lot easier to understand each big step of
the GHC pipeline individually.

Haskell
|
\-> Core (ghc -ddump-simpl Foo.hs > Foo.core; or -fext-core if you want
         something ugly but parsable; an unrestricted but simple
	 expression-functional language)
    |
    \-> STG (ghc -ddump-stg ...) (Much more regular than Core; more like
            functional C)
	|
        \-> C-- (ghc -ddump-cmm) (just what it says: Simplified C for
	        compiler writers.  The universal assembly language for
		the 21st century)
	    |
	    \-> assembly

Stefan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://www.haskell.org/pipermail/glasgow-haskell-users/attachments/20080304/3bbb295b/attachment.bin


More information about the Glasgow-haskell-users mailing list