Skip to content

Refactor CmmToAsm (disentangle DynFlags)

Sylvain Henry requested to merge hsyl20/ghc:hsyl20-dynflags-ncg into master

Refactor CmmToAsm (disentangle DynFlags)

This patch disentangles a bit more DynFlags from the native code generator (CmmToAsm).

In more details:

  • add a new Config datatype in GHC.CmmToAsm.Config which contains the configuration of a native code generation session
  • explicitly pass Config/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 Config)

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.

Edited by Sylvain Henry

Merge request reports