1. 21 Aug, 2020 2 commits
  2. 13 Aug, 2020 1 commit
    • Sebastian Graf's avatar
      PmCheck: Better long-distance info for where bindings (#18533) · 55dec4dc
      Sebastian Graf authored
      Where bindings can see evidence from the pattern match of the `GRHSs`
      they belong to, but not from anything in any of the guards (which belong
      to one of possibly many RHSs).
      Before this patch, we did *not* consider said evidence, causing #18533,
      where the lack of considering type information from a case pattern match
      leads to failure to resolve the vanilla COMPLETE set of a data type.
      Making available that information required a medium amount of
      refactoring so that `checkMatches` can return a
      `[(Deltas, NonEmpty Deltas)]`; one `(Deltas, NonEmpty Deltas)` for each
      `GRHSs` of the match group. The first component of the pair is the
      covered set of the pattern, the second component is one covered set per
      Fixes #18533.
      Regression test case: T18533
  3. 12 Aug, 2020 1 commit
    • Sylvain Henry's avatar
      DynFlags: disentangle Outputable · accbc242
      Sylvain Henry authored
      - put panic related functions into GHC.Utils.Panic
      - put trace related functions using DynFlags in GHC.Driver.Ppr
      One step closer making Outputable fully independent of DynFlags.
      Bump haddock submodule
  4. 07 Aug, 2020 3 commits
  5. 31 Jul, 2020 1 commit
    • Sylvain Henry's avatar
      Refactor CLabel pretty-printing · 56a7c193
      Sylvain Henry authored
      Pretty-printing CLabel relies on sdocWithDynFlags that we want to remove
      (#10143, #17957). It uses it to query the backend and the platform.
      This patch exposes Clabel ppr functions specialised for each backend so
      that backend code can directly use them.
  6. 25 Jul, 2020 2 commits
  7. 23 Jul, 2020 2 commits
    • Sylvain Henry's avatar
      Replace HscTarget with Backend · f7cc4313
      Sylvain Henry authored
      They both have the same role and Backend name is more explicit.
      Metric Decrease:
      Update Haddock submodule
    • Sylvain Henry's avatar
      Replace ghcWithNativeCodeGen with a proper Backend datatype · 735f9d6b
      Sylvain Henry authored
      * Represent backends with a `Backend` datatype in GHC.Driver.Backend
      * Don't detect the default backend to use for the target platform at
        compile time in Hadrian/make but at runtime. It makes "Settings"
        simpler and it is a step toward making GHC multi-target.
      * The latter change also fixes hadrian which has not been updated to
        take into account that the NCG now supports AIX and PPC64 (cf
        df26b955 and
      * Also we don't treat iOS specifically anymore (cf
  8. 12 Jul, 2020 1 commit
    • Andreas Klebinger's avatar
      Give Uniq[D]FM a phantom type for its key. · c4de6a7a
      Andreas Klebinger authored
      This fixes #17667 and should help to avoid such issues going forward.
      The changes are mostly mechanical in nature. With two notable
      * The register allocator.
        The register allocator references registers by distinct uniques.
        However they come from the types of VirtualReg, Reg or Unique in
        various places. As a result we sometimes cast the key type of the
        map and use functions which operate on the now typed map but take
        a raw Unique as actual key. The logic itself has not changed it
        just becomes obvious where we do so now.
      * <Type>Env Modules.
      As an example a ClassEnv is currently queried using the types `Class`,
      `Name`, and `TyCon`. This is safe since for a distinct class value all
      these expressions give the same unique.
          getUnique cls
          getUnique (classTyCon cls)
          getUnique (className cls)
          getUnique (tcName $ classTyCon cls)
      This is for the most part contained within the modules defining the
      interface. However it requires us to play dirty when we are given a
      `Name` to lookup in a `UniqFM Class a` map. But again the logic did
      not change and it's for the most part hidden behind the Env Module.
      Some of these cases could be avoided by refactoring but this is left
      for future work.
      We also bump the haddock submodule as it uses UniqFM.
  9. 03 Jul, 2020 1 commit
    • Sylvain Henry's avatar
      Replace Opt_SccProfilingOn flag with sccProfilingEnabled helper function · f08d6316
      Sylvain Henry authored
      SCC profiling was enabled in a convoluted way: if WayProf was enabled,
      Opt_SccProfilingOn general flag was set (in
      `GHC.Driver.Ways.wayGeneralFlags`), and then this flag was queried in
      various places.
      There is no need to go via general flags, so this patch defines a
      `sccProfilingEnabled :: DynFlags -> Bool` helper function that just
      checks whether WayProf is enabled.
  10. 28 Jun, 2020 1 commit
  11. 25 Jun, 2020 1 commit
    • Takenobu Tani's avatar
      Clean up haddock hyperlinks of GHC.* (part1) · c7dd6da7
      Takenobu Tani authored
      This updates haddock comments only.
      This patch focuses to update for hyperlinks in GHC API's haddock comments,
      because broken links especially discourage newcomers.
      This includes the following hierarchies:
        - GHC.Hs.*
        - GHC.Core.*
        - GHC.Stg.*
        - GHC.Cmm.*
        - GHC.Types.*
        - GHC.Data.*
        - GHC.Builtin.*
        - GHC.Parser.*
        - GHC.Driver.*
        - GHC top
  12. 24 Jun, 2020 2 commits
    • Sylvain Henry's avatar
      CmmToC: don't add extern decl to parsed Cmm data · 2636794d
      Sylvain Henry authored
      Previously, if a .cmm file *not in the RTS* contained something like:
      section "rodata" { msg : bits8[] "Test\n"; }
      It would get compiled by CmmToC into:
      const char msg[] = "Test\012";
      and fail with:
      /tmp/ghc32129_0/ghc_4.hc:5:12: error:
           error: conflicting types for \u2018msg\u2019
           const char msg[] = "Test\012";
      In file included from /tmp/ghc32129_0/ghc_4.hc:3:0: error:
      /tmp/ghc32129_0/ghc_4.hc:4:6: error:
           note: previous declaration of \u2018msg\u2019 was here
      /builds/hsyl20/ghc/_build/install/lib/ghc- error:
           note: in definition of macro \u2018ERW_\u2019
           #define ERW_(X)   extern       StgWordArray (X)
      See the rationale for this on https://gitlab.haskell.org/ghc/ghc/-/wikis/commentary/compiler/backends/ppr-c#prototypes
      Now we don't generate these extern declarations (ERW_, etc.) for
      top-level data. It shouldn't change anything for the RTS (the only place
      we use .cmm files) as it is already special cased in
      `GHC.Cmm.CLabel.needsCDecl`. And hand-written Cmm can use explicit
      extern declarations when needed.
      Note that it allows `cgrun069` test to pass with CmmToC (cf #15467).
    • Sylvain Henry's avatar
      Cmm: introduce SAVE_REGS/RESTORE_REGS · 7750bd45
      Sylvain Henry authored
      We don't want to save both Fn and Dn register sets on x86-64 as they are
      aliased to the same arch register (XMMn).
      Moreover, when SAVE_STGREGS was used in conjunction with `jump foo [*]`
      which makes a set of Cmm registers alive so that they cover all arch
      registers used to pass parameter, we could have Fn, Dn and XMMn alive at
      the same time. It made the LLVM code generator choke (see #17920).
      Now `SAVE_REGS/RESTORE_REGS` and `jump foo [*]` use the same set of
  13. 19 Jun, 2020 1 commit
  14. 17 Jun, 2020 1 commit
  15. 14 Jun, 2020 1 commit
  16. 13 Jun, 2020 3 commits
    • Sylvain Henry's avatar
      Enhance UnitId use · e7272d53
      Sylvain Henry authored
      * use UnitId instead of String to identify wired-in units
      * use UnitId instead of Unit in the backend (Unit are only use by
        Backpack to produce type-checked interfaces, not real code)
      * rename lookup functions for consistency
      * documentation
    • Sylvain Henry's avatar
      Refactor homeUnit · 72d08610
      Sylvain Henry authored
      * rename thisPackage into homeUnit
      * document and refactor several Backpack things
    • Sylvain Henry's avatar
      DynFlags refactoring VIII (#17957) · 2517a51c
      Sylvain Henry authored
      * Remove several uses of `sdocWithDynFlags`, especially in GHC.Llvm.*
      * Add LlvmOpts datatype to store Llvm backend options
      * Remove Outputable instances (for LlvmVar, LlvmLit, LlvmStatic and
        Llvm.MetaExpr) which require LlvmOpts.
      * Rename ppMetaExpr into ppMetaAnnotExpr (pprMetaExpr is now used in place of `ppr :: MetaExpr -> SDoc`)
  17. 10 Jun, 2020 1 commit
  18. 01 Jun, 2020 2 commits
  19. 28 May, 2020 1 commit
  20. 21 May, 2020 1 commit
  21. 15 May, 2020 1 commit
    • Ben Gamari's avatar
      GHC.Cmm.Opt: Handle MO_XX_Conv · 568d7279
      Ben Gamari authored
      This MachOp was introduced by 2c959a18
      but a wildcard match in cmmMachOpFoldM hid the fact that it wasn't
      handled. Ideally we would eliminate the match but this appears to be a
      larger task.
      Fixes #18141.
  22. 13 May, 2020 1 commit
  23. 08 May, 2020 1 commit
  24. 06 May, 2020 1 commit
  25. 01 May, 2020 1 commit
    • Sylvain Henry's avatar
      Refactor PprDebug handling · f8386c7b
      Sylvain Henry authored
      If `-dppr-debug` is set, then PprUser and PprDump styles are silently
      replaced with PprDebug style. This was done in `mkUserStyle` and
      `mkDumpStyle` smart constructors. As a consequence they needed a
      DynFlags parameter.
      Now we keep the original PprUser and PprDump styles until they are used
      to create an `SDocContext`. I.e. the substitution is only performed in
  26. 30 Apr, 2020 2 commits
    • Sylvain Henry's avatar
      Unit: split and rename modules · 8bfb0219
      Sylvain Henry authored
      Introduce GHC.Unit.* hierarchy for everything concerning units, packages
      and modules.
      Update Haddock submodule
    • Sylvain Henry's avatar
      Refactoring unit management code · 10d15f1e
      Sylvain Henry authored
      Over the years the unit management code has been modified a lot to keep
      up with changes in Cabal (e.g. support for several library components in
      the same package), to integrate BackPack, etc. I found it very hard to
      understand as the terminology wasn't consistent, was referring to past
      concepts, etc.
      The terminology is now explained as clearly as I could in the Note
      "About Units" and the code is refactored to reflect it.
      Many names were misleading: UnitId is not an Id but could be a virtual
      unit (an indefinite one instantiated on the fly), IndefUnitId
      constructor may contain a definite instantiated unit, etc.
         * Rename IndefUnitId into InstantiatedUnit
         * Rename IndefModule into InstantiatedModule
         * Rename UnitId type into Unit
         * Rename IndefiniteUnitId constructor into VirtUnit
         * Rename DefiniteUnitId constructor into RealUnit
         * Rename packageConfigId into mkUnit
         * Rename getPackageDetails into unsafeGetUnitInfo
         * Rename InstalledUnitId into UnitId
      Remove references to misleading ComponentId: a ComponentId is just an
      indefinite unit-id to be instantiated.
         * Rename ComponentId into IndefUnitId
         * Rename ComponentDetails into UnitPprInfo
         * Fix display of UnitPprInfo with empty version: this is now used for
           units dynamically generated by BackPack
      Generalize several types (Module, Unit, etc.) so that they can be used
      with different unit identifier types: UnitKey, UnitId, Unit, etc.
         * GenModule: Module, InstantiatedModule and InstalledModule are now
           instances of this type
         * Generalize DefUnitId, IndefUnitId, Unit, InstantiatedUnit,
      Replace BackPack fake "hole" UnitId by a proper HoleUnit constructor.
      Add basic support for UnitKey. They should be used more in the future to
      avoid mixing them up with UnitId as we do now.
      Add many comments.
      Update Haddock submodule
  27. 26 Apr, 2020 1 commit
  28. 21 Apr, 2020 2 commits
    • Sylvain Henry's avatar
      CmmToAsm DynFlags refactoring (#17957) · 747093b7
      Sylvain Henry authored
      * Remove `DynFlags` parameter from `isDynLinkName`: `isDynLinkName` used
        to test the global `ExternalDynamicRefs` flag. Now we test it outside of
      * 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`
    • Sylvain Henry's avatar
      Avoid `sdocWithDynFlags` in `pprCLbl` (#17957) · f2a98996
      Sylvain Henry authored
      * add a `DynFlags` parameter to `pprCLbl`
      * put `maybe_underscore` and `pprAsmCLbl` in a `where` clause to avoid
        `DynFlags` parameters
  29. 18 Apr, 2020 1 commit
    • Sylvain Henry's avatar
      Modules (#13009) · 15312bbb
      Sylvain Henry authored
      * SysTools
      * Parser
      * GHC.Builtin
      * GHC.Iface.Recomp
      * Settings
      Update Haddock submodule
      Metric Decrease: