Skip to content

Dynflags refactoring V (#17957)

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

More work towards avoiding DynFlags use (cf #17957). Commit messages:

  1. CmmToAsm DynFlags refactoring

    • Remove DynFlags parameter from isDynLinkName: isDynLinkName used to test the global ExternalDynamicRefs flag. Now we test it outside of isDynLinkName

    • Add new fields into NCGConfig: current unit id, sse/bmi versions, externalDynamicRefs, etc.

    • Replace many uses of DynFlags by NCGConfig

    • Moved BMI/SSE datatypes into GHC.Platform

  2. Avoid sdocWithDynFlags in pprCLbl

    • add a DynFlags parameter to pprCLbl
    • put maybe_underscore and pprAsmCLbl in a where clause to avoid DynFlags parameters
  3. Avoid using sdocWithDynFlags

    Remove one use of sdocWithDynFlags from GHC.CmmToLlvm.llvmCodeGen' and from GHC.Driver.CodeOutput.profilingInitCode

  4. Avoid DynFlags in Ppr code

    • replace DynFlags parameters with SDocContext parameters for a few Ppr related functions: bufLeftRenderSDoc, printSDoc, printSDocLn, showSDocOneLine.

    • remove the use of pprCols :: DynFlags -> Int in Outputable. We already have the information via sdocLineLength :: SDocContext -> Int

  5. GHC.Runtime: avoid DynFlags

    • add getPlatform :: TcM Platform helper
    • remove unused DynFlags parameter from emptyPLS
  6. Use ParserFlags in GHC.Runtime.Eval

    Instead of passing DynFlags to functions such as isStmt and hasImport in GHC.Runtime.Eval we pass ParserFlags. It's a much simpler structure that can be created purely with mkParserFlags'.

Edited by Sylvain Henry

Merge request reports