...
 
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
    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
    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:
BUILD_SPHINX_PDF: "YES"
TEST_TYPE: slowtest
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:
when: always
expire_in: 2 week
......@@ -858,7 +858,7 @@ nightly-i386-windows-hadrian:
junit: junit.xml
paths:
# 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"
- junit.xml
......
......@@ -151,7 +151,8 @@ function set_toolchain_paths() {
function setup() {
if [ -d "$TOP/cabal-cache" ]; then
info "Extracting cabal cache..."
cp -Rf cabal-cache "$cabal_dir"
mkdir -p "$cabal_dir"
cp -Rf cabal-cache/* "$cabal_dir"
fi
if [[ -n "$needs_toolchain" ]]; then
......
......@@ -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
likely should add a [Note][notes] and cross-reference it from the relevant
places.
* [ ] add a [testcase to the
testsuite](https://gitlab.haskell.org/ghc/ghc/wikis/building/running-tests/adding).
* [ ] add a [testcase to the testsuite](https://gitlab.haskell.org/ghc/ghc/wikis/building/running-tests/adding).
* [ ] if your MR affects library interfaces (e.g. changes `base`) please add
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
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:
<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
page, which has the high level overview of the build process and how
to get the source:
......@@ -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.
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
......@@ -50,7 +50,7 @@ $ ... double-check mk/build.mk ...
```
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
......@@ -62,15 +62,15 @@ newly built compiler.
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
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.
The GHC Wiki has a good summary for the [overall process](https://gitlab.haskell.org/ghc/ghc/wikis/working-conventions/fixing-bugs).
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.
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:
=============
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:
<https://gitlab.haskell.org/ghc/ghc/wikis/contributing>
......@@ -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
[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:
<https://gitlab.haskell.org/ghc/ghc/activity>
......
......@@ -275,7 +275,7 @@ module GHC (
parser,
-- * API Annotations
ApiAnns,AnnKeywordId(..),AnnotationComment(..),
ApiAnns(..),AnnKeywordId(..),AnnotationComment(..),
getAnnotation, getAndRemoveAnnotation,
getAnnotationComments, getAndRemoveAnnotationComments,
unicodeAnn,
......@@ -288,7 +288,7 @@ module GHC (
{-
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"
......@@ -302,15 +302,15 @@ import GHC.Runtime.Interpreter
import GHCi.RemoteTypes
import PprTyThing ( pprFamInst )
import HscMain
import GhcMake
import DriverPipeline ( compileOne' )
import GhcMonad
import GHC.Driver.Main
import GHC.Driver.Make
import GHC.Driver.Pipeline ( compileOne' )
import GHC.Driver.Monad
import TcRnMonad ( finalSafeMode, fixSafeInstances, initIfaceTcRn )
import GHC.Iface.Load ( loadSysInterface )
import TcRnTypes
import Predicate
import Packages
import GHC.Driver.Packages
import NameSet
import RdrName
import GHC.Hs
......@@ -329,11 +329,11 @@ import FamInstEnv ( FamInst )
import SrcLoc
import CoreSyn
import GHC.Iface.Tidy
import DriverPhases ( Phase(..), isHaskellSrcFilename )
import Finder
import HscTypes
import CmdLineParser
import DynFlags hiding (WarnReason(..))
import GHC.Driver.Phases ( Phase(..), isHaskellSrcFilename )
import GHC.Driver.Finder
import GHC.Driver.Types
import GHC.Driver.CmdLine
import GHC.Driver.Session hiding (WarnReason(..))
import SysTools
import SysTools.BaseDir
import Annotations
......@@ -1364,7 +1364,7 @@ getModuleSourceAndFlags mod = do
-- | Return module source as token stream, including comments.
--
-- 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 mod = do
(sourceFile, source, flags) <- getModuleSourceAndFlags mod
......
......@@ -23,7 +23,7 @@ import GHC.ByteCode.Types
import GHCi.RemoteTypes
import GHC.Runtime.Interpreter
import HscTypes
import GHC.Driver.Types
import Name
import NameSet
import Literal
......@@ -31,7 +31,7 @@ import TyCon
import FastString
import GHC.StgToCmm.Layout ( ArgRep(..) )
import GHC.Runtime.Heap.Layout
import DynFlags
import GHC.Driver.Session
import Outputable
import GHC.Platform
import Util
......@@ -101,7 +101,7 @@ assembleBCOs hsc_env proto_bcos tycons top_strs modbreaks = do
return CompiledByteCode
{ bc_bcos = bcos'
, bc_itbls = itblenv
, bc_ffis = concat (map protoBCOFFIs proto_bcos)
, bc_ffis = concatMap protoBCOFFIs proto_bcos
, bc_strs = top_strs ++ ptrs
, bc_breaks = modbreaks
}
......
......@@ -13,8 +13,8 @@ import GhcPrelude
import GHC.ByteCode.Types
import GHC.Runtime.Interpreter
import DynFlags
import HscTypes
import GHC.Driver.Session
import GHC.Driver.Types
import Name ( Name, getName )
import NameEnv
import DataCon ( DataCon, dataConRepArgTys, dataConIdentity )
......
......@@ -27,7 +27,7 @@ import SizedSeq
import GHC.Runtime.Interpreter
import GHC.ByteCode.Types
import HscTypes
import GHC.Driver.Types
import Name
import NameEnv
import PrimOp
......
......@@ -118,7 +118,7 @@ import GhcPrelude
import IdInfo
import BasicTypes
import {-# SOURCE #-} GHC.Cmm.BlockId (BlockId, mkBlockId)
import Packages
import GHC.Driver.Packages
import Module
import Name
import Unique
......@@ -126,7 +126,7 @@ import PrimOp
import CostCentre
import Outputable
import FastString
import DynFlags
import GHC.Driver.Session
import GHC.Platform
import UniqSet
import Util
......
......@@ -12,7 +12,7 @@ import GHC.Runtime.Heap.Layout
import GHC.Cmm (Convention(..))
import GHC.Cmm.Ppr () -- For Outputable instances
import DynFlags
import GHC.Driver.Session
import GHC.Platform
import Outputable
......
......@@ -43,13 +43,14 @@ import Data.Array
import Data.Maybe
import Data.IntSet (IntSet)
import qualified Data.IntSet as IntSet
import Data.Kind (Type)
import GHC.Cmm.Dataflow.Block
import GHC.Cmm.Dataflow.Graph
import GHC.Cmm.Dataflow.Collections
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 O f = f
......
......@@ -27,11 +27,13 @@ import GHC.Cmm.Dataflow.Label
import GHC.Cmm.Dataflow.Block
import GHC.Cmm.Dataflow.Collections
import Data.Kind
-- | A (possibly empty) collection of closed/closed blocks
type Body n = LabelMap (Block n C C)
-- | @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
......@@ -76,7 +78,7 @@ type Graph = Graph' Block
-- | @Graph'@ is abstracted over the block type, so that we can build
-- graphs of annotated blocks for example (Compiler.Hoopl.Dataflow
-- 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
GUnit :: block n O O -> Graph' block n O O
GMany :: MaybeO e (block n O C)
......
......@@ -36,7 +36,7 @@ import GHC.Cmm.BlockId
import GHC.Cmm.CLabel
import GHC.Cmm.MachOp
import GHC.Cmm.Type
import DynFlags
import GHC.Driver.Session
import Outputable (panic)
import Unique
......
......@@ -31,7 +31,7 @@ import GHC.Cmm.Switch (SwitchTargets)
import GHC.Cmm.Dataflow.Block
import GHC.Cmm.Dataflow.Graph
import GHC.Cmm.Dataflow.Label
import DynFlags
import GHC.Driver.Session
import FastString
import ForeignCall
import OrdList
......
......@@ -46,7 +46,7 @@ import GHC.Cmm.Dataflow.Collections
import GHC.Platform
import Maybes
import DynFlags
import GHC.Driver.Session
import ErrUtils (withTimingSilent)
import Panic
import UniqSupply
......
......@@ -24,7 +24,7 @@ import Digraph
import GHC.Cmm.CLabel
import GHC.Cmm
import GHC.Cmm.Utils
import DynFlags
import GHC.Driver.Session
import Maybes
import Outputable
import GHC.Runtime.Heap.Layout
......
......@@ -29,7 +29,7 @@ import Maybes
import UniqFM
import Util
import DynFlags
import GHC.Driver.Session
import FastString
import Outputable hiding ( isEmpty )
import qualified Data.Set as Set
......
......@@ -23,7 +23,7 @@ import GHC.Cmm.Liveness
import GHC.Cmm.Switch (switchTargetsToList)
import GHC.Cmm.Ppr () -- For Outputable instances
import Outputable
import DynFlags
import GHC.Driver.Session
import Control.Monad (ap)
......
......@@ -14,7 +14,7 @@ where
import GhcPrelude
import DynFlags
import GHC.Driver.Session
import GHC.Cmm.BlockId
import GHC.Cmm
import GHC.Cmm.Ppr.Expr () -- For Outputable instances
......
......@@ -32,7 +32,7 @@ import GhcPrelude
import GHC.Cmm.Type
import Outputable
import DynFlags
import GHC.Driver.Session
-----------------------------------------------------------------------------
-- MachOp
......
......@@ -17,7 +17,7 @@ import GhcPrelude
import Control.Monad
import DynFlags
import GHC.Driver.Session
import Lexer
newtype PD a = PD { unPD :: DynFlags -> PState -> ParseResult a }
......
......@@ -31,7 +31,7 @@ import GhcPrelude hiding (succ)
import GHC.Platform.Regs
import GHC.Cmm.Expr
import GHC.Cmm.Switch
import DynFlags
import GHC.Driver.Session
import FastString
import ForeignCall
import Outputable
......
......@@ -17,7 +17,7 @@ import GhcPrelude
import GHC.Cmm.Utils
import GHC.Cmm
import DynFlags
import GHC.Driver.Session
import Util
import Outputable
......
......@@ -242,7 +242,7 @@ import Literal
import Unique
import UniqFM
import SrcLoc
import DynFlags
import GHC.Driver.Session
import ErrUtils
import StringBuffer
import FastString
......
......@@ -23,9 +23,9 @@ import GHC.Cmm.Sink
import GHC.Cmm.Dataflow.Collections
import UniqSupply
import DynFlags
import GHC.Driver.Session
import ErrUtils
import HscTypes
import GHC.Driver.Types
import Control.Monad
import Outputable
import GHC.Platform
......
{-# LANGUAGE GADTs, TypeFamilies, FlexibleContexts, FlexibleInstances #-}
{-# LANGUAGE LambdaCase #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
----------------------------------------------------------------------------
......@@ -45,7 +46,6 @@ import GHC.Cmm.CLabel
import GHC.Cmm
import GHC.Cmm.Utils
import GHC.Cmm.Switch
import DynFlags
import FastString
import Outputable
import GHC.Cmm.Ppr.Decl
......@@ -181,22 +181,22 @@ pprNode :: CmmNode e x -> SDoc
pprNode node = pp_node <+> pp_debug
where
pp_node :: SDoc
pp_node = sdocWithDynFlags $ \dflags -> case node of
pp_node = case node of
-- label:
CmmEntry id tscope -> lbl <> colon <+>
(sdocWithDynFlags $ \dflags ->
ppUnless (gopt Opt_SuppressTicks dflags) (text "//" <+> ppr tscope))
where
lbl = if gopt Opt_SuppressUniques dflags
then text "_lbl_"
else ppr id
CmmEntry id tscope ->
(sdocOption sdocSuppressUniques $ \case
True -> text "_lbl_"
False -> ppr id
)
<> colon
<+> ppUnlessOption sdocSuppressTicks (text "//" <+> ppr tscope)
-- // text
CmmComment s -> text "//" <+> ftext s
-- //tick bla<...>
CmmTick t -> ppUnless (gopt Opt_SuppressTicks dflags) $
text "//tick" <+> ppr t
CmmTick t -> ppUnlessOption sdocSuppressTicks
(text "//tick" <+> ppr t)
-- unwind reg = expr;
CmmUnwind regs ->
......
......@@ -43,7 +43,7 @@ import GhcPrelude
import GHC.Cmm.Ppr.Expr
import GHC.Cmm
import DynFlags
import GHC.Driver.Session
import Outputable
import FastString
......
......@@ -31,8 +31,9 @@
--
-- A useful example pass over Cmm is in nativeGen/MachCodeGen.hs
--
{-# LANGUAGE LambdaCase #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
module GHC.Cmm.Ppr.Expr
( pprExpr, pprLit
)
......@@ -43,7 +44,6 @@ import GhcPrelude
import GHC.Cmm.Expr
import Outputable
import DynFlags
import Data.Maybe
import Numeric ( fromRat )
......@@ -227,18 +227,17 @@ pprReg r
-- We only print the type of the local reg if it isn't wordRep
--
pprLocalReg :: LocalReg -> SDoc
pprLocalReg (LocalReg uniq rep) = sdocWithDynFlags $ \dflags ->
pprLocalReg (LocalReg uniq rep) =
-- = ppr rep <> char '_' <> ppr uniq
-- Temp Jan08
char '_' <> pprUnique dflags uniq <>
char '_' <> pprUnique uniq <>
(if isWord32 rep -- && not (isGcPtrType rep) -- Temp Jan08 -- sigh
then dcolon <> ptr <> ppr rep
else dcolon <> ptr <> ppr rep)
where
pprUnique dflags unique =
if gopt Opt_SuppressUniques dflags
then text "_locVar_"
else ppr unique
pprUnique unique = sdocOption sdocSuppressUniques $ \case
True -> text "_locVar_"
False -> ppr unique
ptr = empty
--if isGcPtrType rep
-- then doubleQuotes (text "ptr")
......
......@@ -11,7 +11,7 @@ where
import GhcPrelude hiding (last, unzip, succ, zip)
import DynFlags
import GHC.Driver.Session
import GHC.Cmm.BlockId
import GHC.Cmm.CLabel
import GHC.Cmm
......
......@@ -16,7 +16,7 @@ import GHC.Cmm.Dataflow.Graph
import GHC.Platform.Regs
import GHC.Platform (isARM, platformArch)
import DynFlags
import GHC.Driver.Session
import Unique
import UniqFM
......
......@@ -15,7 +15,7 @@ module GHC.Cmm.Switch (
import GhcPrelude
import Outputable
import DynFlags
import GHC.Driver.Session
import GHC.Cmm.Dataflow.Label (Label)
import Data.Maybe
......
......@@ -12,7 +12,8 @@ import GHC.Cmm
import GHC.Cmm.Utils
import GHC.Cmm.Switch
import UniqSupply
import DynFlags
import GHC.Driver.Session
import MonadUtils (concatMapM)
--
-- This module replaces Switch statements as generated by the Stg -> Cmm
......@@ -35,7 +36,7 @@ cmmImplementSwitchPlans dflags g
-- Switch generation done by backend (LLVM/C)
| targetSupportsSwitch (hscTarget dflags) = return g
| otherwise = do
blocks' <- concat `fmap` mapM (visitSwitches dflags) (toBlockList g)
blocks' <- concatMapM (visitSwitches dflags) (toBlockList g)
return $ ofBlockList (g_entry g) blocks'
visitSwitches :: DynFlags -> CmmBlock -> UniqSM [CmmBlock]
......
......@@ -31,7 +31,7 @@ where
import GhcPrelude
import DynFlags
import GHC.Driver.Session
import FastString
import Outputable
......
......@@ -80,7 +80,7 @@ import GHC.Cmm
import GHC.Cmm.BlockId
import GHC.Cmm.CLabel
import Outputable
import DynFlags
import GHC.Driver.Session
import Unique
import GHC.Platform.Regs
......
......@@ -40,7 +40,7 @@ import GHC.Cmm.Switch
-- Utils
import CPrim
import DynFlags
import GHC.Driver.Session
import FastString
import Outputable
import GHC.Platform
......
......@@ -29,7 +29,7 @@ import GHC.Cmm.Dataflow.Collections
import GHC.Cmm.Ppr
import BufWrite
import DynFlags
import GHC.Driver.Session
import GHC.Platform ( platformArch, Arch(..) )
import ErrUtils
import FastString
......
......@@ -48,7 +48,7 @@ import GHC.CmmToLlvm.Regs
import GHC.Cmm.CLabel
import GHC.Platform.Regs ( activeStgRegs )
import DynFlags
import GHC.Driver.Session
import FastString
import GHC.Cmm hiding ( succ )
import GHC.Cmm.Utils (regsOverlap)
......@@ -506,7 +506,9 @@ strCLabel_llvm :: CLabel -> LlvmM LMString
strCLabel_llvm lbl = do
dflags <- getDynFlags
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)
strDisplayName_llvm :: CLabel -> LlvmM LMString
......@@ -515,7 +517,7 @@ strDisplayName_llvm lbl = do
let sdoc = pprCLabel dflags lbl
depth = Outp.PartWay 1
style = Outp.mkUserStyle dflags Outp.reallyAlwaysQualify depth
str = Outp.renderWithStyle dflags sdoc style
str = Outp.renderWithStyle (initSDocContext dflags style) sdoc
return (fsLit (dropInfoSuffix str))
dropInfoSuffix :: String -> String
......@@ -532,7 +534,7 @@ strProcedureName_llvm lbl = do
let sdoc = pprCLabel dflags lbl
depth = Outp.PartWay 1
style = Outp.mkUserStyle dflags Outp.neverQualify depth
str = Outp.renderWithStyle dflags sdoc style
str = Outp.renderWithStyle (initSDocContext dflags style) sdoc
return (fsLit str)
-- ----------------------------------------------------------------------------
......
......@@ -25,7 +25,7 @@ import GHC.Cmm.Dataflow.Block
import GHC.Cmm.Dataflow.Graph
import GHC.Cmm.Dataflow.Collections
import DynFlags
import GHC.Driver.Session
import FastString
import ForeignCall
import Outputable hiding (panic, pprPanic)
......@@ -1505,7 +1505,7 @@ genMachOp_slow opt op [x, y] = case op of
-- Error. Continue anyway so we can debug the generated ll file.
dflags <- getDynFlags
let style = mkCodeStyle CStyle
toString doc = renderWithStyle dflags doc style
toString doc = renderWithStyle (initSDocContext dflags style) doc
cmmToStr = (lines . toString . PprCmm.pprExpr)
statement $ Comment $ map fsLit $ cmmToStr x
statement $ Comment $ map fsLit $ cmmToStr y
......
......@@ -17,7 +17,7 @@ import GHC.CmmToLlvm.Base
import GHC.Cmm.BlockId
import GHC.Cmm.CLabel
import GHC.Cmm
import DynFlags
import GHC.Driver.Session
import GHC.Platform
import FastString
......
......@@ -13,7 +13,7 @@ module GHC.CmmToLlvm.Mangler ( llvmFixupAsm ) where
import GhcPrelude
import DynFlags ( DynFlags, targetPlatform )
import GHC.Driver.Session ( DynFlags, targetPlatform )
import GHC.Platform ( platformArch, Arch(..) )
import ErrUtils ( withTiming )
import Outputable ( text )
......
......@@ -16,7 +16,7 @@ import GhcPrelude
import GHC.Llvm
import GHC.Cmm.Expr
import DynFlags
import GHC.Driver.Session
import FastString
import Outputable ( panic )
import Unique
......
......@@ -22,7 +22,7 @@ import GHC.Runtime.Interpreter
import GHCi.FFI
import GHCi.RemoteTypes
import BasicTypes
import DynFlags
import GHC.Driver.Session
import Outputable
import GHC.Platform
import Name
......@@ -30,7 +30,7 @@ import MkId
import Id
import Var ( updateVarType )
import ForeignCall
import HscTypes
import GHC.Driver.Types
import CoreUtils
import CoreSyn
import PprCore
......@@ -56,6 +56,7 @@ import GHC.Data.Bitmap
import OrdList
import Maybes
import VarEnv
import PrelNames ( unsafeEqualityProofName )
import Data.List
import Foreign
......@@ -634,11 +635,12 @@ schemeE d s p exp@(AnnTick (Breakpoint _id _fvs) _rhs)
-- ignore other kinds of tick
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
-- 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)])
| isUnboxedTupleCon dc -- handles pairs with one void argument (e.g. state token)
| isUnboxedTupleCon dc
-- Convert
-- case .... of x { (# V'd-thing, a #) -> ... }
-- to
......@@ -655,11 +657,13 @@ schemeE d s p (AnnCase scrut bndr _ [(DataAlt dc, [bind1, bind2], rhs)])
_ -> Nothing
= res
-- handle unit tuples
schemeE d s p (AnnCase scrut bndr _ [(DataAlt dc, [bind1], rhs)])
| 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)
-- handle nullary tuples
schemeE d s p (AnnCase scrut bndr _ alt@[(DEFAULT, [], _)])
| isUnboxedTupleType (idType bndr)
, Just ty <- case typePrimRep (idType bndr) of
......@@ -983,6 +987,7 @@ doCase
doCase d s p (_,scrut) bndr alts is_unboxed_tuple
| typePrimRep (idType bndr) `lengthExceeds` 1
= multiValException
| otherwise
= do
dflags <- getDynFlags
......@@ -1111,7 +1116,7 @@ doCase d s p (_,scrut) bndr alts is_unboxed_tuple
binds = Map.toList p
-- 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:
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 ]
| otherwise = []
where rel_offset = trunc16W $ bytesToWords dflags (d - offset)
......@@ -1883,6 +1888,7 @@ bcView :: AnnExpr' Var ann -> Maybe (AnnExpr' Var ann)
-- b) type applications
-- c) casts
-- d) ticks (but not breakpoints)
-- e) case unsafeEqualityProof of UnsafeRefl -> e ==> e
-- Type lambdas *can* occur in random expressions,
-- whereas value lambdas cannot; that is why they are nuked here
bcView (AnnCast (_,e) _) = Just e
......@@ -1890,8 +1896,19 @@ bcView (AnnLam v (_,e)) | isTyVar v = Just e
bcView (AnnApp (_,e) (_, AnnType _)) = Just e
bcView (AnnTick Breakpoint{} _) = Nothing
bcView (AnnTick _other_tick (_,e)) = Just e
bcView (AnnCase (_,e) _ _ alts) -- Handle unsafe equality proof
| AnnVar id <- bcViewLoop e
, idName id == unsafeEqualityProofName
, [(_, _, (_, rhs))] <- alts
= Just rhs
bcView _ = Nothing
bcViewLoop :: AnnExpr' Var ann -> AnnExpr' Var ann
bcViewLoop e =
case bcView e of
Nothing -> e
Just e' -> bcViewLoop e'
isVAtom :: AnnExpr' Var ann -> Bool
isVAtom e | Just e' <- bcView e = isVAtom e'
isVAtom (AnnVar v) = isVoidArg (bcIdArgRep v)
......
......@@ -301,7 +301,6 @@ toIfaceCoercionX fr co
fr' = fr `delVarSet` tv
go_prov :: UnivCoProvenance -> IfaceUnivCoProv
go_prov UnsafeCoerceProv = IfaceUnsafeCoerceProv
go_prov (PhantomProv co) = IfacePhantomProv (go co)
go_prov (ProofIrrelProv co) = IfaceProofIrrelProv (go co)
go_prov (PluginProv str) = IfacePluginProv str
......
......@@ -41,11 +41,12 @@ import Outputable
import MonadUtils
import FastString
import Util
import DynFlags
import GHC.Driver.Session
import ForeignCall
import Demand ( isUsedOnce )
import PrimOp ( PrimCall(..), primOpWrapperId )
import SrcLoc ( mkGeneralSrcSpan )
import PrelNames ( unsafeEqualityProofName )
import Data.List.NonEmpty (nonEmpty, toList)
import Data.Maybe (fromMaybe)
......@@ -404,11 +405,23 @@ coreToStgExpr (Case scrut _ _ [])
-- runtime system error function.
coreToStgExpr (Case scrut bndr _ alts) = do
coreToStgExpr e0@(Case scrut bndr _ alts) = do
alts2 <- extendVarEnvCts [(bndr, LambdaBound)] (mapM vars_alt alts)
scrut2 <- coreToStgExpr scrut
return (StgCase scrut2 bndr (mkStgAltType bndr alts) alts2)
let stg = StgCase scrut2 bndr (mkStgAltType bndr alts) alts2
-- See (U2) in Note [Implementing unsafeCoerce] in base:Unsafe.Coerce
case scrut2 of
StgApp id [] | idName id == unsafeEqualityProofName ->
case alts2 of
[(_, [_co], rhs)] ->
return rhs
_ ->
pprPanic "coreToStgExpr" $
text "Unexpected unsafe equality case expression:" $$ ppr e0 $$
text "STG:" $$ ppr stg
_ -> return stg
where
vars_alt :: (AltCon, [Var], CoreExpr) -> CtsM (AltCon, [Var], StgExpr)
vars_alt (con, binders, rhs)
| DataAlt c <- con, c == unboxedUnitDataCon
= -- This case is a bit smelly.
......
This diff is collapsed.
......@@ -18,7 +18,7 @@ module GHC.Data.Bitmap (
import GhcPrelude
import GHC.Runtime.Heap.Layout
import DynFlags
import GHC.Driver.Session
import Util
import Data.Bits
......
......@@ -14,41 +14,42 @@
-- it builds and doesn't serialize out the database contents.
-- But it's still handy for constructing tests.
module DriverBkp (doBackpack) where
module GHC.Driver.Backpack (doBackpack) where
#include "HsVersions.h"
import GhcPrelude
-- In a separate module because it hooks into the parser.
import BkpSyn
import GHC.Driver.Backpack.Syntax
import ApiAnnotation
import GHC hiding (Failed, Succeeded)
import Packages
import GHC.Driver.Packages
import Parser
import Lexer
import GhcMonad
import DynFlags
import GHC.Driver.Monad
import GHC.Driver.Session
import TcRnMonad
import TcRnDriver
import Module
import HscTypes
import GHC.Driver.Types
import StringBuffer
import FastString
import ErrUtils
import SrcLoc
import HscMain
import GHC.Driver.Main
import UniqFM
import UniqDFM
import Outputable
import Maybes
import HeaderInfo
import GHC.Iface.Utils
import GhcMake
import GHC.Driver.Make
import UniqDSet
import PrelNames
import BasicTypes hiding (SuccessFlag(..))
import Finder
import GHC.Driver.Finder
import Util
import qualified GHC.LanguageExtensions as LangExt
......@@ -74,7 +75,7 @@ doBackpack [src_filename] = do
src_opts <- liftIO $ getOptionsFromFile dflags1 src_filename
(dflags, unhandled_flags, warns) <- liftIO $ parseDynamicFilePragma dflags1 src_opts
modifySession (\hsc_env -> hsc_env {hsc_dflags = dflags})
-- Cribbed from: preprocessFile / DriverPipeline
-- Cribbed from: preprocessFile / GHC.Driver.Pipeline
liftIO $ checkProcessArgsResult dflags unhandled_flags
liftIO $ handleFlagWarnings dflags warns
-- TODO: Preprocessing not implemented
......@@ -263,7 +264,7 @@ buildUnit session cid insts lunit = do
-- Build dependencies OR make sure they make sense. BUT NOTE,
-- we can only check the ones that are fully filled; the rest
-- we have to defer until we've typechecked our local signature.
-- TODO: work this into GhcMake!!
-- TODO: work this into GHC.Driver.Make!!
forM_ (zip [1..] deps0) $ \(i, dep) ->
case session of
TcSession -> return ()
......@@ -538,8 +539,9 @@ msgUnitId pk = do
dflags <- getDynFlags
level <- getBkpLevel
liftIO . backpackProgressMsg level dflags
$ "Instantiating " ++ renderWithStyle dflags (ppr pk)
(backpackStyle dflags)
$ "Instantiating " ++ renderWithStyle
(initSDocContext dflags (backpackStyle dflags))
(ppr pk)