<div dir="ltr">Dear friends,<div><br></div><div>I'm trying to implement a new codegen for ghc, starting by using the ghc api to compile modules to STG/Cmm. In order to support importing Prelude, I also need the STG/Cmm representations of wired-in packages like base, ghc-prim, etc, and I guess that means I need to re-compile them.</div><div><br></div><div>I can roughly think of two approaches:</div><div><br></div><div>* Load the `ModIface` of wired-in packages, which are tidied Core modules, and convert to STG/Cmm</div><div>* Get the library sources from ghc repo and launch a regular compilation.</div><div><br></div><div>I haven't succeeded in either approach. For the first one, I haven't found a way to convert `ModIface` of external package to regular compilation targets; for the second one, regular "cabal installs" won't do the trick, seems compiling wired-in packages require quite some magic.</div><div><br></div><div>What is the preferred way of re-compiling wired-in packages and retrieving their STG/Cmm representations? Thank a lot.</div><div><br></div><div>Cheers,</div><div>Shao Cheng</div><div><br></div></div>