...
 
Commits (26)
  • Simon Peyton Jones's avatar
    Re-implement unsafe coercions in terms of unsafe equality proofs · 74ad75e8
    Simon Peyton Jones authored
    (Commit message written by Omer, most of the code is written by Simon
    and Richard)
    
    See Note [Implementing unsafeCoerce] for how unsafe equality proofs and
    the new unsafeCoerce# are implemented.
    
    New notes added:
    
    - [Checking for levity polymorphism] in CoreLint.hs
    - [Implementing unsafeCoerce] in base/Unsafe/Coerce.hs
    - [Patching magic definitions] in Desugar.hs
    - [Wiring in unsafeCoerce#] in Desugar.hs
    
    Only breaking change in this patch is unsafeCoerce# is not exported from
    GHC.Exts, instead of GHC.Prim.
    
    Fixes #17443
    Fixes #16893
    
    NoFib
    -----
    
    --------------------------------------------------------------------------------
            Program           Size    Allocs    Instrs     Reads    Writes
    --------------------------------------------------------------------------------
                 CS          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
                CSD          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
                 FS          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
                  S          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
                 VS          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
                VSD          -0.1%      0.0%     -0.0%     -0.0%     -0.1%
                VSM          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
               anna          -0.0%      0.0%     -0.0%     -0.0%     -0.0%
               ansi          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
               atom          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
             awards          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
             banner          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
         bernouilli          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
       binary-trees          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
              boyer          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
             boyer2          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
               bspt          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
          cacheprof          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
           calendar          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
           cichelli          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
            circsim          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
           clausify          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
      comp_lab_zift          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
           compress          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
          compress2          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
        constraints          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
       cryptarithm1          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
       cryptarithm2          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
                cse          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
       digits-of-e1          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
       digits-of-e2          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
             dom-lt          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
              eliza          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
              event          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
        exact-reals          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
             exp3_8          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
             expert          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
     fannkuch-redux          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
              fasta          -0.1%      0.0%     -0.5%     -0.3%     -0.4%
                fem          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
                fft          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
               fft2          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
           fibheaps          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
               fish          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
              fluid          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
             fulsom          -0.1%      0.0%     +0.0%     +0.0%     +0.0%
             gamteb          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
                gcd          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
        gen_regexps          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
             genfft          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
                 gg          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
               grep          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
             hidden          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
                hpg          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
                ida          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
              infer          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
            integer          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
          integrate          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
       k-nucleotide          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
              kahan          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
            knights          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
             lambda          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
         last-piece          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
               lcss          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
               life          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
               lift          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
             linear          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
          listcompr          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
           listcopy          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
           maillist          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
             mandel          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
            mandel2          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
               mate          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
            minimax          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
            mkhprog          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
         multiplier          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
             n-body          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
           nucleic2          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
               para          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
          paraffins          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
             parser          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
            parstof          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
                pic          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
           pidigits          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
              power          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
             pretty          -0.1%      0.0%     -0.1%     -0.1%     -0.1%
             primes          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
          primetest          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
             prolog          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
             puzzle          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
             queens          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
            reptile          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
    reverse-complem          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
            rewrite          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
               rfib          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
                rsa          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
                scc          -0.1%      0.0%     -0.1%     -0.1%     -0.1%
              sched          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
                scs          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
             simple          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
              solid          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
            sorting          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
      spectral-norm          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
             sphere          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
             symalg          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
                tak          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
          transform          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
           treejoin          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
          typecheck          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
            veritas          -0.0%      0.0%     -0.0%     -0.0%     -0.0%
               wang          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
          wave4main          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
       wheel-sieve1          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
       wheel-sieve2          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
               x2n1          -0.1%      0.0%     -0.0%     -0.0%     -0.0%
    --------------------------------------------------------------------------------
                Min          -0.1%      0.0%     -0.5%     -0.3%     -0.4%
                Max          -0.0%      0.0%     +0.0%     +0.0%     +0.0%
     Geometric Mean          -0.1%     -0.0%     -0.0%     -0.0%     -0.0%
    
    Test changes
    ------------
    
    - break006 is marked as broken, see #17833
    - The compiler allocates less when building T14683 (an unsafeCoerce#-
      heavy happy-generated code) on 64-platforms. Allocates more on 32-bit
      platforms.
    - Rest of the increases are tiny amounts (still enough to pass the
      threshold) in micro-benchmarks. I briefly looked at each one in a
      profiling build: most of the increased allocations seem to be because
      of random changes in the generated code.
    
    Metric Decrease:
        T14683
    
    Metric Increase:
        T12150
        T12234
        T12425
        T13035
        T14683
        T5837
        T6048
    Co-Authored-By: Richard Eisenberg's avatarRichard Eisenberg <rae@cs.brynmawr.edu>
    Co-Authored-By: Ömer Sinan Ağacan's avatarÖmer Sinan Ağacan <omeragacan@gmail.com>
    74ad75e8
  • Sylvain Henry's avatar
    Disentangle DynFlags and SDoc · 6880d6aa
    Sylvain Henry authored
    Remove several uses of `sdocWithDynFlags`. The remaining ones are mostly
    CodeGen related (e.g. depend on target platform constants) and will be
    fixed separately.
    
    Metric Decrease:
       T12425
       T9961
       WWRec
       T1969
       T14683
    6880d6aa
  • Julien Debon's avatar
    doc(List): Add examples to GHC.List · 70a90110
    Julien Debon authored
    * Add examples
    * Cleanup documentation
    * Clarify merge process and Marge bot
    70a90110
  • Peter Trommler's avatar
    Fix testsuite on powerpc64le · c8439fc7
    Peter Trommler authored
    Remove expect broken on recomp tests, #11260 was closed
    by !2264 and #11323 most likely by !2264 as well.
    
    GHCi scripts tests work on GHCi but not the external interpreter,
    adjust test configuration accordingly. Fixes unexpected passes.
    
    Mark test requiring DWARF expect fail on powerpc64[le] for #11261.
    c8439fc7
  • Ömer Sinan Ağacan's avatar
  • Roland Senn's avatar
    Fix #17832: Weird handling of exports named main in 8.10-rc1 · 8b76d457
    Roland Senn authored
    Switching from `lookupGlobalOccRn_maybe` to `lookupInfoOccRn`
    to check whether a `main` function is in scope. Unfortunately
    `lookupGlobalOccRn_maybe` complains if there are multiple `main`
    functions in scope.
    8b76d457
  • Krzysztof Gogolewski's avatar
    Use TTG for HsSplicedT constructor · 466e1ad5
    Krzysztof Gogolewski authored
    The constructor HsSplicedT occurs only in the GhcTc pass.
    This enforces this fact statically via TTG.
    466e1ad5
  • Alexis King's avatar
    Normalize types when dropping absent arguments from workers · 4e622fca
    Alexis King authored
    fixes #17852
    4e622fca
  • Adam Sandberg Eriksson's avatar
  • Ben Gamari's avatar
    05251b17
  • Ben Gamari's avatar
    gitlab-ci: Avoid duplicating ~/.cabal contents with every build · f44c7e67
    Ben Gamari authored
    Previously our attempt to cache the cabal store would
    `cp cabal-cache ~/.cabal`. However, if the latter already
     existed this meant that we would end up with
    ~/.cabal/cabal-cache. Not only would this not help caching
    but it would exponentially grow the size of ~/.cabal. Not
    good!
    f44c7e67
  • Ben Gamari's avatar
    GHC.Hs.Extension: Use Type instead of * · c5ec9965
    Ben Gamari authored
    c5ec9965
  • Ben Gamari's avatar
    Use Type instead of * in GHC · 89cb4cc4
    Ben Gamari authored
    89cb4cc4
  • Ben Gamari's avatar
    Enable -Wstar-is-type in -Wall · 04eb0d6c
    Ben Gamari authored
    As noted in [proposal 0143][proposal] this is supposed to happen in
    8.12.
    
    Also fix an incorrect claim in the users guide that -Wstar-is-type is
    enabled by default.
    
    [proposal]: https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0143-remove-star-kind.rst
    04eb0d6c
  • Andreas Klebinger's avatar
    Fix #17724 by having occAnal preserve used bindings. · 6de966f1
    Andreas Klebinger authored
    It sometimes happened that occAnal would remove bindings
    as dead code by relying on bindings to be in dependency
    order. The fix was contributed by SPJ.
    6de966f1
  • Ben Gamari's avatar
    users-guide: Mention dependency on `exceptions` in release notes · abd7f962
    Ben Gamari authored
    Fixes #17845.
    abd7f962
  • Sylvain Henry's avatar
    Hadrian: minor GMP refactoring · 58175379
    Sylvain Henry authored
    Somehow I forgot to totally remove `gmpContext` in
    d7029cc0. This patch fixes it and adds
    some additional comments.
    58175379
  • Ryan Scott's avatar
    Generalize liftData to work over any Quote (#17857) · 33fa8d94
    Ryan Scott authored
    The Overloaded Quotations proposal generalized the type of `lift`
    to work over any `Quote`, but not the type of `liftData`, leading
    to #17857. Thankfully, generalizing `liftData` is extremely
    straightforward.
    
    Fixes #17857.
    33fa8d94
  • Sylvain Henry's avatar
    Make: fix sdist target (#17848) · 3cea6795
    Sylvain Henry authored
    3cea6795
  • Sylvain Henry's avatar
    Hadrian: fix source-dist target (#17849) · e2cce997
    Sylvain Henry authored
    e2cce997
  • Matthew Pickering's avatar
    Special case `mkTyConApp liftedTypeKind []` · 0a4c89b2
    Matthew Pickering authored
    We really need to make sure that these are shared because otherwise GHC
    will allocate thousands of identical `TyConApp` nodes.
    
    See #17292
    
    -------------------------
    Metric Decrease:
        haddock.Cabal
        T14683
    -------------------------
    0a4c89b2
  • Matthew Pickering's avatar
    TH: wrapGenSyns, don't split the element type too much · 0482f58a
    Matthew Pickering authored
    The invariant which allowed the pervious method of splitting the type of
    the body to find the type of the elements didn't work in the new
    overloaded quotation world as the type can be something like
    `WriterT () m a` rather than `Q a` like before.
    
    Fixes #17839
    0482f58a
  • Vladislav Zavialov's avatar
    Parser API annotations: RealSrcLoc · be7068a6
    Vladislav Zavialov authored
    During parsing, GHC collects lexical information about AST nodes and
    stores it in a map. It is needed to faithfully restore original source
    code, e.g. compare these expressions:
    
    	a =  b
    	a  = b
    
    The position of the equality sign is not recorded in the AST, so it must
    be stored elsewhere.
    
    This system is described in Note [Api annotations].
    
    Before this patch, the mapping was represented by:
    
    	Map (SrcSpan, AnnKeywordId) SrcSpan
    
    After this patch, the mapping is represented by:
    
    	Map (RealSrcSpan, AnnKeywordId) RealSrcSpan
    
    The motivation behind this change is to avoid using the Ord SrcSpan
    instance (required by Map here), as it interferes with #17632 (see the
    discussion there).
    
    SrcSpan is isomorphic to  Either String RealSrcSpan,  but we shouldn't
    use those strings as Map keys. Those strings are intended as hints to
    the user, e.g. "<interactive>" or "<compiler-generated code>", so they
    are not a valid way to identify nodes in the source code.
    be7068a6
  • Sylvain Henry's avatar
    Modules: Driver (#13009) · 240f5bf6
    Sylvain Henry authored
    submodule updates: nofib, haddock
    240f5bf6
  • Sylvain Henry's avatar
    9d094111
  • Shayne Fletcher's avatar
    Derive Ord instance for Extension · b1c99a0d
    Shayne Fletcher authored
    b1c99a0d
...@@ -589,7 +589,7 @@ validate-x86_64-linux-deb9-debug: ...@@ -589,7 +589,7 @@ validate-x86_64-linux-deb9-debug:
BUILD_SPHINX_PDF: "YES" BUILD_SPHINX_PDF: "YES"
TEST_TYPE: slowtest TEST_TYPE: slowtest
TEST_ENV: "x86_64-linux-deb9-debug" TEST_ENV: "x86_64-linux-deb9-debug"
BIN_DIST_PREP_COMP: "ghc-x86_64-deb9-linux-debug.tar.xz" BIN_DIST_PREP_TAR_COMP: "ghc-x86_64-deb9-linux-debug.tar.xz"
artifacts: artifacts:
when: always when: always
expire_in: 2 week expire_in: 2 week
...@@ -858,7 +858,7 @@ nightly-i386-windows-hadrian: ...@@ -858,7 +858,7 @@ nightly-i386-windows-hadrian:
junit: junit.xml junit: junit.xml
paths: paths:
# N.B. variable interpolation apparently doesn't work on Windows so # N.B. variable interpolation apparently doesn't work on Windows so
# this can't be $BIN_DIST_TAR_COMP # this can't be $BIN_DIST_PREP_TAR_COMP
- "ghc-x86_64-mingw32.tar.xz" - "ghc-x86_64-mingw32.tar.xz"
- junit.xml - junit.xml
......
...@@ -151,7 +151,8 @@ function set_toolchain_paths() { ...@@ -151,7 +151,8 @@ function set_toolchain_paths() {
function setup() { function setup() {
if [ -d "$TOP/cabal-cache" ]; then if [ -d "$TOP/cabal-cache" ]; then
info "Extracting cabal cache..." info "Extracting cabal cache..."
cp -Rf cabal-cache "$cabal_dir" mkdir -p "$cabal_dir"
cp -Rf cabal-cache/* "$cabal_dir"
fi fi
if [[ -n "$needs_toolchain" ]]; then if [[ -n "$needs_toolchain" ]]; then
......
...@@ -9,10 +9,11 @@ Please take a few moments to verify that your commits fulfill the following: ...@@ -9,10 +9,11 @@ Please take a few moments to verify that your commits fulfill the following:
* [ ] have added source comments describing your change. For larger changes you * [ ] have added source comments describing your change. For larger changes you
likely should add a [Note][notes] and cross-reference it from the relevant likely should add a [Note][notes] and cross-reference it from the relevant
places. places.
* [ ] add a [testcase to the * [ ] add a [testcase to the testsuite](https://gitlab.haskell.org/ghc/ghc/wikis/building/running-tests/adding).
testsuite](https://gitlab.haskell.org/ghc/ghc/wikis/building/running-tests/adding).
* [ ] if your MR affects library interfaces (e.g. changes `base`) please add * [ ] if your MR affects library interfaces (e.g. changes `base`) please add
the ~"user facing" label. the ~"user facing" label.
* [ ] updates the users guide if applicable
* [ ] mentions new features in the release notes for the next release
If you have any questions don't hesitate to open your merge request and inquire If you have any questions don't hesitate to open your merge request and inquire
in a comment. If your patch isn't quite done yet please do add prefix your MR in a comment. If your patch isn't quite done yet please do add prefix your MR
......
...@@ -12,7 +12,7 @@ The home for GHC hackers is our GitLab instance, located here: ...@@ -12,7 +12,7 @@ The home for GHC hackers is our GitLab instance, located here:
<https://gitlab.haskell.org/ghc/ghc> <https://gitlab.haskell.org/ghc/ghc>
From here, you can file bugs (or look them up,) use the wiki, view the From here, you can file bugs (or look them up), use the wiki, view the
`git` history, among other things. Of particular note is the building `git` history, among other things. Of particular note is the building
page, which has the high level overview of the build process and how page, which has the high level overview of the build process and how
to get the source: to get the source:
...@@ -34,7 +34,7 @@ $ git clone --recursive git@gitlab.haskell.org:ghc/ghc.git ...@@ -34,7 +34,7 @@ $ git clone --recursive git@gitlab.haskell.org:ghc/ghc.git
``` ```
On Windows, you need an extra repository containing some build tools. On Windows, you need an extra repository containing some build tools.
These can be downloaded for you by configure. This only needs to be done once by running: These can be downloaded for you by `configure`. This only needs to be done once by running:
``` ```
$ ./configure --enable-tarballs-autodownload $ ./configure --enable-tarballs-autodownload
...@@ -50,7 +50,7 @@ $ ... double-check mk/build.mk ... ...@@ -50,7 +50,7 @@ $ ... double-check mk/build.mk ...
``` ```
Now build. The convenient `validate` script will build the tree in a way which Now build. The convenient `validate` script will build the tree in a way which
is both quick to build and consistent with our testsuite, is both quick to build and consistent with our testsuite:
``` ```
$ ./validate --build-only $ ./validate --build-only
...@@ -62,15 +62,15 @@ newly built compiler. ...@@ -62,15 +62,15 @@ newly built compiler.
Now, hack on your copy and rebuild (with `make`) as necessary. Now, hack on your copy and rebuild (with `make`) as necessary.
Then start by making your commits however you want. When you're done, you can submit Then start by making your commits however you want. When you're done, you can submit
a pull request on Github for small changes. For larger changes the patch needs to be a pull request on Github for small changes. For larger changes the patch needs to be
submitted to [GitLab](https://gitlab.haskell.org/ghc/ghc/merge_requests) for code review. submitted to [GitLab](https://gitlab.haskell.org/ghc/ghc/merge_requests) for code review.
The GHC Wiki has a good summary for the [overall process](https://gitlab.haskell.org/ghc/ghc/wikis/working-conventions/fixing-bugs). The GHC Wiki has a good summary for the [overall process](https://gitlab.haskell.org/ghc/ghc/wikis/working-conventions/fixing-bugs). One or several reviewers will review your PR, and when they are ok with your changes, they will assign the PR to [Marge Bot](https://gitlab.haskell.org/marge-bot) which will automatically rebase, batch and then merge your PR (assuming the build passes).
Useful links: Useful links:
============= =============
An overview of things like using git, the release process, filing bugs An overview of things like using Git, the release process, filing bugs
and more can be located here: and more can be located here:
<https://gitlab.haskell.org/ghc/ghc/wikis/contributing> <https://gitlab.haskell.org/ghc/ghc/wikis/contributing>
...@@ -94,8 +94,6 @@ and type information of the GHC sources is available at: ...@@ -94,8 +94,6 @@ and type information of the GHC sources is available at:
Look for `GHC` in `Package-name`. For example, here is the link to Look for `GHC` in `Package-name`. For example, here is the link to
[GHC-8.6.5](https://haskell-code-explorer.mfix.io/package/ghc-8.6.5). [GHC-8.6.5](https://haskell-code-explorer.mfix.io/package/ghc-8.6.5).
If you want to watch issues and code review activities, the following page is a good start: If you want to watch issues and code review activities, the following page is a good start:
<https://gitlab.haskell.org/ghc/ghc/activity> <https://gitlab.haskell.org/ghc/ghc/activity>
......
...@@ -275,7 +275,7 @@ module GHC ( ...@@ -275,7 +275,7 @@ module GHC (
parser, parser,
-- * API Annotations -- * API Annotations
ApiAnns,AnnKeywordId(..),AnnotationComment(..), ApiAnns(..),AnnKeywordId(..),AnnotationComment(..),
getAnnotation, getAndRemoveAnnotation, getAnnotation, getAndRemoveAnnotation,
getAnnotationComments, getAndRemoveAnnotationComments, getAnnotationComments, getAndRemoveAnnotationComments,
unicodeAnn, unicodeAnn,
...@@ -288,7 +288,7 @@ module GHC ( ...@@ -288,7 +288,7 @@ module GHC (
{- {-
ToDo: ToDo:
* inline bits of HscMain here to simplify layering: hscTcExpr, hscStmt. * inline bits of GHC.Driver.Main here to simplify layering: hscTcExpr, hscStmt.
-} -}
#include "HsVersions.h" #include "HsVersions.h"
...@@ -302,15 +302,15 @@ import GHC.Runtime.Interpreter ...@@ -302,15 +302,15 @@ import GHC.Runtime.Interpreter
import GHCi.RemoteTypes import GHCi.RemoteTypes
import PprTyThing ( pprFamInst ) import PprTyThing ( pprFamInst )
import HscMain import GHC.Driver.Main
import GhcMake import GHC.Driver.Make
import DriverPipeline ( compileOne' ) import GHC.Driver.Pipeline ( compileOne' )
import GhcMonad import GHC.Driver.Monad
import TcRnMonad ( finalSafeMode, fixSafeInstances, initIfaceTcRn ) import TcRnMonad ( finalSafeMode, fixSafeInstances, initIfaceTcRn )
import GHC.Iface.Load ( loadSysInterface ) import GHC.Iface.Load ( loadSysInterface )
import TcRnTypes import TcRnTypes
import Predicate import Predicate
import Packages import GHC.Driver.Packages
import NameSet import NameSet
import RdrName import RdrName
import GHC.Hs import GHC.Hs
...@@ -329,11 +329,11 @@ import FamInstEnv ( FamInst ) ...@@ -329,11 +329,11 @@ import FamInstEnv ( FamInst )
import SrcLoc import SrcLoc
import CoreSyn import CoreSyn
import GHC.Iface.Tidy import GHC.Iface.Tidy
import DriverPhases ( Phase(..), isHaskellSrcFilename ) import GHC.Driver.Phases ( Phase(..), isHaskellSrcFilename )
import Finder import GHC.Driver.Finder
import HscTypes import GHC.Driver.Types
import CmdLineParser import GHC.Driver.CmdLine
import DynFlags hiding (WarnReason(..)) import GHC.Driver.Session hiding (WarnReason(..))
import SysTools import SysTools
import SysTools.BaseDir import SysTools.BaseDir
import Annotations import Annotations
...@@ -1364,7 +1364,7 @@ getModuleSourceAndFlags mod = do ...@@ -1364,7 +1364,7 @@ getModuleSourceAndFlags mod = do
-- | Return module source as token stream, including comments. -- | Return module source as token stream, including comments.
-- --
-- The module must be in the module graph and its source must be available. -- The module must be in the module graph and its source must be available.
-- Throws a 'HscTypes.SourceError' on parse error. -- Throws a 'GHC.Driver.Types.SourceError' on parse error.
getTokenStream :: GhcMonad m => Module -> m [Located Token] getTokenStream :: GhcMonad m => Module -> m [Located Token]
getTokenStream mod = do getTokenStream mod = do
(sourceFile, source, flags) <- getModuleSourceAndFlags mod (sourceFile, source, flags) <- getModuleSourceAndFlags mod
......
...@@ -23,7 +23,7 @@ import GHC.ByteCode.Types ...@@ -23,7 +23,7 @@ import GHC.ByteCode.Types
import GHCi.RemoteTypes import GHCi.RemoteTypes
import GHC.Runtime.Interpreter import GHC.Runtime.Interpreter
import HscTypes import GHC.Driver.Types
import Name import Name
import NameSet import NameSet
import Literal import Literal
...@@ -31,7 +31,7 @@ import TyCon ...@@ -31,7 +31,7 @@ import TyCon
import FastString import FastString
import GHC.StgToCmm.Layout ( ArgRep(..) ) import GHC.StgToCmm.Layout ( ArgRep(..) )
import GHC.Runtime.Heap.Layout import GHC.Runtime.Heap.Layout
import DynFlags import GHC.Driver.Session
import Outputable import Outputable
import GHC.Platform import GHC.Platform
import Util import Util
...@@ -101,7 +101,7 @@ assembleBCOs hsc_env proto_bcos tycons top_strs modbreaks = do ...@@ -101,7 +101,7 @@ assembleBCOs hsc_env proto_bcos tycons top_strs modbreaks = do
return CompiledByteCode return CompiledByteCode
{ bc_bcos = bcos' { bc_bcos = bcos'
, bc_itbls = itblenv , bc_itbls = itblenv
, bc_ffis = concat (map protoBCOFFIs proto_bcos) , bc_ffis = concatMap protoBCOFFIs proto_bcos
, bc_strs = top_strs ++ ptrs , bc_strs = top_strs ++ ptrs
, bc_breaks = modbreaks , bc_breaks = modbreaks
} }
......
...@@ -13,8 +13,8 @@ import GhcPrelude ...@@ -13,8 +13,8 @@ import GhcPrelude
import GHC.ByteCode.Types import GHC.ByteCode.Types
import GHC.Runtime.Interpreter import GHC.Runtime.Interpreter
import DynFlags import GHC.Driver.Session
import HscTypes import GHC.Driver.Types
import Name ( Name, getName ) import Name ( Name, getName )
import NameEnv import NameEnv
import DataCon ( DataCon, dataConRepArgTys, dataConIdentity ) import DataCon ( DataCon, dataConRepArgTys, dataConIdentity )
......
...@@ -27,7 +27,7 @@ import SizedSeq ...@@ -27,7 +27,7 @@ import SizedSeq
import GHC.Runtime.Interpreter import GHC.Runtime.Interpreter
import GHC.ByteCode.Types import GHC.ByteCode.Types
import HscTypes import GHC.Driver.Types
import Name import Name
import NameEnv import NameEnv
import PrimOp import PrimOp
......
...@@ -118,7 +118,7 @@ import GhcPrelude ...@@ -118,7 +118,7 @@ import GhcPrelude
import IdInfo import IdInfo
import BasicTypes import BasicTypes
import {-# SOURCE #-} GHC.Cmm.BlockId (BlockId, mkBlockId) import {-# SOURCE #-} GHC.Cmm.BlockId (BlockId, mkBlockId)
import Packages import GHC.Driver.Packages
import Module import Module
import Name import Name
import Unique import Unique
...@@ -126,7 +126,7 @@ import PrimOp ...@@ -126,7 +126,7 @@ import PrimOp
import CostCentre import CostCentre
import Outputable import Outputable
import FastString import FastString
import DynFlags import GHC.Driver.Session
import GHC.Platform import GHC.Platform
import UniqSet import UniqSet
import Util import Util
......
...@@ -12,7 +12,7 @@ import GHC.Runtime.Heap.Layout ...@@ -12,7 +12,7 @@ import GHC.Runtime.Heap.Layout
import GHC.Cmm (Convention(..)) import GHC.Cmm (Convention(..))
import GHC.Cmm.Ppr () -- For Outputable instances import GHC.Cmm.Ppr () -- For Outputable instances
import DynFlags import GHC.Driver.Session
import GHC.Platform import GHC.Platform
import Outputable import Outputable
......
...@@ -43,13 +43,14 @@ import Data.Array ...@@ -43,13 +43,14 @@ import Data.Array
import Data.Maybe import Data.Maybe
import Data.IntSet (IntSet) import Data.IntSet (IntSet)
import qualified Data.IntSet as IntSet import qualified Data.IntSet as IntSet
import Data.Kind (Type)
import GHC.Cmm.Dataflow.Block import GHC.Cmm.Dataflow.Block
import GHC.Cmm.Dataflow.Graph import GHC.Cmm.Dataflow.Graph
import GHC.Cmm.Dataflow.Collections import GHC.Cmm.Dataflow.Collections
import GHC.Cmm.Dataflow.Label import GHC.Cmm.Dataflow.Label
type family Fact (x :: Extensibility) f :: * type family Fact (x :: Extensibility) f :: Type
type instance Fact C f = FactBase f type instance Fact C f = FactBase f
type instance Fact O f = f type instance Fact O f = f
......
...@@ -27,11 +27,13 @@ import GHC.Cmm.Dataflow.Label ...@@ -27,11 +27,13 @@ import GHC.Cmm.Dataflow.Label
import GHC.Cmm.Dataflow.Block import GHC.Cmm.Dataflow.Block
import GHC.Cmm.Dataflow.Collections import GHC.Cmm.Dataflow.Collections
import Data.Kind
-- | A (possibly empty) collection of closed/closed blocks -- | A (possibly empty) collection of closed/closed blocks
type Body n = LabelMap (Block n C C) type Body n = LabelMap (Block n C C)
-- | @Body@ abstracted over @block@ -- | @Body@ abstracted over @block@
type Body' block (n :: Extensibility -> Extensibility -> *) = LabelMap (block n C C) type Body' block (n :: Extensibility -> Extensibility -> Type) = LabelMap (block n C C)
------------------------------- -------------------------------
-- | Gives access to the anchor points for -- | Gives access to the anchor points for
...@@ -76,7 +78,7 @@ type Graph = Graph' Block ...@@ -76,7 +78,7 @@ type Graph = Graph' Block
-- | @Graph'@ is abstracted over the block type, so that we can build -- | @Graph'@ is abstracted over the block type, so that we can build
-- graphs of annotated blocks for example (Compiler.Hoopl.Dataflow -- graphs of annotated blocks for example (Compiler.Hoopl.Dataflow
-- needs this). -- needs this).
data Graph' block (n :: Extensibility -> Extensibility -> *) e x where data Graph' block (n :: Extensibility -> Extensibility -> Type) e x where
GNil :: Graph' block n O O GNil :: Graph' block n O O
GUnit :: block n O O -> Graph' block n O O GUnit :: block n O O -> Graph' block n O O
GMany :: MaybeO e (block n O C) GMany :: MaybeO e (block n O C)
......
...@@ -36,7 +36,7 @@ import GHC.Cmm.BlockId ...@@ -36,7 +36,7 @@ import GHC.Cmm.BlockId
import GHC.Cmm.CLabel import GHC.Cmm.CLabel
import GHC.Cmm.MachOp import GHC.Cmm.MachOp
import GHC.Cmm.Type import GHC.Cmm.Type
import DynFlags import GHC.Driver.Session
import Outputable (panic) import Outputable (panic)
import Unique import Unique
......
...@@ -31,7 +31,7 @@ import GHC.Cmm.Switch (SwitchTargets) ...@@ -31,7 +31,7 @@ import GHC.Cmm.Switch (SwitchTargets)
import GHC.Cmm.Dataflow.Block import GHC.Cmm.Dataflow.Block
import GHC.Cmm.Dataflow.Graph import GHC.Cmm.Dataflow.Graph
import GHC.Cmm.Dataflow.Label import GHC.Cmm.Dataflow.Label
import DynFlags import GHC.Driver.Session
import FastString import FastString
import ForeignCall import ForeignCall
import OrdList import OrdList
......
...@@ -46,7 +46,7 @@ import GHC.Cmm.Dataflow.Collections ...@@ -46,7 +46,7 @@ import GHC.Cmm.Dataflow.Collections
import GHC.Platform import GHC.Platform
import Maybes import Maybes
import DynFlags import GHC.Driver.Session
import ErrUtils (withTimingSilent) import ErrUtils (withTimingSilent)
import Panic import Panic
import UniqSupply import UniqSupply
......
...@@ -24,7 +24,7 @@ import Digraph ...@@ -24,7 +24,7 @@ import Digraph
import GHC.Cmm.CLabel import GHC.Cmm.CLabel
import GHC.Cmm import GHC.Cmm
import GHC.Cmm.Utils import GHC.Cmm.Utils
import DynFlags import GHC.Driver.Session
import Maybes import Maybes
import Outputable import Outputable
import GHC.Runtime.Heap.Layout import GHC.Runtime.Heap.Layout
......
...@@ -29,7 +29,7 @@ import Maybes ...@@ -29,7 +29,7 @@ import Maybes
import UniqFM import UniqFM
import Util import Util
import DynFlags import GHC.Driver.Session
import FastString import FastString
import Outputable hiding ( isEmpty ) import Outputable hiding ( isEmpty )
import qualified Data.Set as Set import qualified Data.Set as Set
......
...@@ -23,7 +23,7 @@ import GHC.Cmm.Liveness ...@@ -23,7 +23,7 @@ import GHC.Cmm.Liveness
import GHC.Cmm.Switch (switchTargetsToList) import GHC.Cmm.Switch (switchTargetsToList)
import GHC.Cmm.Ppr () -- For Outputable instances import GHC.Cmm.Ppr () -- For Outputable instances
import Outputable import Outputable
import DynFlags import GHC.Driver.Session
import Control.Monad (ap) import Control.Monad (ap)
......
...@@ -14,7 +14,7 @@ where ...@@ -14,7 +14,7 @@ where
import GhcPrelude import GhcPrelude
import DynFlags import GHC.Driver.Session
import GHC.Cmm.BlockId import GHC.Cmm.BlockId
import GHC.Cmm import GHC.Cmm
import GHC.Cmm.Ppr.Expr () -- For Outputable instances import GHC.Cmm.Ppr.Expr () -- For Outputable instances
......
...@@ -32,7 +32,7 @@ import GhcPrelude ...@@ -32,7 +32,7 @@ import GhcPrelude
import GHC.Cmm.Type import GHC.Cmm.Type
import Outputable import Outputable
import DynFlags import GHC.Driver.Session
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
-- MachOp -- MachOp
......
...@@ -17,7 +17,7 @@ import GhcPrelude ...@@ -17,7 +17,7 @@ import GhcPrelude
import Control.Monad import Control.Monad
import DynFlags import GHC.Driver.Session
import Lexer import Lexer
newtype PD a = PD { unPD :: DynFlags -> PState -> ParseResult a } newtype PD a = PD { unPD :: DynFlags -> PState -> ParseResult a }
......
...@@ -31,7 +31,7 @@ import GhcPrelude hiding (succ) ...@@ -31,7 +31,7 @@ import GhcPrelude hiding (succ)
import GHC.Platform.Regs import GHC.Platform.Regs
import GHC.Cmm.Expr import GHC.Cmm.Expr
import GHC.Cmm.Switch import GHC.Cmm.Switch
import DynFlags import GHC.Driver.Session
import FastString import FastString
import ForeignCall import ForeignCall
import Outputable import Outputable
......
...@@ -17,7 +17,7 @@ import GhcPrelude ...@@ -17,7 +17,7 @@ import GhcPrelude
import GHC.Cmm.Utils import GHC.Cmm.Utils
import GHC.Cmm import GHC.Cmm
import DynFlags import GHC.Driver.Session
import Util import Util
import Outputable import Outputable
......
...@@ -242,7 +242,7 @@ import Literal ...@@ -242,7 +242,7 @@ import Literal
import Unique import Unique
import UniqFM import UniqFM
import SrcLoc import SrcLoc
import DynFlags import GHC.Driver.Session
import ErrUtils import ErrUtils
import StringBuffer import StringBuffer
import FastString import FastString
......
...@@ -23,9 +23,9 @@ import GHC.Cmm.Sink ...@@ -23,9 +23,9 @@ import GHC.Cmm.Sink
import GHC.Cmm.Dataflow.Collections import GHC.Cmm.Dataflow.Collections
import UniqSupply import UniqSupply
import DynFlags import GHC.Driver.Session
import ErrUtils import ErrUtils
import HscTypes import GHC.Driver.Types
import Control.Monad import Control.Monad
import Outputable import Outputable
import GHC.Platform import GHC.Platform
......
{-# LANGUAGE GADTs, TypeFamilies, FlexibleContexts, FlexibleInstances #-} {-# LANGUAGE GADTs, TypeFamilies, FlexibleContexts, FlexibleInstances #-}
{-# LANGUAGE LambdaCase #-}
{-# OPTIONS_GHC -fno-warn-orphans #-} {-# OPTIONS_GHC -fno-warn-orphans #-}
---------------------------------------------------------------------------- ----------------------------------------------------------------------------
...@@ -45,7 +46,6 @@ import GHC.Cmm.CLabel ...@@ -45,7 +46,6 @@ import GHC.Cmm.CLabel
import GHC.Cmm import GHC.Cmm
import GHC.Cmm.Utils import GHC.Cmm.Utils
import GHC.Cmm.Switch import GHC.Cmm.Switch
import DynFlags
import FastString import FastString
import Outputable import Outputable
import GHC.Cmm.Ppr.Decl import GHC.Cmm.Ppr.Decl
...@@ -181,22 +181,22 @@ pprNode :: CmmNode e x -> SDoc ...@@ -181,22 +181,22 @@ pprNode :: CmmNode e x -> SDoc
pprNode node = pp_node <+> pp_debug pprNode node = pp_node <+> pp_debug
where where
pp_node :: SDoc pp_node :: SDoc
pp_node = sdocWithDynFlags $ \dflags -> case node of pp_node = case node of
-- label: -- label:
CmmEntry id tscope -> lbl <> colon <+> CmmEntry id tscope ->
(sdocWithDynFlags $ \dflags -> (sdocOption sdocSuppressUniques $ \case
ppUnless (gopt Opt_SuppressTicks dflags) (text "//" <+> ppr tscope)) True -> text "_lbl_"
where False -> ppr id
lbl = if gopt Opt_SuppressUniques dflags )
then text "_lbl_" <> colon
else ppr id <+> ppUnlessOption sdocSuppressTicks (text "//" <+> ppr tscope)
-- // text -- // text
CmmComment s -> text "//" <+> ftext s CmmComment s -> text "//" <+> ftext s
-- //tick bla<...> -- //tick bla<...>
CmmTick t -> ppUnless (gopt Opt_SuppressTicks dflags) $ CmmTick t -> ppUnlessOption sdocSuppressTicks
text "//tick" <+> ppr t (text "//tick" <+> ppr t)
-- unwind reg = expr; -- unwind reg = expr;
CmmUnwind regs -> CmmUnwind regs ->
......
...@@ -43,7 +43,7 @@ import GhcPrelude ...@@ -43,7 +43,7 @@ import GhcPrelude
import GHC.Cmm.Ppr.Expr import GHC.Cmm.Ppr.Expr
import GHC.Cmm import GHC.Cmm
import DynFlags import GHC.Driver.Session
import Outputable import Outputable
import FastString import FastString
......
...@@ -31,8 +31,9 @@ ...@@ -31,8 +31,9 @@
-- --
-- A useful example pass over Cmm is in nativeGen/MachCodeGen.hs -- A useful example pass over Cmm is in nativeGen/MachCodeGen.hs
-- --
{-# LANGUAGE LambdaCase #-}
{-# OPTIONS_GHC -fno-warn-orphans #-} {-# OPTIONS_GHC -fno-warn-orphans #-}
module GHC.Cmm.Ppr.Expr module GHC.Cmm.Ppr.Expr
( pprExpr, pprLit ( pprExpr, pprLit
) )
...@@ -43,7 +44,6 @@ import GhcPrelude ...@@ -43,7 +44,6 @@ import GhcPrelude
import GHC.Cmm.Expr import GHC.Cmm.Expr
import Outputable import Outputable
import DynFlags
import Data.Maybe import Data.Maybe
import Numeric ( fromRat ) import Numeric ( fromRat )
...@@ -227,18 +227,17 @@ pprReg r ...@@ -227,18 +227,17 @@ pprReg r
-- We only print the type of the local reg if it isn't wordRep -- We only print the type of the local reg if it isn't wordRep
-- --
pprLocalReg :: LocalReg -> SDoc pprLocalReg :: LocalReg -> SDoc
pprLocalReg (LocalReg uniq rep) = sdocWithDynFlags $ \dflags -> pprLocalReg (LocalReg uniq rep) =
-- = ppr rep <> char '_' <> ppr uniq -- = ppr rep <> char '_' <> ppr uniq
-- Temp Jan08 -- Temp Jan08
char '_' <> pprUnique dflags uniq <> char '_' <> pprUnique uniq <>
(if isWord32 rep -- && not (isGcPtrType rep) -- Temp Jan08 -- sigh (if isWord32 rep -- && not (isGcPtrType rep) -- Temp Jan08 -- sigh
then dcolon <> ptr <> ppr rep then dcolon <> ptr <> ppr rep
else dcolon <> ptr <> ppr rep) else dcolon <> ptr <> ppr rep)
where where
pprUnique dflags unique = pprUnique unique = sdocOption sdocSuppressUniques $ \case
if gopt Opt_SuppressUniques dflags True -> text "_locVar_"
then text "_locVar_" False -> ppr unique
else ppr unique
ptr = empty ptr = empty
--if isGcPtrType rep --if isGcPtrType rep
-- then doubleQuotes (text "ptr") -- then doubleQuotes (text "ptr")
......
...@@ -11,7 +11,7 @@ where ...@@ -11,7 +11,7 @@ where
import GhcPrelude hiding (last, unzip, succ, zip) import GhcPrelude hiding (last, unzip, succ, zip)
import DynFlags import GHC.Driver.Session
import GHC.Cmm.BlockId import GHC.Cmm.BlockId
import GHC.Cmm.CLabel import GHC.Cmm.CLabel
import GHC.Cmm import GHC.Cmm
......
...@@ -16,7 +16,7 @@ import GHC.Cmm.Dataflow.Graph ...@@ -16,7 +16,7 @@ import GHC.Cmm.Dataflow.Graph
import GHC.Platform.Regs import GHC.Platform.Regs
import GHC.Platform (isARM, platformArch) import GHC.Platform (isARM, platformArch)
import DynFlags import GHC.Driver.Session
import Unique import Unique
import UniqFM import UniqFM
......
...@@ -15,7 +15,7 @@ module GHC.Cmm.Switch ( ...@@ -15,7 +15,7 @@ module GHC.Cmm.Switch (
import GhcPrelude import GhcPrelude
import Outputable import Outputable
import DynFlags import GHC.Driver.Session
import GHC.Cmm.Dataflow.Label (Label) import GHC.Cmm.Dataflow.Label (Label)
import Data.Maybe import Data.Maybe
......
...@@ -12,7 +12,8 @@ import GHC.Cmm ...@@ -12,7 +12,8 @@ import GHC.Cmm
import GHC.Cmm.Utils import GHC.Cmm.Utils
import GHC.Cmm.Switch import GHC.Cmm.Switch
import UniqSupply import UniqSupply
import DynFlags import GHC.Driver.Session
import MonadUtils (concatMapM)
-- --
-- This module replaces Switch statements as generated by the Stg -> Cmm -- This module replaces Switch statements as generated by the Stg -> Cmm
...@@ -35,7 +36,7 @@ cmmImplementSwitchPlans dflags g ...@@ -35,7 +36,7 @@ cmmImplementSwitchPlans dflags g
-- Switch generation done by backend (LLVM/C) -- Switch generation done by backend (LLVM/C)
| targetSupportsSwitch (hscTarget dflags) = return g | targetSupportsSwitch (hscTarget dflags) = return g
| otherwise = do | otherwise = do
blocks' <- concat `fmap` mapM (visitSwitches dflags) (toBlockList g) blocks' <- concatMapM (visitSwitches dflags) (toBlockList g)
return $ ofBlockList (g_entry g) blocks' return $ ofBlockList (g_entry g) blocks'
visitSwitches :: DynFlags -> CmmBlock -> UniqSM [CmmBlock] visitSwitches :: DynFlags -> CmmBlock -> UniqSM [CmmBlock]
......
...@@ -31,7 +31,7 @@ where ...@@ -31,7 +31,7 @@ where
import GhcPrelude import GhcPrelude
import DynFlags import GHC.Driver.Session
import FastString import FastString
import Outputable import Outputable
......
...@@ -80,7 +80,7 @@ import GHC.Cmm ...@@ -80,7 +80,7 @@ import GHC.Cmm
import GHC.Cmm.BlockId import GHC.Cmm.BlockId
import GHC.Cmm.CLabel import GHC.Cmm.CLabel
import Outputable import Outputable
import DynFlags import GHC.Driver.Session
import Unique import Unique
import GHC.Platform.Regs import GHC.Platform.Regs
......
...@@ -40,7 +40,7 @@ import GHC.Cmm.Switch ...@@ -40,7 +40,7 @@ import GHC.Cmm.Switch
-- Utils -- Utils
import CPrim import CPrim
import DynFlags import GHC.Driver.Session
import FastString import FastString
import Outputable import Outputable
import GHC.Platform import GHC.Platform
......
...@@ -29,7 +29,7 @@ import GHC.Cmm.Dataflow.Collections ...@@ -29,7 +29,7 @@ import GHC.Cmm.Dataflow.Collections
import GHC.Cmm.Ppr import GHC.Cmm.Ppr
import BufWrite import BufWrite
import DynFlags import GHC.Driver.Session
import GHC.Platform ( platformArch, Arch(..) ) import GHC.Platform ( platformArch, Arch(..) )
import ErrUtils import ErrUtils
import FastString import FastString
......
...@@ -48,7 +48,7 @@ import GHC.CmmToLlvm.Regs ...@@ -48,7 +48,7 @@ import GHC.CmmToLlvm.Regs
import GHC.Cmm.CLabel import GHC.Cmm.CLabel
import GHC.Platform.Regs ( activeStgRegs ) import GHC.Platform.Regs ( activeStgRegs )
import DynFlags import GHC.Driver.Session
import FastString import FastString
import GHC.Cmm hiding ( succ ) import GHC.Cmm hiding ( succ )
import GHC.Cmm.Utils (regsOverlap) import GHC.Cmm.Utils (regsOverlap)
...@@ -506,7 +506,9 @@ strCLabel_llvm :: CLabel -> LlvmM LMString ...@@ -506,7 +506,9 @@ strCLabel_llvm :: CLabel -> LlvmM LMString
strCLabel_llvm lbl = do strCLabel_llvm lbl = do
dflags <- getDynFlags dflags <- getDynFlags
let sdoc = pprCLabel dflags lbl let sdoc = pprCLabel dflags lbl
str = Outp.renderWithStyle dflags sdoc (Outp.mkCodeStyle Outp.CStyle) str = Outp.renderWithStyle
(initSDocContext dflags (Outp.mkCodeStyle Outp.CStyle))
sdoc
return (fsLit str) return (fsLit str)
strDisplayName_llvm :: CLabel -> LlvmM LMString strDisplayName_llvm :: CLabel -> LlvmM LMString
...@@ -515,7 +517,7 @@ strDisplayName_llvm lbl = do ...@@ -515,7 +517,7 @@ strDisplayName_llvm lbl = do
let sdoc = pprCLabel dflags lbl let sdoc = pprCLabel dflags lbl
depth = Outp.PartWay 1 depth = Outp.PartWay 1
style = Outp.mkUserStyle dflags Outp.reallyAlwaysQualify depth style = Outp.mkUserStyle dflags Outp.reallyAlwaysQualify depth
str = Outp.renderWithStyle dflags sdoc style str = Outp.renderWithStyle (initSDocContext dflags style) sdoc
return (fsLit (dropInfoSuffix str)) return (fsLit (dropInfoSuffix str))
dropInfoSuffix :: String -> String dropInfoSuffix :: String -> String
...@@ -532,7 +534,7 @@ strProcedureName_llvm lbl = do ...@@ -532,7 +534,7 @@ strProcedureName_llvm lbl = do
let sdoc = pprCLabel dflags lbl let sdoc = pprCLabel dflags lbl
depth = Outp.PartWay 1 depth = Outp.PartWay 1
style = Outp.mkUserStyle dflags Outp.neverQualify depth style = Outp.mkUserStyle dflags Outp.neverQualify depth
str = Outp.renderWithStyle dflags sdoc style str = Outp.renderWithStyle (initSDocContext dflags style) sdoc
return (fsLit str) return (fsLit str)
-- ---------------------------------------------------------------------------- -- ----------------------------------------------------------------------------
......
...@@ -25,7 +25,7 @@ import GHC.Cmm.Dataflow.Block ...@@ -25,7 +25,7 @@ import GHC.Cmm.Dataflow.Block
import GHC.Cmm.Dataflow.Graph import GHC.Cmm.Dataflow.Graph
import GHC.Cmm.Dataflow.Collections import GHC.Cmm.Dataflow.Collections
import DynFlags import GHC.Driver.Session
import FastString import FastString
import ForeignCall import ForeignCall
import Outputable hiding (panic, pprPanic) import Outputable hiding (panic, pprPanic)
...@@ -1505,7 +1505,7 @@ genMachOp_slow opt op [x, y] = case op of ...@@ -1505,7 +1505,7 @@ genMachOp_slow opt op [x, y] = case op of
-- Error. Continue anyway so we can debug the generated ll file. -- Error. Continue anyway so we can debug the generated ll file.
dflags <- getDynFlags dflags <- getDynFlags
let style = mkCodeStyle CStyle let style = mkCodeStyle CStyle
toString doc = renderWithStyle dflags doc style toString doc = renderWithStyle (initSDocContext dflags style) doc
cmmToStr = (lines . toString . PprCmm.pprExpr) cmmToStr = (lines . toString . PprCmm.pprExpr)
statement $ Comment $ map fsLit $ cmmToStr x statement $ Comment $ map fsLit $ cmmToStr x
statement $ Comment $ map fsLit $ cmmToStr y statement $ Comment $ map fsLit $ cmmToStr y
......
...@@ -17,7 +17,7 @@ import GHC.CmmToLlvm.Base ...@@ -17,7 +17,7 @@ import GHC.CmmToLlvm.Base
import GHC.Cmm.BlockId import GHC.Cmm.BlockId
import GHC.Cmm.CLabel import GHC.Cmm.CLabel
import GHC.Cmm import GHC.Cmm
import DynFlags import GHC.Driver.Session
import GHC.Platform import GHC.Platform
import FastString import FastString
......
...@@ -13,7 +13,7 @@ module GHC.CmmToLlvm.Mangler ( llvmFixupAsm ) where ...@@ -13,7 +13,7 @@ module GHC.CmmToLlvm.Mangler ( llvmFixupAsm ) where
import GhcPrelude import GhcPrelude
import DynFlags ( DynFlags, targetPlatform ) import GHC.Driver.Session ( DynFlags, targetPlatform )
import GHC.Platform ( platformArch, Arch(..) ) import GHC.Platform ( platformArch, Arch(..) )
import ErrUtils ( withTiming ) import ErrUtils ( withTiming )
import Outputable ( text ) import Outputable ( text )
......
...@@ -16,7 +16,7 @@ import GhcPrelude ...@@ -16,7 +16,7 @@ import GhcPrelude
import GHC.Llvm import GHC.Llvm
import GHC.Cmm.Expr import GHC.Cmm.Expr
import DynFlags import GHC.Driver.Session
import FastString import FastString
import Outputable ( panic ) import Outputable ( panic )
import Unique import Unique
......
...@@ -22,7 +22,7 @@ import GHC.Runtime.Interpreter ...@@ -22,7 +22,7 @@ import GHC.Runtime.Interpreter
import GHCi.FFI import GHCi.FFI
import GHCi.RemoteTypes import GHCi.RemoteTypes
import BasicTypes import BasicTypes
import DynFlags import GHC.Driver.Session
import Outputable import Outputable
import GHC.Platform import GHC.Platform
import Name import Name
...@@ -30,7 +30,7 @@ import MkId ...@@ -30,7 +30,7 @@ import MkId
import Id import Id
import Var ( updateVarType ) import Var ( updateVarType )
import ForeignCall import ForeignCall
import HscTypes import GHC.Driver.Types
import CoreUtils import CoreUtils
import CoreSyn import CoreSyn
import PprCore import PprCore
...@@ -56,6 +56,7 @@ import GHC.Data.Bitmap ...@@ -56,6 +56,7 @@ import GHC.Data.Bitmap
import OrdList import OrdList
import Maybes import Maybes
import VarEnv import VarEnv
import PrelNames ( unsafeEqualityProofName )
import Data.List import Data.List
import Foreign import Foreign
...@@ -634,11 +635,12 @@ schemeE d s p exp@(AnnTick (Breakpoint _id _fvs) _rhs) ...@@ -634,11 +635,12 @@ schemeE d s p exp@(AnnTick (Breakpoint _id _fvs) _rhs)
-- ignore other kinds of tick -- ignore other kinds of tick
schemeE d s p (AnnTick _ (_, rhs)) = schemeE d s p rhs schemeE d s p (AnnTick _ (_, rhs)) = schemeE d s p rhs
-- no alts: scrut is guaranteed to diverge
schemeE d s p (AnnCase (_,scrut) _ _ []) = schemeE d s p scrut schemeE d s p (AnnCase (_,scrut) _ _ []) = schemeE d s p scrut
-- no alts: scrut is guaranteed to diverge
-- handle pairs with one void argument (e.g. state token)
schemeE d s p (AnnCase scrut bndr _ [(DataAlt dc, [bind1, bind2], rhs)]) schemeE d s p (AnnCase scrut bndr _ [(DataAlt dc, [bind1, bind2], rhs)])
| isUnboxedTupleCon dc -- handles pairs with one void argument (e.g. state token) | isUnboxedTupleCon dc
-- Convert -- Convert
-- case .... of x { (# V'd-thing, a #) -> ... } -- case .... of x { (# V'd-thing, a #) -> ... }
-- to -- to
...@@ -655,11 +657,13 @@ schemeE d s p (AnnCase scrut bndr _ [(DataAlt dc, [bind1, bind2], rhs)]) ...@@ -655,11 +657,13 @@ schemeE d s p (AnnCase scrut bndr _ [(DataAlt dc, [bind1, bind2], rhs)])
_ -> Nothing _ -> Nothing
= res = res
-- handle unit tuples
schemeE d s p (AnnCase scrut bndr _ [(DataAlt dc, [bind1], rhs)]) schemeE d s p (AnnCase scrut bndr _ [(DataAlt dc, [bind1], rhs)])
| isUnboxedTupleCon dc | isUnboxedTupleCon dc
, typePrimRep (idType bndr) `lengthAtMost` 1 -- handles unit tuples , typePrimRep (idType bndr) `lengthAtMost` 1
= doCase d s p scrut bind1 [(DEFAULT, [], rhs)] (Just bndr) = doCase d s p scrut bind1 [(DEFAULT, [], rhs)] (Just bndr)
-- handle nullary tuples
schemeE d s p (AnnCase scrut bndr _ alt@[(DEFAULT, [], _)]) schemeE d s p (AnnCase scrut bndr _ alt@[(DEFAULT, [], _)])
| isUnboxedTupleType (idType bndr) | isUnboxedTupleType (idType bndr)
, Just ty <- case typePrimRep (idType bndr) of , Just ty <- case typePrimRep (idType bndr) of
...@@ -983,6 +987,7 @@ doCase ...@@ -983,6 +987,7 @@ doCase
doCase d s p (_,scrut) bndr alts is_unboxed_tuple doCase d s p (_,scrut) bndr alts is_unboxed_tuple
| typePrimRep (idType bndr) `lengthExceeds` 1 | typePrimRep (idType bndr) `lengthExceeds` 1
= multiValException = multiValException
| otherwise | otherwise
= do = do
dflags <- getDynFlags dflags <- getDynFlags
...@@ -1111,7 +1116,7 @@ doCase d s p (_,scrut) bndr alts is_unboxed_tuple ...@@ -1111,7 +1116,7 @@ doCase d s p (_,scrut) bndr alts is_unboxed_tuple
binds = Map.toList p binds = Map.toList p
-- NB: unboxed tuple cases bind the scrut binder to the same offset -- NB: unboxed tuple cases bind the scrut binder to the same offset
-- as one of the alt binders, so we have to remove any duplicates here: -- as one of the alt binders, so we have to remove any duplicates here:
rel_slots = nub $ map fromIntegral $ concat (map spread binds) rel_slots = nub $ map fromIntegral $ concatMap spread binds
spread (id, offset) | isFollowableArg (bcIdArgRep id) = [ rel_offset ] spread (id, offset) | i