核心是GHC的中间语言.阅读核心可以帮助您更好地了解您的计划的性能.有人问我关于阅读Core的文档或教程,但我找不到多少.
有哪些文档可供阅读GHC Core?
这是我到目前为止所发现的:
我想确定GHC为给定函数生成的汇编.
这里,例如,是一些代码(应该)在一个字中旋转位 - 它将位0移动到位12,位12到14,位14移回0,类似地移位位置1,18,13和6.
找到生成rot0cw的.S文件中生成的程序集的最佳方法是 ghc -O2 -S ...什么?
我已经阅读了这个答案,但是..._rot0cw_closure在程序集输出中我没有看到任何答案.
import Data.Bits
import Data.Int (Int64)
import Text.Printf
import System.Environment
{-# INLINE maskbits #-}
-- set in word v the bits of b corresponding to the mask m
-- assume a bit in b is zero if not in the mask
maskbits v m b = (v .&. (complement m) .|. b)
{-# INLINE tb #-}
-- transfer bit i …Run Code Online (Sandbox Code Playgroud)