• Sylvain Henry's avatar
    Refactor CmmToAsm (disentangle DynFlags) · 2e82465f
    Sylvain Henry authored
    This patch disentangles a bit more DynFlags from the native code
    generator (CmmToAsm).
    In more details:
    - add a new NCGConfig datatype in GHC.CmmToAsm.Config which contains the
      configuration of a native code generation session
    - explicitly pass NCGConfig/Platform arguments when necessary
    - as a consequence `sdocWithPlatform` is gone and there are only a few
      `sdocWithDynFlags` left
    - remove the use of `unsafeGlobalDynFlags` from GHC.CmmToAsm.CFG
    - remove `sdocDebugLevel` (now we pass the debug level via NCGConfig)
    There are still some places where DynFlags is used, especially because
    of pretty-printing (CLabel), because of Cmm helpers (such as
    `cmmExprType`) and because of `Outputable` instance for the
    instructions. These are left for future refactoring as this patch is
    already big.
Code owners : Ben Gamari
Instr.hs 27.8 KB