Refactor CmmToAsm (disentangle DynFlags)
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 fewsdocWithDynFlags
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.