Add MO_AddIntC, MO_SubIntC MachOps and implement in X86 backend

Summary:
These MachOps are used by addIntC# and subIntC#, which in turn are
used in integer-gmp when adding or subtracting small Integers. The
following benchmark shows a ~6% speedup after this commit on x86_64
(building GHC with BuildFlavour=perf).

    {-# LANGUAGE MagicHash #-}

    import GHC.Exts
    import Criterion.Main

    count :: Int -> Integer
    count (I# n#) = go n# 0
      where go :: Int# -> Integer -> Integer
            go 0# acc = acc
            go n# acc = go (n# -# 1#) $! acc + 1

    main = defaultMain [bgroup "count"
                          [bench "100" $ whnf count 100]]

Differential Revision: https://phabricator.haskell.org/D140
testsuite: added 'bytes allocated' for T9339 wordsize(32)

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
Declare official GitHub home of libraries/{directory,process}

Effective immediately, pushing to libraries/{directory,process} requires
pushing to ssh://git@github.com/haskell/{directory.process}.git. This has
been done now even though there's no scripted tooling yet as the GitHub repo
was already getting issues filed.
testsuite: add 16-byte case for T9329

Exposes Issue #9512 on amd64

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
Use DumpStyle rather than UserStyle for pprTrace output

The main motivation is that user-style output assumes that everything has been
tidied, not enough uniques are printed by default.

The downside is that pprTrace output now has module prefixes which can be overwhelming,
but -dsuppress-module-prefixes will suppress them.
Introduce the Call data types

This is just a small refactoring that makes the code a bit clearer,
using a data type instead of a triple.  We get better pretty-printing too.
Do not duplicate call information in SpecConstr (Trac #8852)

This long-standing and egregious bug meant that call information was
being gratuitously copied, leading to an exponential blowup in the
number of calls to be examined when function definitions are deeply
nested.  That is what has been causing the blowup in SpecConstr's
running time, not (as I had previously supposed) generating very large code.

See Note [spec_usg includes rhs_usg]
More refactoring in SpecConstr

This patch should make no change in behaviour.

 * Make RhsInfo into a record

 * Include ri_rhs_usg, which previously travelled around separately

 * Introduce specRec, specNonRec, and
   make them return [OneSpec] rather than SpecInfo
Make Core Lint check for un-saturated type applications

Un-saturated type-family and type-synonym applications are
detected in the front end, but for some reason Lint wasn't
looking for them.

I came across this when wondering why Trac #9433 didn't give
a Core Lint error
Check for un-saturated type family applications

This patch corrects an egregious error introduced by:

  commit 022f8750edf6f413fba31293435dcc62600eab77
  Author: Simon Peyton Jones <simonpj@microsoft.com>
  Date:   Thu May 15 16:07:04 2014 +0100

    Refactoring around TyCon.isSynTyCon

    * Document isSynTyCon better
    * Add isTypeSyonymTyCon for regular H98 type synonyms
    * Use isTypeSynonymTyCon rather than isSynTyCon where
      the former is really intended

At this particular spot in TcValidity we really do mean
isSynTyCon and not isTypeSynonymTyCon.

Fixes Trac #9433
Two buglets in record wild-cards (Trac #9436 and #9437)

of named fields, whereas the code in RnPat.rnHsRecFields is
much better set up to do so.

Both easily fixed.
Improve documentation of record wildcards

In particular mention that they aren't allowed for record updates.

Triggered by Trac #9437
UNREG: fix emission of large Integer literals in C codegen

Summary:
On amd64/UNREG build there is many failing tests trying
to deal with 'Integer' types.

Looking at 'integerConversions' test I've observed
invalid C code generated by GHC.

Cmm code
    CInt a = -1; (a == -1)
yields 'False' with optimisations enabled via the following C code:
    StgWord64 a = (StgWord32)0xFFFFffffFFFFffffu; (a == 0xFFFFffffFFFFffffu)

The patch fixes it by shrinking emitted literals to required sizes:
    StgWord64 a = (StgWord32)0xFFFFffffu; (a == 0xFFFFffffu)

Thanks to Reid Barton for tracking down and fixing the issue.

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>

Test Plan: validate on UNREG build (amd64, x86)

Reviewers: simonmar, rwbarton, austin

Subscribers: hvr, simonmar, ezyang, carter

Differential Revision: https://phabricator.haskell.org/D173
driver: pass '-fPIC' option to assembler as well

Summary:
Before the patch '-fPIC' was passed only to C compiler,
but not to assembler itself.

It led to runtime crash in GHC_DYNAMIC_PROGRAMS=YES mode
on sparc32.

Technical details are in 'Note [-fPIC for assembler]'.

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>

Test Plan: validate on sparc

Reviewers: simonmar, austin, kgardas

Reviewed By: austin

Subscribers: simonmar, ezyang, carter

Differential Revision: https://phabricator.haskell.org/D177
Revert "disable shared libs on sparc (linux/solaris) (fixes #8857)"

This reverts commit 623883f1ed0ee11cc925c4590fb09565403fd231.

The commit a93ab43ab5f40cadbedea2f6342b93c245e91434
    driver: pass '-fPIC' option to assembler as well
fixes shared libraries on sparc at least on linux.

Properly fixes Issue #8857

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
Less voluminous output when printing continuations
Refactor unfoldings

There are two main refactorings here

1.  Move the uf_arity field
       out of CoreUnfolding
       into UnfWhen
    It's a lot tidier there.  If I've got this right, no behaviour
    should change.

2.  Define specUnfolding and use it in DsBinds and Specialise
     a) commons-up some shared code
     b) makes sure that Specialise correctly specialises DFun
        unfoldings (which it didn't before)

The two got put together because both ended up interacting in the
specialiser.

They cause zero difference to nofib.
Kill unused setUnfoldingTemplate
Make maybeUnfoldingTemplate respond to DFunUnfoldings

CoreSyn.maybeUnfoldingTemplate is used mainly when specialising,
so make DFunUnfoldings respond to it makes it possible to specialise
them properly.
Make worker/wrapper work on INLINEABLE things

This fixes a long-standing bug: Trac #6056.  The trouble was that
INLINEABLE "used up" the unfolding for the Id, so it couldn't be
worker/wrapper'd by the strictness analyser.

This patch allows the w/w to go ahead, and makes the *worker* INLINEABLE
instead, so it can later be specialised.

However, that doesn't completely solve the problem, because the dictionary
argument (which the specialiser treats specially) may be strict and
hence unpacked by w/w, so now the worker won't be specilialised after all.

Solution: never unpack dictionary arguments, which is done by the isClassTyCon
          test in WwLib.deepSplitProductType_maybe