Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • ghc/ghc
  • bgamari/ghc
  • syd/ghc
  • ggreif/ghc
  • watashi/ghc
  • RolandSenn/ghc
  • mpickering/ghc
  • DavidEichmann/ghc
  • carter/ghc
  • harpocrates/ghc
  • ethercrow/ghc
  • mijicd/ghc
  • adamse/ghc
  • alexbiehl/ghc
  • gridaphobe/ghc
  • trofi/ghc
  • supersven/ghc
  • ppk/ghc
  • ulysses4ever/ghc
  • AndreasK/ghc
  • ghuntley/ghc
  • shayne-fletcher-da/ghc
  • fgaz/ghc
  • yav/ghc
  • osa1/ghc
  • mbbx6spp/ghc
  • JulianLeviston/ghc
  • reactormonk/ghc
  • rae/ghc
  • takenobu-hs/ghc
  • michalt/ghc
  • andrewthad/ghc
  • hsyl20/ghc
  • scottgw/ghc
  • sjakobi/ghc
  • angerman/ghc
  • RyanGlScott/ghc
  • hvr/ghc
  • howtonotwin/ghc
  • chessai/ghc
  • m-renaud/ghc
  • brprice/ghc
  • stevehartdata/ghc
  • sighingnow/ghc
  • kgardas/ghc
  • ckoparkar/ghc
  • alp/ghc
  • smaeul/ghc
  • kakkun61/ghc
  • sykloid/ghc
  • newhoggy/ghc
  • toonn/ghc
  • nineonine/ghc
  • Phyx/ghc
  • ezyang/ghc
  • tweag/ghc
  • langston/ghc
  • ndmitchell/ghc
  • rockbmb/ghc
  • artempyanykh/ghc
  • mniip/ghc
  • mynguyenbmc/ghc
  • alexfmpe/ghc
  • crockeea/ghc
  • nh2/ghc
  • vaibhavsagar/ghc
  • phadej/ghc
  • Haskell-mouse/ghc
  • lolotp/ghc
  • spacekitteh/ghc
  • michaelpj/ghc
  • mgsloan/ghc
  • HPCohen/ghc
  • tmobile/ghc
  • radrow/ghc
  • simonmar/ghc
  • _deepfire/ghc
  • Ericson2314/ghc
  • leitao/ghc
  • fumieval/ghc
  • trac-isovector/ghc
  • cblp/ghc
  • xich/ghc
  • ciil/ghc
  • erthalion/ghc
  • xldenis/ghc
  • autotaker/ghc
  • haskell-wasm/ghc
  • kcsongor/ghc
  • agander/ghc
  • Baranowski/ghc
  • trac-dredozubov/ghc
  • 23Skidoo/ghc
  • iustin/ghc
  • ningning/ghc
  • josefs/ghc
  • kabuhr/ghc
  • gallais/ghc
  • dten/ghc
  • expipiplus1/ghc
  • Pluralia/ghc
  • rohanjr/ghc
  • intricate/ghc
  • kirelagin/ghc
  • Javran/ghc
  • DanielG/ghc
  • trac-mizunashi_mana/ghc
  • pparkkin/ghc
  • bollu/ghc
  • ntc2/ghc
  • jaspervdj/ghc
  • JoshMeredith/ghc
  • wz1000/ghc
  • zkourouma/ghc
  • code5hot/ghc
  • jdprice/ghc
  • tdammers/ghc
  • J-mie6/ghc
  • trac-lantti/ghc
  • ch1bo/ghc
  • cgohla/ghc
  • lucamolteni/ghc
  • acairncross/ghc
  • amerocu/ghc
  • chreekat/ghc
  • txsmith/ghc
  • trupill/ghc
  • typetetris/ghc
  • sergv/ghc
  • fryguybob/ghc
  • erikd/ghc
  • trac-roland/ghc
  • setupminimal/ghc
  • Friede80/ghc
  • SkyWriter/ghc
  • xplorld/ghc
  • abrar/ghc
  • obsidiansystems/ghc
  • Icelandjack/ghc
  • adinapoli/ghc
  • trac-matthewbauer/ghc
  • heatsink/ghc
  • dwijnand/ghc
  • Cmdv/ghc
  • alinab/ghc
  • pepeiborra/ghc
  • fommil/ghc
  • luochen1990/ghc
  • rlupton20/ghc
  • applePrincess/ghc
  • lehins/ghc
  • ronmrdechai/ghc
  • leeadam/ghc
  • harendra/ghc
  • mightymosquito1991/ghc
  • trac-gershomb/ghc
  • lucajulian/ghc
  • Rizary/ghc
  • VictorCMiraldo/ghc
  • jamesbrock/ghc
  • andrewdmeier/ghc
  • luke/ghc
  • pranaysashank/ghc
  • cocreature/ghc
  • hithroc/ghc
  • obreitwi/ghc
  • slrtbtfs/ghc
  • kaol/ghc
  • yairchu/ghc
  • Mathemagician98/ghc
  • trac-taylorfausak/ghc
  • leungbk/ghc
  • MichaWiedenmann/ghc
  • chris-martin/ghc
  • TDecki/ghc
  • adithyaov/ghc
  • trac-gelisam/ghc
  • Lysxia/ghc
  • complyue/ghc
  • bwignall/ghc
  • sternmull/ghc
  • sonika/ghc
  • leif/ghc
  • broadwaylamb/ghc
  • myszon/ghc
  • danbroooks/ghc
  • Mechachleopteryx/ghc
  • zardyh/ghc
  • trac-vdukhovni/ghc
  • OmarKhaledAbdo/ghc
  • arrowd/ghc
  • Bodigrim/ghc
  • matheus23/ghc
  • cardenaso11/ghc
  • trac-Athas/ghc
  • mb720/ghc
  • DylanZA/ghc
  • liff/ghc
  • typedrat/ghc
  • trac-claude/ghc
  • jbm/ghc
  • Gertjan423/ghc
  • PHO/ghc
  • JKTKops/ghc
  • kockahonza/ghc
  • msakai/ghc
  • Sir4ur0n/ghc
  • barambani/ghc
  • vishnu.c/ghc
  • dcoutts/ghc
  • trac-runeks/ghc
  • trac-MaxGabriel/ghc
  • lexi.lambda/ghc
  • strake/ghc
  • spavikevik/ghc
  • JakobBruenker/ghc
  • rmanne/ghc
  • gdziadkiewicz/ghc
  • ani/ghc
  • iliastsi/ghc
  • smunix/ghc
  • judah/ghc
  • blackgnezdo/ghc
  • emilypi/ghc
  • trac-bpfoley/ghc
  • muesli4/ghc
  • trac-gkaracha/ghc
  • Kleidukos/ghc
  • nek0/ghc
  • TristanCacqueray/ghc
  • dwulive/ghc
  • mbakke/ghc
  • arybczak/ghc
  • Yang123321/ghc
  • maksbotan/ghc
  • QuietMisdreavus/ghc
  • trac-olshanskydr/ghc
  • emekoi/ghc
  • samuela/ghc
  • josephcsible/ghc
  • dramforever/ghc
  • lpsmith/ghc
  • DenisFrezzato/ghc
  • michivi/ghc
  • jneira/ghc
  • jeffhappily/ghc
  • Ivan-Yudin/ghc
  • nakaji-dayo/ghc
  • gdevanla/ghc
  • galen/ghc
  • fendor/ghc
  • yaitskov/ghc
  • rcythr/ghc
  • awpr/ghc
  • jeremyschlatter/ghc
  • Aver1y/ghc
  • mitchellvitez/ghc
  • merijn/ghc
  • tomjaguarpaw1/ghc
  • trac-NoidedSuper/ghc
  • erewok/ghc
  • trac-junji.hashimoto/ghc
  • adamwespiser/ghc
  • bjaress/ghc
  • jhrcek/ghc
  • leonschoorl/ghc
  • lukasz-golebiewski/ghc
  • sheaf/ghc
  • last-g/ghc
  • carassius1014/ghc
  • eschwartz/ghc
  • dwincort/ghc
  • felixwiemuth/ghc
  • TimWSpence/ghc
  • marcusmonteirodesouza/ghc
  • WJWH/ghc
  • vtols/ghc
  • theobat/ghc
  • BinderDavid/ghc
  • ckoparkar0/ghc
  • alexander-kjeldaas/ghc
  • dme2/ghc
  • philderbeast/ghc
  • aaronallen8455/ghc
  • rayshih/ghc
  • benkard/ghc
  • mpardalos/ghc
  • saidelman/ghc
  • leiftw/ghc
  • ca333/ghc
  • bwroga/ghc
  • nmichael44/ghc
  • trac-crobbins/ghc
  • felixonmars/ghc
  • adityagupta1089/ghc
  • hgsipiere/ghc
  • treeowl/ghc
  • alexpeits/ghc
  • CraigFe/ghc
  • dnlkrgr/ghc
  • kerckhove_ts/ghc
  • cptwunderlich/ghc
  • eiais/ghc
  • hahohihu/ghc
  • sanchayan/ghc
  • lemmih/ghc
  • sehqlr/ghc
  • trac-dbeacham/ghc
  • luite/ghc
  • trac-f-a/ghc
  • vados/ghc
  • luntain/ghc
  • fatho/ghc
  • alexbiehl-gc/ghc
  • dcbdan/ghc
  • tvh/ghc
  • liam-ly/ghc
  • timbobbarnes/ghc
  • GovanifY/ghc
  • shanth2600/ghc
  • gliboc/ghc
  • duog/ghc
  • moxonsghost/ghc
  • zander/ghc
  • masaeedu/ghc
  • georgefst/ghc
  • guibou/ghc
  • nicuveo/ghc
  • mdebruijne/ghc
  • stjordanis/ghc
  • emiflake/ghc
  • wygulmage/ghc
  • frasertweedale/ghc
  • coot/ghc
  • aratamizuki/ghc
  • tsandstr/ghc
  • mrBliss/ghc
  • Anton-Latukha/ghc
  • tadfisher/ghc
  • vapourismo/ghc
  • Sorokin-Anton/ghc
  • basile-henry/ghc
  • trac-mightybyte/ghc
  • AbsoluteNikola/ghc
  • cobrien99/ghc
  • songzh/ghc
  • blamario/ghc
  • aj4ayushjain/ghc
  • trac-utdemir/ghc
  • tangcl/ghc
  • hdgarrood/ghc
  • maerwald/ghc
  • arjun/ghc
  • ratherforky/ghc
  • haskieLambda/ghc
  • EmilGedda/ghc
  • Bogicevic/ghc
  • eddiejessup/ghc
  • kozross/ghc
  • AlistairB/ghc
  • 3Rafal/ghc
  • christiaanb/ghc
  • trac-bit/ghc
  • matsumonkie/ghc
  • trac-parsonsmatt/ghc
  • chisui/ghc
  • jaro/ghc
  • trac-kmiyazato/ghc
  • davidsd/ghc
  • Tritlo/ghc
  • I-B-3/ghc
  • lykahb/ghc
  • AriFordsham/ghc
  • turion1/ghc
  • berberman/ghc
  • christiantakle/ghc
  • zyklotomic/ghc
  • trac-ocramz/ghc
  • CSEdd/ghc
  • doyougnu/ghc
  • mmhat/ghc
  • why-not-try-calmer/ghc
  • plutotulp/ghc
  • kjekac/ghc
  • Manvi07/ghc
  • teo/ghc
  • cactus/ghc
  • CarrieMY/ghc
  • abel/ghc
  • yihming/ghc
  • tsakki/ghc
  • jessicah/ghc
  • oliverbunting/ghc
  • meld/ghc
  • friedbrice/ghc
  • Joald/ghc
  • abarbu/ghc
  • DigitalBrains1/ghc
  • sterni/ghc
  • alexDarcy/ghc
  • hexchain/ghc
  • minimario/ghc
  • zliu41/ghc
  • tommd/ghc
  • jazcarate/ghc
  • peterbecich/ghc
  • alirezaghey/ghc
  • solomon/ghc
  • mikael.urankar/ghc
  • davjam/ghc
  • int-index/ghc
  • MorrowM/ghc
  • nrnrnr/ghc
  • Sonfamm/ghc-test-only
  • afzt1/ghc
  • nguyenhaibinh-tpc/ghc
  • trac-lierdakil/ghc
  • MichaWiedenmann1/ghc
  • jmorag/ghc
  • Ziharrk/ghc
  • trac-MitchellSalad/ghc
  • juampe/ghc
  • jwaldmann/ghc
  • snowleopard/ghc
  • juhp/ghc
  • normalcoder/ghc
  • ksqsf/ghc
  • trac-jberryman/ghc
  • roberth/ghc
  • 1ntEgr8/ghc
  • epworth/ghc
  • MrAdityaAlok/ghc
  • JunmingZhao42/ghc
  • jappeace/ghc
  • trac-Gabriel439/ghc
  • alt-romes/ghc
  • HugoPeters1024/ghc
  • 10ne1/ghc-fork
  • agentultra/ghc
  • Garfield1002/ghc
  • ChickenProp/ghc
  • clyring/ghc
  • MaxHearnden/ghc
  • jumper149/ghc
  • vem/ghc
  • ketzacoatl/ghc
  • Rosuavio/ghc
  • jackohughes/ghc
  • p4l1ly/ghc
  • konsumlamm/ghc
  • shlevy/ghc
  • torsten.schmits/ghc
  • andremarianiello/ghc
  • amesgen/ghc
  • googleson78/ghc
  • InfiniteVerma/ghc
  • uhbif19/ghc
  • yiyunliu/ghc
  • raehik/ghc
  • mrkun/ghc
  • telser/ghc
  • 1Jajen1/ghc
  • slotThe/ghc
  • WinstonHartnett/ghc
  • mpilgrem/ghc
  • dreamsmasher/ghc
  • schuelermine/ghc
  • trac-Viwor/ghc
  • undergroundquizscene/ghc
  • evertedsphere/ghc
  • coltenwebb/ghc
  • oberblastmeister/ghc
  • agrue/ghc
  • lf-/ghc
  • zacwood9/ghc
  • steshaw/ghc
  • high-cloud/ghc
  • SkamDart/ghc
  • PiDelport/ghc
  • maoif/ghc
  • RossPaterson/ghc
  • CharlesTaylor7/ghc
  • ribosomerocker/ghc
  • trac-ramirez7/ghc
  • daig/ghc
  • NicolasT/ghc
  • FinleyMcIlwaine/ghc
  • lawtonnichols/ghc
  • jmtd/ghc
  • ozkutuk/ghc
  • wildsebastian/ghc
  • nikshalark/ghc
  • lrzlin/ghc
  • tobias/ghc
  • fw/ghc
  • hawkinsw/ghc
  • type-dance/ghc
  • rui314/ghc
  • ocharles/ghc
  • wavewave/ghc
  • TheKK/ghc
  • nomeata/ghc
  • trac-csabahruska/ghc
  • jonathanjameswatson/ghc
  • L-as/ghc
  • Axman6/ghc
  • barracuda156/ghc
  • trac-jship/ghc
  • jake-87/ghc
  • meooow/ghc
  • rebeccat/ghc
  • hamana55/ghc
  • Enigmage/ghc
  • kokobd/ghc
  • agevelt/ghc
  • gshen42/ghc
  • chrismwendt/ghc
  • MangoIV/ghc
  • teto/ghc
  • Sookr1/ghc
  • trac-thomasjm/ghc
  • barci2/ghc-dev
  • trac-m4dc4p/ghc
  • dixonary/ghc
  • breakerzirconia/ghc
  • alexsio27444/ghc
  • glocq/ghc
  • sourabhxyz/ghc
  • ryantrinkle/ghc
  • Jade/ghc
  • scedfaliako/ghc
  • martijnbastiaan/ghc
  • trac-george.colpitts/ghc
  • ammarbinfaisal/ghc
  • mimi.vx/ghc
  • lortabac/ghc
  • trac-zyla/ghc
  • benbellick/ghc
  • aadaa-fgtaa/ghc
  • jvanbruegge/ghc
  • archbung/ghc
  • gilmi/ghc
  • mfonism/ghc
  • alex-mckenna/ghc
  • Ei30metry/ghc
  • DiegoDiverio/ghc
  • jorgecunhamendes/ghc
  • liesnikov/ghc
  • akrmn/ghc
  • trac-simplifierticks/ghc
  • jacco/ghc
  • rhendric/ghc
  • damhiya/ghc
  • ryndubei/ghc
  • DaveBarton/ghc
  • trac-Profpatsch/ghc
  • GZGavinZhao/ghc
  • ncfavier/ghc
  • jameshaydon/ghc
  • ajccosta/ghc
  • dschrempf/ghc
  • cydparser/ghc
  • LinuxUserGD/ghc
  • elodielander/ghc
  • facundominguez/ghc
  • psilospore/ghc
  • lachrimae/ghc
  • dylan-thinnes/ghc-type-errors-plugin
  • hamishmack/ghc
  • Leary/ghc
  • lzszt/ghc
  • lyokha/ghc
  • trac-glaubitz/ghc
  • Rewbert/ghc
  • andreabedini/ghc
  • Jasagredo/ghc
  • sol/ghc
  • OlegAlexander/ghc
  • trac-sthibaul/ghc
  • avdv/ghc
  • Wendaolee/ghc
  • ur4t/ghc
  • daylily/ghc
  • boltzmannrain/ghc
  • mmzk1526/ghc
  • trac-fizzixnerd/ghc
  • soulomoon/ghc
  • rwmjones/ghc
  • j14i/ghc
  • tracsis/ghc
  • gesh/ghc
  • flip101/ghc
  • eldritch-cookie/ghc
  • LemonjamesD/ghc
  • pgujjula/ghc
  • skeuchel/ghc
  • noteed/ghc
  • gulin.serge/ghc
  • Torrekie/ghc
  • jlwoodwa/ghc
  • ayanamists/ghc
  • husong998/ghc
  • trac-edmundnoble/ghc
  • josephf/ghc
  • contrun/ghc
  • baulig/ghc
  • edsko/ghc
  • mzschr/ghc-issue-24732
  • ulidtko/ghc
  • Arsen/ghc
  • trac-sjoerd_visscher/ghc
  • crumbtoo/ghc
  • L0neGamer/ghc
  • DrewFenwick/ghc
  • benz0li/ghc
  • MaciejWas/ghc
  • jordanrule/ghc
  • trac-qqwy/ghc
  • LiamGoodacre/ghc
  • isomorpheme/ghc
  • trac-danidiaz/ghc
  • Kariim/ghc
  • MTaimoorZaeem/ghc
  • hololeap/ghc
  • ticat-fp/ghc
  • meritamen/ghc
  • criskell/ghc
  • trac-kraai/ghc
  • aergus/ghc
  • jdral/ghc
  • SamB/ghc
  • Tristian/ghc
  • ywgrit/ghc
  • KatsuPatrick/ghc
  • OsePedro/ghc
  • mpscholten/ghc
  • fp/ghc
  • zaquest/ghc
638 results
Show changes
Commits on Source (7)
  • Takenobu Tani's avatar
    linters: Make CPP linter skip image files · 2d635a50
    Takenobu Tani authored and Marge Bot's avatar Marge Bot committed
    This patch adds an exclusion rule for `docs/users_guide/images`,
    to avoid lint errors of PDF files.
    2d635a50
  • Takenobu Tani's avatar
    users-guide: Color the logo on the front page of the PDF · b7d98cb2
    Takenobu Tani authored and Marge Bot's avatar Marge Bot committed
    This patch updates the logo with a recent color scheme.
    This affects only the PDF version of the user's guide.
    
    See also:
    * https://mail.haskell.org/pipermail/ghc-devs/2020-August/019139.html
    * https://gitlab.haskell.org/ghc/ghc/-/wikis/logo
    b7d98cb2
  • Sylvain Henry's avatar
    Refactor UnitId pretty-printing · 0b17fa18
    Sylvain Henry authored and Marge Bot's avatar Marge Bot committed
    When we pretty-print a UnitId for the user, we try to map it back to its
    origin package name, version and component to print
    "package-version:component" instead of some hash.
    
    The UnitId type doesn't carry these information, so we have to look into
    a UnitState to find them. This is why the Outputable instance of
    UnitId used `sdocWithDynFlags` in order to access the `unitState` field
    of DynFlags.
    
    This is wrong for several reasons:
    
    1. The DynFlags are accessed when the message is printed, not when it is
       generated. So we could imagine that the unitState may have changed
       in-between. Especially if we want to allow unit unloading.
    
    2. We want GHC to support several independent sessions at once, hence
       several UnitState. The current approach supposes there is a unique
       UnitState as a UnitId doesn't indicate which UnitState to use.
    
    See the Note [Pretty-printing UnitId] in GHC.Unit for the new approach
    implemented by this patch.
    
    One step closer to remove `sdocDynFlags` field from `SDocContext`
    (#10143).
    
    Fix #18124.
    
    Also fix some Backpack code to use SDoc instead of String.
    0b17fa18
  • Sylvain Henry's avatar
    Bignum: fix BigNat subtraction (#18604) · dc476a50
    Sylvain Henry authored and Marge Bot's avatar Marge Bot committed
    There was a confusion between the boolean expected by
    withNewWordArrayTrimedMaybe and the boolean returned by subtracting
    functions.
    dc476a50
  • Peter Trommler's avatar
    PPC and X86: Portable printing of IEEE floats · fcb10b6c
    Peter Trommler authored and Marge Bot's avatar Marge Bot committed
    GNU as and the AIX assembler support floating point literals.
    SPARC seems to have support too but I cannot test on SPARC.
    Curiously, `doubleToBytes` is also used in the LLVM backend.
    
    To avoid endianness issues when cross-compiling float and double literals
    are printed as C-style floating point values. The assembler then takes
    care of memory layout and endianness.
    
    This was brought up in #18431 by @hsyl20.
    fcb10b6c
  • Krzysztof Gogolewski's avatar
    primops: Remove Monadic and Dyadic categories · 770100e0
    Krzysztof Gogolewski authored and Marge Bot's avatar Marge Bot committed
    There were four categories of primops: Monadic, Dyadic, Compare, GenPrimOp.
    
    The compiler does not treat Monadic and Dyadic in any special way,
    we can just replace them with GenPrimOp.
    
    Compare is still used in isComparisonPrimOp.
    770100e0
  • Vladislav Zavialov's avatar
    Require happy >=1.20 · 86ac4dbf
    Vladislav Zavialov authored
    86ac4dbf
Showing
with 250 additions and 267 deletions
......@@ -2,11 +2,11 @@ variables:
GIT_SSL_NO_VERIFY: "1"
# Commit of ghc/ci-images repository from which to pull Docker images
DOCKER_REV: b65e1145d7c0a62c3533904a88dac14f56fb371b
DOCKER_REV: f408f461fcadcb6081a330f6570186425d99ade7
# Sequential version number capturing the versions of all tools fetched by
# .gitlab/ci.sh.
WINDOWS_TOOLCHAIN_VERSION: 1
WINDOWS_TOOLCHAIN_VERSION: 2
# Disable shallow clones; they break our linting rules
GIT_DEPTH: 0
......
......@@ -6,7 +6,7 @@
set -e -o pipefail
# Configuration:
hackage_index_state="@1579718451"
hackage_index_state="2020-08-25T12:30:13Z"
# Colors
BLACK="0;30"
......
......@@ -29,6 +29,9 @@ for l in linters:
# Don't lint font files
l.add_path_filter(lambda path: not path.parent == Path('docs','users_guide',
'rtd-theme', 'static', 'fonts'))
# Don't lint image files
l.add_path_filter(lambda path: not path.parent == Path('docs','users_guide',
'images'))
# Don't lint core spec
l.add_path_filter(lambda path: not path.name == 'core-spec.pdf')
......
......@@ -1021,8 +1021,8 @@ changequote([, ])dnl
])
if test ! -f compiler/GHC/Parser.hs || test ! -f compiler/GHC/Cmm/Parser.hs
then
FP_COMPARE_VERSIONS([$fptools_cv_happy_version],[-lt],[1.19.10],
[AC_MSG_ERROR([Happy version 1.19.10 or later is required to compile GHC.])])[]
FP_COMPARE_VERSIONS([$fptools_cv_happy_version],[-lt],[1.20.0],
[AC_MSG_ERROR([Happy version 1.20.0 or later is required to compile GHC.])])[]
fi
HappyVersion=$fptools_cv_happy_version;
AC_SUBST(HappyVersion)
......
......@@ -1682,7 +1682,7 @@ interpretPackageEnv dflags = do
return dflags
Just envfile -> do
content <- readFile envfile
compilationProgressMsg dflags ("Loaded package environment from " ++ envfile)
compilationProgressMsg dflags (text "Loaded package environment from " <> text envfile)
let (_, dflags') = runCmdLine (runEwM (setFlagsFromEnvFile envfile content)) dflags
return dflags'
......
......@@ -38,7 +38,7 @@ import GHC.Types.Name
import GHC.Builtin.Names ( gHC_PRIMOPWRAPPERS )
import GHC.Core.TyCon ( TyCon, isPrimTyCon, PrimRep(..) )
import GHC.Core.Type
import GHC.Types.RepType ( typePrimRep1, tyConPrimRep1 )
import GHC.Types.RepType ( tyConPrimRep1 )
import GHC.Types.Basic ( Arity, Fixity(..), FixityDirection(..), Boxity(..),
SourceText(..) )
import GHC.Types.SrcLoc ( wiredInSrcSpan )
......@@ -103,33 +103,17 @@ tagToEnumKey = mkPrimOpIdUnique (primOpTag TagToEnumOp)
\subsection[PrimOp-info]{The essential info about each @PrimOp@}
* *
************************************************************************
The @String@ in the @PrimOpInfos@ is the ``base name'' by which the user may
refer to the primitive operation. The conventional \tr{#}-for-
unboxed ops is added on later.
The reason for the funny characters in the names is so we do not
interfere with the programmer's Haskell name spaces.
We use @PrimKinds@ for the ``type'' information, because they're
(slightly) more convenient to use than @TyCons@.
-}
data PrimOpInfo
= Dyadic OccName -- string :: T -> T -> T
Type
| Monadic OccName -- string :: T -> T
Type
| Compare OccName -- string :: T -> T -> Int#
= Compare OccName -- string :: T -> T -> Int#
Type
| GenPrimOp OccName -- string :: \/a1..an . T1 -> .. -> Tk -> T
[TyVar]
[Type]
Type
mkDyadic, mkMonadic, mkCompare :: FastString -> Type -> PrimOpInfo
mkDyadic str ty = Dyadic (mkVarOccFS str) ty
mkMonadic str ty = Monadic (mkVarOccFS str) ty
mkCompare :: FastString -> Type -> PrimOpInfo
mkCompare str ty = Compare (mkVarOccFS str) ty
mkGenPrimOp :: FastString -> [TyVar] -> [Type] -> Type -> PrimOpInfo
......@@ -575,8 +559,6 @@ primOpCodeSizeForeignCall = 4
primOpType :: PrimOp -> Type -- you may want to use primOpSig instead
primOpType op
= case primOpInfo op of
Dyadic _occ ty -> dyadic_fun_ty ty
Monadic _occ ty -> monadic_fun_ty ty
Compare _occ ty -> compare_fun_ty ty
GenPrimOp _occ tyvars arg_tys res_ty ->
......@@ -585,15 +567,11 @@ primOpType op
primOpResultType :: PrimOp -> Type
primOpResultType op
= case primOpInfo op of
Dyadic _occ ty -> ty
Monadic _occ ty -> ty
Compare _occ _ty -> intPrimTy
GenPrimOp _occ _tyvars _arg_tys res_ty -> res_ty
primOpOcc :: PrimOp -> OccName
primOpOcc op = case primOpInfo op of
Dyadic occ _ -> occ
Monadic occ _ -> occ
Compare occ _ -> occ
GenPrimOp occ _ _ _ -> occ
......@@ -692,8 +670,8 @@ primOpWrapperId op = mkVanillaGlobalWithInfo name ty info
isComparisonPrimOp :: PrimOp -> Bool
isComparisonPrimOp op = case primOpInfo op of
Compare {} -> True
_ -> False
Compare {} -> True
GenPrimOp {} -> False
-- primOpSig is like primOpType but gives the result split apart:
-- (type variables, argument types, result type)
......@@ -706,8 +684,6 @@ primOpSig op
arity = length arg_tys
(tyvars, arg_tys, res_ty)
= case (primOpInfo op) of
Monadic _occ ty -> ([], [ty], ty )
Dyadic _occ ty -> ([], [ty,ty], ty )
Compare _occ ty -> ([], [ty,ty], intPrimTy)
GenPrimOp _occ tyvars arg_tys res_ty -> (tyvars, arg_tys, res_ty )
......@@ -722,8 +698,6 @@ data PrimOpResultInfo
getPrimOpResultInfo :: PrimOp -> PrimOpResultInfo
getPrimOpResultInfo op
= case (primOpInfo op) of
Dyadic _ ty -> ReturnsPrim (typePrimRep1 ty)
Monadic _ ty -> ReturnsPrim (typePrimRep1 ty)
Compare _ _ -> ReturnsPrim (tyConPrimRep1 intPrimTyCon)
GenPrimOp _ _ _ ty | isPrimTyCon tc -> ReturnsPrim (tyConPrimRep1 tc)
| otherwise -> ReturnsAlg tc
......@@ -747,9 +721,7 @@ commutableOp :: PrimOp -> Bool
-- Utils:
dyadic_fun_ty, monadic_fun_ty, compare_fun_ty :: Type -> Type
dyadic_fun_ty ty = mkVisFunTysMany [ty, ty] ty
monadic_fun_ty ty = mkVisFunTyMany ty ty
compare_fun_ty :: Type -> Type
compare_fun_ty ty = mkVisFunTysMany [ty, ty] intPrimTy
-- Output stuff:
......
......@@ -42,11 +42,9 @@
-- (eg, out_of_line), whilst avoiding parsing complex expressions
-- needed for strictness info.
--
-- type refers to the general category of the primop. Valid settings include,
-- type refers to the general category of the primop. There are only two:
--
-- * Compare: A comparison operation of the shape a -> a -> Int#
-- * Monadic: A unary operation of shape a -> a
-- * Dyadic: A binary operation of shape a -> a -> a
-- * GenPrimOp: Any other sort of primop
--
......@@ -238,23 +236,23 @@ primtype Int8#
primop Int8Extend "extendInt8#" GenPrimOp Int8# -> Int#
primop Int8Narrow "narrowInt8#" GenPrimOp Int# -> Int8#
primop Int8NegOp "negateInt8#" Monadic Int8# -> Int8#
primop Int8NegOp "negateInt8#" GenPrimOp Int8# -> Int8#
primop Int8AddOp "plusInt8#" Dyadic Int8# -> Int8# -> Int8#
primop Int8AddOp "plusInt8#" GenPrimOp Int8# -> Int8# -> Int8#
with
commutable = True
primop Int8SubOp "subInt8#" Dyadic Int8# -> Int8# -> Int8#
primop Int8SubOp "subInt8#" GenPrimOp Int8# -> Int8# -> Int8#
primop Int8MulOp "timesInt8#" Dyadic Int8# -> Int8# -> Int8#
primop Int8MulOp "timesInt8#" GenPrimOp Int8# -> Int8# -> Int8#
with
commutable = True
primop Int8QuotOp "quotInt8#" Dyadic Int8# -> Int8# -> Int8#
primop Int8QuotOp "quotInt8#" GenPrimOp Int8# -> Int8# -> Int8#
with
can_fail = True
primop Int8RemOp "remInt8#" Dyadic Int8# -> Int8# -> Int8#
primop Int8RemOp "remInt8#" GenPrimOp Int8# -> Int8# -> Int8#
with
can_fail = True
......@@ -279,23 +277,23 @@ primtype Word8#
primop Word8Extend "extendWord8#" GenPrimOp Word8# -> Word#
primop Word8Narrow "narrowWord8#" GenPrimOp Word# -> Word8#
primop Word8NotOp "notWord8#" Monadic Word8# -> Word8#
primop Word8NotOp "notWord8#" GenPrimOp Word8# -> Word8#
primop Word8AddOp "plusWord8#" Dyadic Word8# -> Word8# -> Word8#
primop Word8AddOp "plusWord8#" GenPrimOp Word8# -> Word8# -> Word8#
with
commutable = True
primop Word8SubOp "subWord8#" Dyadic Word8# -> Word8# -> Word8#
primop Word8SubOp "subWord8#" GenPrimOp Word8# -> Word8# -> Word8#
primop Word8MulOp "timesWord8#" Dyadic Word8# -> Word8# -> Word8#
primop Word8MulOp "timesWord8#" GenPrimOp Word8# -> Word8# -> Word8#
with
commutable = True
primop Word8QuotOp "quotWord8#" Dyadic Word8# -> Word8# -> Word8#
primop Word8QuotOp "quotWord8#" GenPrimOp Word8# -> Word8# -> Word8#
with
can_fail = True
primop Word8RemOp "remWord8#" Dyadic Word8# -> Word8# -> Word8#
primop Word8RemOp "remWord8#" GenPrimOp Word8# -> Word8# -> Word8#
with
can_fail = True
......@@ -320,23 +318,23 @@ primtype Int16#
primop Int16Extend "extendInt16#" GenPrimOp Int16# -> Int#
primop Int16Narrow "narrowInt16#" GenPrimOp Int# -> Int16#
primop Int16NegOp "negateInt16#" Monadic Int16# -> Int16#
primop Int16NegOp "negateInt16#" GenPrimOp Int16# -> Int16#
primop Int16AddOp "plusInt16#" Dyadic Int16# -> Int16# -> Int16#
primop Int16AddOp "plusInt16#" GenPrimOp Int16# -> Int16# -> Int16#
with
commutable = True
primop Int16SubOp "subInt16#" Dyadic Int16# -> Int16# -> Int16#
primop Int16SubOp "subInt16#" GenPrimOp Int16# -> Int16# -> Int16#
primop Int16MulOp "timesInt16#" Dyadic Int16# -> Int16# -> Int16#
primop Int16MulOp "timesInt16#" GenPrimOp Int16# -> Int16# -> Int16#
with
commutable = True
primop Int16QuotOp "quotInt16#" Dyadic Int16# -> Int16# -> Int16#
primop Int16QuotOp "quotInt16#" GenPrimOp Int16# -> Int16# -> Int16#
with
can_fail = True
primop Int16RemOp "remInt16#" Dyadic Int16# -> Int16# -> Int16#
primop Int16RemOp "remInt16#" GenPrimOp Int16# -> Int16# -> Int16#
with
can_fail = True
......@@ -361,23 +359,23 @@ primtype Word16#
primop Word16Extend "extendWord16#" GenPrimOp Word16# -> Word#
primop Word16Narrow "narrowWord16#" GenPrimOp Word# -> Word16#
primop Word16NotOp "notWord16#" Monadic Word16# -> Word16#
primop Word16NotOp "notWord16#" GenPrimOp Word16# -> Word16#
primop Word16AddOp "plusWord16#" Dyadic Word16# -> Word16# -> Word16#
primop Word16AddOp "plusWord16#" GenPrimOp Word16# -> Word16# -> Word16#
with
commutable = True
primop Word16SubOp "subWord16#" Dyadic Word16# -> Word16# -> Word16#
primop Word16SubOp "subWord16#" GenPrimOp Word16# -> Word16# -> Word16#
primop Word16MulOp "timesWord16#" Dyadic Word16# -> Word16# -> Word16#
primop Word16MulOp "timesWord16#" GenPrimOp Word16# -> Word16# -> Word16#
with
commutable = True
primop Word16QuotOp "quotWord16#" Dyadic Word16# -> Word16# -> Word16#
primop Word16QuotOp "quotWord16#" GenPrimOp Word16# -> Word16# -> Word16#
with
can_fail = True
primop Word16RemOp "remWord16#" Dyadic Word16# -> Word16# -> Word16#
primop Word16RemOp "remWord16#" GenPrimOp Word16# -> Word16# -> Word16#
with
can_fail = True
......@@ -420,16 +418,16 @@ section "Int#"
primtype Int#
primop IntAddOp "+#" Dyadic
primop IntAddOp "+#" GenPrimOp
Int# -> Int# -> Int#
with commutable = True
fixity = infixl 6
primop IntSubOp "-#" Dyadic Int# -> Int# -> Int#
primop IntSubOp "-#" GenPrimOp Int# -> Int# -> Int#
with fixity = infixl 6
primop IntMulOp "*#"
Dyadic Int# -> Int# -> Int#
GenPrimOp Int# -> Int# -> Int#
{Low word of signed integer multiply.}
with commutable = True
fixity = infixl 7
......@@ -442,7 +440,7 @@ primop IntMul2Op "timesInt2#" GenPrimOp
0#) or not (isHighNeeded = 1#).}
primop IntMulMayOfloOp "mulIntMayOflo#"
Dyadic Int# -> Int# -> Int#
GenPrimOp Int# -> Int# -> Int#
{Return non-zero if there is any possibility that the upper word of a
signed integer multiply might contain useful information. Return
zero only if you are completely sure that no overflow can occur.
......@@ -465,14 +463,14 @@ primop IntMulMayOfloOp "mulIntMayOflo#"
}
with commutable = True
primop IntQuotOp "quotInt#" Dyadic
primop IntQuotOp "quotInt#" GenPrimOp
Int# -> Int# -> Int#
{Rounds towards zero. The behavior is undefined if the second argument is
zero.
}
with can_fail = True
primop IntRemOp "remInt#" Dyadic
primop IntRemOp "remInt#" GenPrimOp
Int# -> Int# -> Int#
{Satisfies \texttt{(quotInt\# x y) *\# y +\# (remInt\# x y) == x}. The
behavior is undefined if the second argument is zero.
......@@ -484,22 +482,22 @@ primop IntQuotRemOp "quotRemInt#" GenPrimOp
{Rounds towards zero.}
with can_fail = True
primop AndIOp "andI#" Dyadic Int# -> Int# -> Int#
primop AndIOp "andI#" GenPrimOp Int# -> Int# -> Int#
{Bitwise "and".}
with commutable = True
primop OrIOp "orI#" Dyadic Int# -> Int# -> Int#
primop OrIOp "orI#" GenPrimOp Int# -> Int# -> Int#
{Bitwise "or".}
with commutable = True
primop XorIOp "xorI#" Dyadic Int# -> Int# -> Int#
primop XorIOp "xorI#" GenPrimOp Int# -> Int# -> Int#
{Bitwise "xor".}
with commutable = True
primop NotIOp "notI#" Monadic Int# -> Int#
primop NotIOp "notI#" GenPrimOp Int# -> Int#
{Bitwise "not", also known as the binary complement.}
primop IntNegOp "negateInt#" Monadic Int# -> Int#
primop IntNegOp "negateInt#" GenPrimOp Int# -> Int#
{Unary negation.
Since the negative {\tt Int#} range extends one further than the
positive range, {\tt negateInt#} of the most negative number is an
......@@ -573,7 +571,7 @@ section "Word#"
primtype Word#
primop WordAddOp "plusWord#" Dyadic Word# -> Word# -> Word#
primop WordAddOp "plusWord#" GenPrimOp Word# -> Word# -> Word#
with commutable = True
primop WordAddCOp "addWordC#" GenPrimOp Word# -> Word# -> (# Word#, Int# #)
......@@ -596,9 +594,9 @@ primop WordAdd2Op "plusWord2#" GenPrimOp Word# -> Word# -> (# Word#, Wor
with code_size = 2
commutable = True
primop WordSubOp "minusWord#" Dyadic Word# -> Word# -> Word#
primop WordSubOp "minusWord#" GenPrimOp Word# -> Word# -> Word#
primop WordMulOp "timesWord#" Dyadic Word# -> Word# -> Word#
primop WordMulOp "timesWord#" GenPrimOp Word# -> Word# -> Word#
with commutable = True
-- Returns (# high, low #)
......@@ -606,10 +604,10 @@ primop WordMul2Op "timesWord2#" GenPrimOp
Word# -> Word# -> (# Word#, Word# #)
with commutable = True
primop WordQuotOp "quotWord#" Dyadic Word# -> Word# -> Word#
primop WordQuotOp "quotWord#" GenPrimOp Word# -> Word# -> Word#
with can_fail = True
primop WordRemOp "remWord#" Dyadic Word# -> Word# -> Word#
primop WordRemOp "remWord#" GenPrimOp Word# -> Word# -> Word#
with can_fail = True
primop WordQuotRemOp "quotRemWord#" GenPrimOp
......@@ -622,16 +620,16 @@ primop WordQuotRem2Op "quotRemWord2#" GenPrimOp
Requires that high word < divisor.}
with can_fail = True
primop AndOp "and#" Dyadic Word# -> Word# -> Word#
primop AndOp "and#" GenPrimOp Word# -> Word# -> Word#
with commutable = True
primop OrOp "or#" Dyadic Word# -> Word# -> Word#
primop OrOp "or#" GenPrimOp Word# -> Word# -> Word#
with commutable = True
primop XorOp "xor#" Dyadic Word# -> Word# -> Word#
primop XorOp "xor#" GenPrimOp Word# -> Word# -> Word#
with commutable = True
primop NotOp "not#" Monadic Word# -> Word#
primop NotOp "not#" GenPrimOp Word# -> Word#
primop SllOp "uncheckedShiftL#" GenPrimOp Word# -> Int# -> Word#
{Shift left logical. Result undefined if shift amount is not
......@@ -650,79 +648,79 @@ primop WordNeOp "neWord#" Compare Word# -> Word# -> Int#
primop WordLtOp "ltWord#" Compare Word# -> Word# -> Int#
primop WordLeOp "leWord#" Compare Word# -> Word# -> Int#
primop PopCnt8Op "popCnt8#" Monadic Word# -> Word#
primop PopCnt8Op "popCnt8#" GenPrimOp Word# -> Word#
{Count the number of set bits in the lower 8 bits of a word.}
primop PopCnt16Op "popCnt16#" Monadic Word# -> Word#
primop PopCnt16Op "popCnt16#" GenPrimOp Word# -> Word#
{Count the number of set bits in the lower 16 bits of a word.}
primop PopCnt32Op "popCnt32#" Monadic Word# -> Word#
primop PopCnt32Op "popCnt32#" GenPrimOp Word# -> Word#
{Count the number of set bits in the lower 32 bits of a word.}
primop PopCnt64Op "popCnt64#" GenPrimOp WORD64 -> Word#
{Count the number of set bits in a 64-bit word.}
primop PopCntOp "popCnt#" Monadic Word# -> Word#
primop PopCntOp "popCnt#" GenPrimOp Word# -> Word#
{Count the number of set bits in a word.}
primop Pdep8Op "pdep8#" Dyadic Word# -> Word# -> Word#
primop Pdep8Op "pdep8#" GenPrimOp Word# -> Word# -> Word#
{Deposit bits to lower 8 bits of a word at locations specified by a mask.}
primop Pdep16Op "pdep16#" Dyadic Word# -> Word# -> Word#
primop Pdep16Op "pdep16#" GenPrimOp Word# -> Word# -> Word#
{Deposit bits to lower 16 bits of a word at locations specified by a mask.}
primop Pdep32Op "pdep32#" Dyadic Word# -> Word# -> Word#
primop Pdep32Op "pdep32#" GenPrimOp Word# -> Word# -> Word#
{Deposit bits to lower 32 bits of a word at locations specified by a mask.}
primop Pdep64Op "pdep64#" GenPrimOp WORD64 -> WORD64 -> WORD64
{Deposit bits to a word at locations specified by a mask.}
primop PdepOp "pdep#" Dyadic Word# -> Word# -> Word#
primop PdepOp "pdep#" GenPrimOp Word# -> Word# -> Word#
{Deposit bits to a word at locations specified by a mask.}
primop Pext8Op "pext8#" Dyadic Word# -> Word# -> Word#
primop Pext8Op "pext8#" GenPrimOp Word# -> Word# -> Word#
{Extract bits from lower 8 bits of a word at locations specified by a mask.}
primop Pext16Op "pext16#" Dyadic Word# -> Word# -> Word#
primop Pext16Op "pext16#" GenPrimOp Word# -> Word# -> Word#
{Extract bits from lower 16 bits of a word at locations specified by a mask.}
primop Pext32Op "pext32#" Dyadic Word# -> Word# -> Word#
primop Pext32Op "pext32#" GenPrimOp Word# -> Word# -> Word#
{Extract bits from lower 32 bits of a word at locations specified by a mask.}
primop Pext64Op "pext64#" GenPrimOp WORD64 -> WORD64 -> WORD64
{Extract bits from a word at locations specified by a mask.}
primop PextOp "pext#" Dyadic Word# -> Word# -> Word#
primop PextOp "pext#" GenPrimOp Word# -> Word# -> Word#
{Extract bits from a word at locations specified by a mask.}
primop Clz8Op "clz8#" Monadic Word# -> Word#
primop Clz8Op "clz8#" GenPrimOp Word# -> Word#
{Count leading zeros in the lower 8 bits of a word.}
primop Clz16Op "clz16#" Monadic Word# -> Word#
primop Clz16Op "clz16#" GenPrimOp Word# -> Word#
{Count leading zeros in the lower 16 bits of a word.}
primop Clz32Op "clz32#" Monadic Word# -> Word#
primop Clz32Op "clz32#" GenPrimOp Word# -> Word#
{Count leading zeros in the lower 32 bits of a word.}
primop Clz64Op "clz64#" GenPrimOp WORD64 -> Word#
{Count leading zeros in a 64-bit word.}
primop ClzOp "clz#" Monadic Word# -> Word#
primop ClzOp "clz#" GenPrimOp Word# -> Word#
{Count leading zeros in a word.}
primop Ctz8Op "ctz8#" Monadic Word# -> Word#
primop Ctz8Op "ctz8#" GenPrimOp Word# -> Word#
{Count trailing zeros in the lower 8 bits of a word.}
primop Ctz16Op "ctz16#" Monadic Word# -> Word#
primop Ctz16Op "ctz16#" GenPrimOp Word# -> Word#
{Count trailing zeros in the lower 16 bits of a word.}
primop Ctz32Op "ctz32#" Monadic Word# -> Word#
primop Ctz32Op "ctz32#" GenPrimOp Word# -> Word#
{Count trailing zeros in the lower 32 bits of a word.}
primop Ctz64Op "ctz64#" GenPrimOp WORD64 -> Word#
{Count trailing zeros in a 64-bit word.}
primop CtzOp "ctz#" Monadic Word# -> Word#
primop CtzOp "ctz#" GenPrimOp Word# -> Word#
{Count trailing zeros in a word.}
primop BSwap16Op "byteSwap16#" Monadic Word# -> Word#
primop BSwap16Op "byteSwap16#" GenPrimOp Word# -> Word#
{Swap bytes in the lower 16 bits of a word. The higher bytes are undefined. }
primop BSwap32Op "byteSwap32#" Monadic Word# -> Word#
primop BSwap32Op "byteSwap32#" GenPrimOp Word# -> Word#
{Swap bytes in the lower 32 bits of a word. The higher bytes are undefined. }
primop BSwap64Op "byteSwap64#" Monadic WORD64 -> WORD64
primop BSwap64Op "byteSwap64#" GenPrimOp WORD64 -> WORD64
{Swap bytes in a 64 bits of a word.}
primop BSwapOp "byteSwap#" Monadic Word# -> Word#
primop BSwapOp "byteSwap#" GenPrimOp Word# -> Word#
{Swap bytes in a word.}
primop BRev8Op "bitReverse8#" Monadic Word# -> Word#
primop BRev8Op "bitReverse8#" GenPrimOp Word# -> Word#
{Reverse the order of the bits in a 8-bit word.}
primop BRev16Op "bitReverse16#" Monadic Word# -> Word#
primop BRev16Op "bitReverse16#" GenPrimOp Word# -> Word#
{Reverse the order of the bits in a 16-bit word.}
primop BRev32Op "bitReverse32#" Monadic Word# -> Word#
primop BRev32Op "bitReverse32#" GenPrimOp Word# -> Word#
{Reverse the order of the bits in a 32-bit word.}
primop BRev64Op "bitReverse64#" Monadic WORD64 -> WORD64
primop BRev64Op "bitReverse64#" GenPrimOp WORD64 -> WORD64
{Reverse the order of the bits in a 64-bit word.}
primop BRevOp "bitReverse#" Monadic Word# -> Word#
primop BRevOp "bitReverse#" GenPrimOp Word# -> Word#
{Reverse the order of the bits in a word.}
------------------------------------------------------------------------
......@@ -730,12 +728,12 @@ section "Narrowings"
{Explicit narrowing of native-sized ints or words.}
------------------------------------------------------------------------
primop Narrow8IntOp "narrow8Int#" Monadic Int# -> Int#
primop Narrow16IntOp "narrow16Int#" Monadic Int# -> Int#
primop Narrow32IntOp "narrow32Int#" Monadic Int# -> Int#
primop Narrow8WordOp "narrow8Word#" Monadic Word# -> Word#
primop Narrow16WordOp "narrow16Word#" Monadic Word# -> Word#
primop Narrow32WordOp "narrow32Word#" Monadic Word# -> Word#
primop Narrow8IntOp "narrow8Int#" GenPrimOp Int# -> Int#
primop Narrow16IntOp "narrow16Int#" GenPrimOp Int# -> Int#
primop Narrow32IntOp "narrow32Int#" GenPrimOp Int# -> Int#
primop Narrow8WordOp "narrow8Word#" GenPrimOp Word# -> Word#
primop Narrow16WordOp "narrow16Word#" GenPrimOp Word# -> Word#
primop Narrow32WordOp "narrow32Word#" GenPrimOp Word# -> Word#
------------------------------------------------------------------------
section "Double#"
......@@ -766,27 +764,27 @@ primop DoubleLtOp "<##" Compare Double# -> Double# -> Int#
primop DoubleLeOp "<=##" Compare Double# -> Double# -> Int#
with fixity = infix 4
primop DoubleAddOp "+##" Dyadic
primop DoubleAddOp "+##" GenPrimOp
Double# -> Double# -> Double#
with commutable = True
fixity = infixl 6
primop DoubleSubOp "-##" Dyadic Double# -> Double# -> Double#
primop DoubleSubOp "-##" GenPrimOp Double# -> Double# -> Double#
with fixity = infixl 6
primop DoubleMulOp "*##" Dyadic
primop DoubleMulOp "*##" GenPrimOp
Double# -> Double# -> Double#
with commutable = True
fixity = infixl 7
primop DoubleDivOp "/##" Dyadic
primop DoubleDivOp "/##" GenPrimOp
Double# -> Double# -> Double#
with can_fail = True
fixity = infixl 7
primop DoubleNegOp "negateDouble#" Monadic Double# -> Double#
primop DoubleNegOp "negateDouble#" GenPrimOp Double# -> Double#
primop DoubleFabsOp "fabsDouble#" Monadic Double# -> Double#
primop DoubleFabsOp "fabsDouble#" GenPrimOp Double# -> Double#
primop Double2IntOp "double2Int#" GenPrimOp Double# -> Int#
{Truncates a {\tt Double#} value to the nearest {\tt Int#}.
......@@ -795,96 +793,96 @@ primop Double2IntOp "double2Int#" GenPrimOp Double# -> Int#
primop Double2FloatOp "double2Float#" GenPrimOp Double# -> Float#
primop DoubleExpOp "expDouble#" Monadic
primop DoubleExpOp "expDouble#" GenPrimOp
Double# -> Double#
with
code_size = { primOpCodeSizeForeignCall }
primop DoubleExpM1Op "expm1Double#" Monadic
primop DoubleExpM1Op "expm1Double#" GenPrimOp
Double# -> Double#
with
code_size = { primOpCodeSizeForeignCall }
primop DoubleLogOp "logDouble#" Monadic
primop DoubleLogOp "logDouble#" GenPrimOp
Double# -> Double#
with
code_size = { primOpCodeSizeForeignCall }
can_fail = True
primop DoubleLog1POp "log1pDouble#" Monadic
primop DoubleLog1POp "log1pDouble#" GenPrimOp
Double# -> Double#
with
code_size = { primOpCodeSizeForeignCall }
can_fail = True
primop DoubleSqrtOp "sqrtDouble#" Monadic
primop DoubleSqrtOp "sqrtDouble#" GenPrimOp
Double# -> Double#
with
code_size = { primOpCodeSizeForeignCall }
primop DoubleSinOp "sinDouble#" Monadic
primop DoubleSinOp "sinDouble#" GenPrimOp
Double# -> Double#
with
code_size = { primOpCodeSizeForeignCall }
primop DoubleCosOp "cosDouble#" Monadic
primop DoubleCosOp "cosDouble#" GenPrimOp
Double# -> Double#
with
code_size = { primOpCodeSizeForeignCall }
primop DoubleTanOp "tanDouble#" Monadic
primop DoubleTanOp "tanDouble#" GenPrimOp
Double# -> Double#
with
code_size = { primOpCodeSizeForeignCall }
primop DoubleAsinOp "asinDouble#" Monadic
primop DoubleAsinOp "asinDouble#" GenPrimOp
Double# -> Double#
with
code_size = { primOpCodeSizeForeignCall }
can_fail = True
primop DoubleAcosOp "acosDouble#" Monadic
primop DoubleAcosOp "acosDouble#" GenPrimOp
Double# -> Double#
with
code_size = { primOpCodeSizeForeignCall }
can_fail = True
primop DoubleAtanOp "atanDouble#" Monadic
primop DoubleAtanOp "atanDouble#" GenPrimOp
Double# -> Double#
with
code_size = { primOpCodeSizeForeignCall }
primop DoubleSinhOp "sinhDouble#" Monadic
primop DoubleSinhOp "sinhDouble#" GenPrimOp
Double# -> Double#
with
code_size = { primOpCodeSizeForeignCall }
primop DoubleCoshOp "coshDouble#" Monadic
primop DoubleCoshOp "coshDouble#" GenPrimOp
Double# -> Double#
with
code_size = { primOpCodeSizeForeignCall }
primop DoubleTanhOp "tanhDouble#" Monadic
primop DoubleTanhOp "tanhDouble#" GenPrimOp
Double# -> Double#
with
code_size = { primOpCodeSizeForeignCall }
primop DoubleAsinhOp "asinhDouble#" Monadic
primop DoubleAsinhOp "asinhDouble#" GenPrimOp
Double# -> Double#
with
code_size = { primOpCodeSizeForeignCall }
primop DoubleAcoshOp "acoshDouble#" Monadic
primop DoubleAcoshOp "acoshDouble#" GenPrimOp
Double# -> Double#
with
code_size = { primOpCodeSizeForeignCall }
primop DoubleAtanhOp "atanhDouble#" Monadic
primop DoubleAtanhOp "atanhDouble#" GenPrimOp
Double# -> Double#
with
code_size = { primOpCodeSizeForeignCall }
primop DoublePowerOp "**##" Dyadic
primop DoublePowerOp "**##" GenPrimOp
Double# -> Double# -> Double#
{Exponentiation.}
with
......@@ -924,119 +922,119 @@ primop FloatNeOp "neFloat#" Compare
primop FloatLtOp "ltFloat#" Compare Float# -> Float# -> Int#
primop FloatLeOp "leFloat#" Compare Float# -> Float# -> Int#
primop FloatAddOp "plusFloat#" Dyadic
primop FloatAddOp "plusFloat#" GenPrimOp
Float# -> Float# -> Float#
with commutable = True
primop FloatSubOp "minusFloat#" Dyadic Float# -> Float# -> Float#
primop FloatSubOp "minusFloat#" GenPrimOp Float# -> Float# -> Float#
primop FloatMulOp "timesFloat#" Dyadic
primop FloatMulOp "timesFloat#" GenPrimOp
Float# -> Float# -> Float#
with commutable = True
primop FloatDivOp "divideFloat#" Dyadic
primop FloatDivOp "divideFloat#" GenPrimOp
Float# -> Float# -> Float#
with can_fail = True
primop FloatNegOp "negateFloat#" Monadic Float# -> Float#
primop FloatNegOp "negateFloat#" GenPrimOp Float# -> Float#
primop FloatFabsOp "fabsFloat#" Monadic Float# -> Float#
primop FloatFabsOp "fabsFloat#" GenPrimOp Float# -> Float#
primop Float2IntOp "float2Int#" GenPrimOp Float# -> Int#
{Truncates a {\tt Float#} value to the nearest {\tt Int#}.
Results are undefined if the truncation if truncation yields
a value outside the range of {\tt Int#}.}
primop FloatExpOp "expFloat#" Monadic
primop FloatExpOp "expFloat#" GenPrimOp
Float# -> Float#
with
code_size = { primOpCodeSizeForeignCall }
primop FloatExpM1Op "expm1Float#" Monadic
primop FloatExpM1Op "expm1Float#" GenPrimOp
Float# -> Float#
with
code_size = { primOpCodeSizeForeignCall }
primop FloatLogOp "logFloat#" Monadic
primop FloatLogOp "logFloat#" GenPrimOp
Float# -> Float#
with
code_size = { primOpCodeSizeForeignCall }
can_fail = True
primop FloatLog1POp "log1pFloat#" Monadic
primop FloatLog1POp "log1pFloat#" GenPrimOp
Float# -> Float#
with
code_size = { primOpCodeSizeForeignCall }
can_fail = True
primop FloatSqrtOp "sqrtFloat#" Monadic
primop FloatSqrtOp "sqrtFloat#" GenPrimOp
Float# -> Float#
with
code_size = { primOpCodeSizeForeignCall }
primop FloatSinOp "sinFloat#" Monadic
primop FloatSinOp "sinFloat#" GenPrimOp
Float# -> Float#
with
code_size = { primOpCodeSizeForeignCall }
primop FloatCosOp "cosFloat#" Monadic
primop FloatCosOp "cosFloat#" GenPrimOp
Float# -> Float#
with
code_size = { primOpCodeSizeForeignCall }
primop FloatTanOp "tanFloat#" Monadic
primop FloatTanOp "tanFloat#" GenPrimOp
Float# -> Float#
with
code_size = { primOpCodeSizeForeignCall }
primop FloatAsinOp "asinFloat#" Monadic
primop FloatAsinOp "asinFloat#" GenPrimOp
Float# -> Float#
with
code_size = { primOpCodeSizeForeignCall }
can_fail = True
primop FloatAcosOp "acosFloat#" Monadic
primop FloatAcosOp "acosFloat#" GenPrimOp
Float# -> Float#
with
code_size = { primOpCodeSizeForeignCall }
can_fail = True
primop FloatAtanOp "atanFloat#" Monadic
primop FloatAtanOp "atanFloat#" GenPrimOp
Float# -> Float#
with
code_size = { primOpCodeSizeForeignCall }
primop FloatSinhOp "sinhFloat#" Monadic
primop FloatSinhOp "sinhFloat#" GenPrimOp
Float# -> Float#
with
code_size = { primOpCodeSizeForeignCall }
primop FloatCoshOp "coshFloat#" Monadic
primop FloatCoshOp "coshFloat#" GenPrimOp
Float# -> Float#
with
code_size = { primOpCodeSizeForeignCall }
primop FloatTanhOp "tanhFloat#" Monadic
primop FloatTanhOp "tanhFloat#" GenPrimOp
Float# -> Float#
with
code_size = { primOpCodeSizeForeignCall }
primop FloatAsinhOp "asinhFloat#" Monadic
primop FloatAsinhOp "asinhFloat#" GenPrimOp
Float# -> Float#
with
code_size = { primOpCodeSizeForeignCall }
primop FloatAcoshOp "acoshFloat#" Monadic
primop FloatAcoshOp "acoshFloat#" GenPrimOp
Float# -> Float#
with
code_size = { primOpCodeSizeForeignCall }
primop FloatAtanhOp "atanhFloat#" Monadic
primop FloatAtanhOp "atanhFloat#" GenPrimOp
Float# -> Float#
with
code_size = { primOpCodeSizeForeignCall }
primop FloatPowerOp "powerFloat#" Dyadic
primop FloatPowerOp "powerFloat#" GenPrimOp
Float# -> Float# -> Float#
with
code_size = { primOpCodeSizeForeignCall }
......@@ -3575,48 +3573,48 @@ primop VecInsertOp "insert#" GenPrimOp
llvm_only = True
vector = ALL_VECTOR_TYPES
primop VecAddOp "plus#" Dyadic
primop VecAddOp "plus#" GenPrimOp
VECTOR -> VECTOR -> VECTOR
{ Add two vectors element-wise. }
with commutable = True
llvm_only = True
vector = ALL_VECTOR_TYPES
primop VecSubOp "minus#" Dyadic
primop VecSubOp "minus#" GenPrimOp
VECTOR -> VECTOR -> VECTOR
{ Subtract two vectors element-wise. }
with llvm_only = True
vector = ALL_VECTOR_TYPES
primop VecMulOp "times#" Dyadic
primop VecMulOp "times#" GenPrimOp
VECTOR -> VECTOR -> VECTOR
{ Multiply two vectors element-wise. }
with commutable = True
llvm_only = True
vector = ALL_VECTOR_TYPES
primop VecDivOp "divide#" Dyadic
primop VecDivOp "divide#" GenPrimOp
VECTOR -> VECTOR -> VECTOR
{ Divide two vectors element-wise. }
with can_fail = True
llvm_only = True
vector = FLOAT_VECTOR_TYPES
primop VecQuotOp "quot#" Dyadic
primop VecQuotOp "quot#" GenPrimOp
VECTOR -> VECTOR -> VECTOR
{ Rounds towards zero element-wise. }
with can_fail = True
llvm_only = True
vector = INT_VECTOR_TYPES
primop VecRemOp "rem#" Dyadic
primop VecRemOp "rem#" GenPrimOp
VECTOR -> VECTOR -> VECTOR
{ Satisfies \texttt{(quot\# x y) times\# y plus\# (rem\# x y) == x}. }
with can_fail = True
llvm_only = True
vector = INT_VECTOR_TYPES
primop VecNegOp "negate#" Monadic
primop VecNegOp "negate#" GenPrimOp
VECTOR -> VECTOR
{ Negate element-wise. }
with llvm_only = True
......
......@@ -237,9 +237,8 @@ pprImm (ImmInteger i) = integer i
pprImm (ImmCLbl l) = ppr l
pprImm (ImmIndex l i) = ppr l <> char '+' <> int i
pprImm (ImmLit s) = s
pprImm (ImmFloat _) = text "naughty float immediate"
pprImm (ImmDouble _) = text "naughty double immediate"
pprImm (ImmFloat f) = float $ fromRational f
pprImm (ImmDouble d) = double $ fromRational d
pprImm (ImmConstantSum a b) = pprImm a <> char '+' <> pprImm b
pprImm (ImmConstantDiff a b) = pprImm a <> char '-'
......@@ -337,13 +336,8 @@ pprDataItem platform lit
<> int (fromIntegral (fromIntegral x :: Word32))]
ppr_item FF32 (CmmFloat r _)
= let bs = floatToBytes (fromRational r)
in map (\b -> text "\t.byte\t" <> pprImm (ImmInt b)) bs
ppr_item FF64 (CmmFloat r _)
= let bs = doubleToBytes (fromRational r)
in map (\b -> text "\t.byte\t" <> pprImm (ImmInt b)) bs
ppr_item FF32 _ = [text "\t.float\t" <> pprImm imm]
ppr_item FF64 _ = [text "\t.double\t" <> pprImm imm]
ppr_item _ _
= panic "PPC.Ppr.pprDataItem: no match"
......
......@@ -9,9 +9,6 @@
-----------------------------------------------------------------------------
module GHC.CmmToAsm.Ppr (
castFloatToWord8Array,
castDoubleToWord8Array,
floatToBytes,
doubleToBytes,
pprASCII,
pprString,
......@@ -44,13 +41,13 @@ import qualified Data.ByteString as BS
import GHC.Exts
import GHC.Word
-- -----------------------------------------------------------------------------
-- Converting floating-point literals to integrals for printing
castFloatToWord8Array :: STUArray s Int Float -> ST s (STUArray s Int Word8)
castFloatToWord8Array = U.castSTUArray
-- ToDo: this code is currently shared between SPARC and LLVM.
-- Similar functions for (single precision) floats are
-- present in the SPARC backend only. We need to fix both
-- LLVM and SPARC.
castDoubleToWord8Array :: STUArray s Int Double -> ST s (STUArray s Int Word8)
castDoubleToWord8Array = U.castSTUArray
......@@ -63,19 +60,6 @@ castDoubleToWord8Array = U.castSTUArray
-- ToDo: this stuff is very similar to the shenanigans in PprAbs,
-- could they be merged?
floatToBytes :: Float -> [Int]
floatToBytes f
= runST (do
arr <- newArray_ ((0::Int),3)
writeArray arr 0 f
arr <- castFloatToWord8Array arr
i0 <- readArray arr 0
i1 <- readArray arr 1
i2 <- readArray arr 2
i3 <- readArray arr 3
return (map fromIntegral [i0,i1,i2,i3])
)
doubleToBytes :: Double -> [Int]
doubleToBytes d
= runST (do
......
......@@ -25,6 +25,12 @@ where
import GHC.Prelude
import Data.Word
import qualified Data.Array.Unsafe as U ( castSTUArray )
import Data.Array.ST
import Control.Monad.ST
import GHC.CmmToAsm.SPARC.Regs
import GHC.CmmToAsm.SPARC.Instr
import GHC.CmmToAsm.SPARC.Cond
......@@ -369,6 +375,22 @@ pprDataItem platform lit
ppr_item II64 _ = [text "\t.quad\t" <> pprImm imm]
ppr_item _ _ = panic "SPARC.Ppr.pprDataItem: no match"
floatToBytes :: Float -> [Int]
floatToBytes f
= runST (do
arr <- newArray_ ((0::Int),3)
writeArray arr 0 f
arr <- castFloatToWord8Array arr
i0 <- readArray arr 0
i1 <- readArray arr 1
i2 <- readArray arr 2
i3 <- readArray arr 3
return (map fromIntegral [i0,i1,i2,i3])
)
castFloatToWord8Array :: STUArray s Int Float -> ST s (STUArray s Int Word8)
castFloatToWord8Array = U.castSTUArray
-- | Pretty print an instruction.
pprInstr :: Instr -> SDoc
......
......@@ -423,9 +423,8 @@ pprImm (ImmInteger i) = integer i
pprImm (ImmCLbl l) = ppr l
pprImm (ImmIndex l i) = ppr l <> char '+' <> int i
pprImm (ImmLit s) = s
pprImm (ImmFloat _) = text "naughty float immediate"
pprImm (ImmDouble _) = text "naughty double immediate"
pprImm (ImmFloat f) = float $ fromRational f
pprImm (ImmDouble d) = double $ fromRational d
pprImm (ImmConstantSum a b) = pprImm a <> char '+' <> pprImm b
pprImm (ImmConstantDiff a b) = pprImm a <> char '-'
......@@ -514,13 +513,8 @@ pprDataItem config lit
ppr_item II16 _ = [text "\t.word\t" <> pprImm imm]
ppr_item II32 _ = [text "\t.long\t" <> pprImm imm]
ppr_item FF32 (CmmFloat r _)
= let bs = floatToBytes (fromRational r)
in map (\b -> text "\t.byte\t" <> pprImm (ImmInt b)) bs
ppr_item FF64 (CmmFloat r _)
= let bs = doubleToBytes (fromRational r)
in map (\b -> text "\t.byte\t" <> pprImm (ImmInt b)) bs
ppr_item FF32 _ = [text "\t.float\t" <> pprImm imm]
ppr_item FF64 _ = [text "\t.double\t" <> pprImm imm]
ppr_item II64 _
= case platformOS platform of
......@@ -558,9 +552,6 @@ pprDataItem config lit
_ ->
[text "\t.quad\t" <> pprImm imm]
ppr_item _ _
= panic "X86.Ppr.ppr_item: no match"
asmComment :: SDoc -> SDoc
asmComment c = whenPprDebug $ text "# " <> c
......
......@@ -88,7 +88,7 @@ doBackpack [src_filename] = do
-- OK, so we have an LHsUnit PackageName, but we want an
-- LHsUnit HsComponentId. So let's rename it.
let pkgstate = unitState dflags
let bkp = renameHsUnits pkgstate (bkpPackageNameMap pkgstate pkgname_bkp) pkgname_bkp
let bkp = renameHsUnits pkgstate (bkpPackageNameMap pkgname_bkp) pkgname_bkp
initBkpM src_filename bkp $
forM_ (zip [1..] bkp) $ \(i, lunit) -> do
let comp_name = unLoc (hsunitName (unLoc lunit))
......@@ -96,7 +96,7 @@ doBackpack [src_filename] = do
innerBkpM $ do
let (cid, insts) = computeUnitId lunit
if null insts
then if cid == Indefinite (UnitId (fsLit "main")) Nothing
then if cid == Indefinite (UnitId (fsLit "main"))
then compileExe lunit
else compileUnit cid []
else typecheckUnit cid insts
......@@ -209,7 +209,7 @@ withBkpSession cid insts deps session_type do_this = do
withBkpExeSession :: [(Unit, ModRenaming)] -> BkpM a -> BkpM a
withBkpExeSession deps do_this = do
withBkpSession (Indefinite (UnitId (fsLit "main")) Nothing) [] deps ExeSession do_this
withBkpSession (Indefinite (UnitId (fsLit "main"))) [] deps ExeSession do_this
getSource :: IndefUnitId -> BkpM (LHsUnit HsComponentId)
getSource cid = do
......@@ -491,9 +491,10 @@ initBkpM file bkp m = do
-- | Print a compilation progress message, but with indentation according
-- to @level@ (for nested compilation).
backpackProgressMsg :: Int -> DynFlags -> String -> IO ()
backpackProgressMsg :: Int -> DynFlags -> SDoc -> IO ()
backpackProgressMsg level dflags msg =
compilationProgressMsg dflags $ replicate (level * 2) ' ' ++ msg
compilationProgressMsg dflags $ text (replicate (level * 2) ' ') -- TODO: use GHC.Utils.Ppr.RStr
<> msg
-- | Creates a 'Messager' for Backpack compilation; this is basically
-- a carbon copy of 'batchMsg' but calling 'backpackProgressMsg', which
......@@ -503,17 +504,18 @@ mkBackpackMsg = do
level <- getBkpLevel
return $ \hsc_env mod_index recomp mod_summary ->
let dflags = hsc_dflags hsc_env
state = unitState dflags
showMsg msg reason =
backpackProgressMsg level dflags $
showModuleIndex mod_index ++
msg ++ showModMsg dflags (recompileRequired recomp) mod_summary
++ reason
backpackProgressMsg level dflags $ pprWithUnitState state $
showModuleIndex mod_index <>
msg <> showModMsg dflags (recompileRequired recomp) mod_summary
<> reason
in case recomp of
MustCompile -> showMsg "Compiling " ""
MustCompile -> showMsg (text "Compiling ") empty
UpToDate
| verbosity (hsc_dflags hsc_env) >= 2 -> showMsg "Skipping " ""
| verbosity (hsc_dflags hsc_env) >= 2 -> showMsg (text "Skipping ") empty
| otherwise -> return ()
RecompBecause reason -> showMsg "Compiling " (" [" ++ reason ++ "]")
RecompBecause reason -> showMsg (text "Compiling ") (text " [" <> text reason <> text "]")
-- | 'PprStyle' for Backpack messages; here we usually want the module to
-- be qualified (so we can tell how it was instantiated.) But we try not
......@@ -531,27 +533,29 @@ msgTopPackage (i,n) (HsComponentId (PackageName fs_pn) _) = do
dflags <- getDynFlags
level <- getBkpLevel
liftIO . backpackProgressMsg level dflags
$ showModuleIndex (i, n) ++ "Processing " ++ unpackFS fs_pn
$ showModuleIndex (i, n) <> text "Processing " <> ftext fs_pn
-- | Message when we instantiate a Backpack unit.
msgUnitId :: Unit -> BkpM ()
msgUnitId pk = do
dflags <- getDynFlags
level <- getBkpLevel
let state = unitState dflags
liftIO . backpackProgressMsg level dflags
$ "Instantiating " ++ renderWithContext
(initSDocContext dflags backpackStyle)
(ppr pk)
$ pprWithUnitState state
$ text "Instantiating "
<> withPprStyle backpackStyle (ppr pk)
-- | Message when we include a Backpack unit.
msgInclude :: (Int,Int) -> Unit -> BkpM ()
msgInclude (i,n) uid = do
dflags <- getDynFlags
level <- getBkpLevel
let state = unitState dflags
liftIO . backpackProgressMsg level dflags
$ showModuleIndex (i, n) ++ "Including " ++
renderWithContext (initSDocContext dflags backpackStyle)
(ppr uid)
$ pprWithUnitState state
$ showModuleIndex (i, n) <> text "Including "
<> withPprStyle backpackStyle (ppr uid)
-- ----------------------------------------------------------------------------
-- Conversion from PackageName to HsComponentId
......@@ -560,12 +564,12 @@ type PackageNameMap a = Map PackageName a
-- For now, something really simple, since we're not actually going
-- to use this for anything
unitDefines :: UnitState -> LHsUnit PackageName -> (PackageName, HsComponentId)
unitDefines pkgstate (L _ HsUnit{ hsunitName = L _ pn@(PackageName fs) })
= (pn, HsComponentId pn (mkIndefUnitId pkgstate (UnitId fs)))
unitDefines :: LHsUnit PackageName -> (PackageName, HsComponentId)
unitDefines (L _ HsUnit{ hsunitName = L _ pn@(PackageName fs) })
= (pn, HsComponentId pn (Indefinite (UnitId fs)))
bkpPackageNameMap :: UnitState -> [LHsUnit PackageName] -> PackageNameMap HsComponentId
bkpPackageNameMap pkgstate units = Map.fromList (map (unitDefines pkgstate) units)
bkpPackageNameMap :: [LHsUnit PackageName] -> PackageNameMap HsComponentId
bkpPackageNameMap units = Map.fromList (map unitDefines units)
renameHsUnits :: UnitState -> PackageNameMap HsComponentId -> [LHsUnit PackageName] -> [LHsUnit HsComponentId]
renameHsUnits pkgstate m units = map (fmap renameHsUnit) units
......
......@@ -620,11 +620,12 @@ findObjectLinkable mod obj_fn obj_time = return (LM obj_time mod [DotO obj_fn])
-- Error messages
cannotFindModule :: DynFlags -> ModuleName -> FindResult -> SDoc
cannotFindModule flags mod res =
cannotFindModule dflags mod res = pprWithUnitState unit_state $
cantFindErr (sLit cannotFindMsg)
(sLit "Ambiguous module name")
flags mod res
dflags mod res
where
unit_state = unitState dflags
cannotFindMsg =
case res of
NotFound { fr_mods_hidden = hidden_mods
......
......@@ -887,25 +887,25 @@ oneShotMsg hsc_env recomp =
case recomp of
UpToDate ->
compilationProgressMsg (hsc_dflags hsc_env) $
"compilation IS NOT required"
text "compilation IS NOT required"
_ ->
return ()
batchMsg :: Messager
batchMsg hsc_env mod_index recomp mod_summary =
case recomp of
MustCompile -> showMsg "Compiling " ""
MustCompile -> showMsg (text "Compiling ") empty
UpToDate
| verbosity (hsc_dflags hsc_env) >= 2 -> showMsg "Skipping " ""
| verbosity (hsc_dflags hsc_env) >= 2 -> showMsg (text "Skipping ") empty
| otherwise -> return ()
RecompBecause reason -> showMsg "Compiling " (" [" ++ reason ++ "]")
RecompBecause reason -> showMsg (text "Compiling ") (text " [" <> text reason <> text "]")
where
dflags = hsc_dflags hsc_env
showMsg msg reason =
compilationProgressMsg dflags $
(showModuleIndex mod_index ++
msg ++ showModMsg dflags (recompileRequired recomp) mod_summary)
++ reason
(showModuleIndex mod_index <>
msg <> showModMsg dflags (recompileRequired recomp) mod_summary)
<> reason
--------------------------------------------------------------
-- Safe Haskell
......@@ -1174,7 +1174,8 @@ hscCheckSafe' m l = do
pkgTrustErr = unitBag $ mkErrMsg dflags l (pkgQual state) $
sep [ ppr (moduleName m)
<> text ": Can't be safely imported!"
, text "The package (" <> ppr (moduleUnit m)
, text "The package ("
<> (pprWithUnitState state $ ppr (moduleUnit m))
<> text ") the module resides in isn't trusted."
]
modTrustErr = unitBag $ mkErrMsg dflags l (pkgQual state) $
......@@ -1225,8 +1226,10 @@ checkPkgTrust pkgs = do
= acc
| otherwise
= (:acc) $ mkErrMsg dflags noSrcSpan (pkgQual state)
$ text "The package (" <> ppr pkg <> text ") is required" <>
text " to be trusted but it isn't!"
$ pprWithUnitState state
$ text "The package ("
<> ppr pkg
<> text ") is required to be trusted but it isn't!"
case errors of
[] -> return ()
_ -> (liftIO . throwIO . mkSrcErr . listToBag) errors
......@@ -1940,9 +1943,9 @@ dumpIfaceStats hsc_env = do
%* *
%********************************************************************* -}
showModuleIndex :: (Int, Int) -> String
showModuleIndex (i,n) = "[" ++ padded ++ " of " ++ n_str ++ "] "
showModuleIndex :: (Int, Int) -> SDoc
showModuleIndex (i,n) = text "[" <> pad <> int i <> text " of " <> int n <> text "] "
where
n_str = show n
i_str = show i
padded = replicate (length n_str - length i_str) ' ' ++ i_str
-- compute the length of x > 0 in base 10
len x = ceiling (logBase 10 (fromIntegral x+1) :: Float)
pad = text (replicate (len n - len i) ' ') -- TODO: use GHC.Utils.Ppr.RStr
......@@ -474,7 +474,7 @@ link' dflags batch_attempt_linking hpt
return Succeeded
else do
compilationProgressMsg dflags ("Linking " ++ exe_file ++ " ...")
compilationProgressMsg dflags (text "Linking " <> text exe_file <> text " ...")
-- Don't showPass in Batch mode; doLink will do that for us.
let link = case ghcLink dflags of
......
......@@ -30,6 +30,7 @@ import GHC.Utils.Misc
import GHC.Utils.Outputable
import GHC.Utils.Panic
import GHC.Utils.Ppr ( Mode(..) )
import {-# SOURCE #-} GHC.Unit.State
import System.IO ( Handle )
import Control.Monad.IO.Class
......@@ -46,7 +47,11 @@ showPprUnsafe a = showPpr unsafeGlobalDynFlags a
-- | Allows caller to specify the PrintUnqualified to use
showSDocForUser :: DynFlags -> PrintUnqualified -> SDoc -> String
showSDocForUser dflags unqual doc = renderWithContext (initSDocContext dflags (mkUserStyle unqual AllTheWay)) doc
showSDocForUser dflags unqual doc = renderWithContext (initSDocContext dflags sty) doc'
where
sty = mkUserStyle unqual AllTheWay
unit_state = unitState dflags
doc' = pprWithUnitState unit_state doc
showSDocDump :: DynFlags -> SDoc -> String
showSDocDump dflags d = renderWithContext (initSDocContext dflags defaultDumpStyle) d
......
......@@ -5080,6 +5080,7 @@ initSDocContext dflags style = SDC
, sdocImpredicativeTypes = xopt LangExt.ImpredicativeTypes dflags
, sdocLinearTypes = xopt LangExt.LinearTypes dflags
, sdocPrintTypeAbbreviations = True
, sdocUnitIdForUser = ftext
, sdocDynFlags = dflags
}
......
......@@ -2995,8 +2995,8 @@ instance Outputable ModSummary where
char '}'
]
showModMsg :: DynFlags -> Bool -> ModSummary -> String
showModMsg dflags recomp mod_summary = showSDoc dflags $
showModMsg :: DynFlags -> Bool -> ModSummary -> SDoc
showModMsg dflags recomp mod_summary =
if gopt Opt_HideSourcePaths dflags
then text mod_str
else hsep $
......
......@@ -1121,6 +1121,7 @@ For some background on this choice see trac #15269.
showIface :: HscEnv -> FilePath -> IO ()
showIface hsc_env filename = do
let dflags = hsc_dflags hsc_env
unit_state = unitState dflags
printer = putLogMsg dflags NoReason SevOutput noSrcSpan . withPprStyle defaultDumpStyle
-- skip the hi way check; we don't want to worry about profiled vs.
......@@ -1136,7 +1137,9 @@ showIface hsc_env filename = do
neverQualifyModules
neverQualifyPackages
putLogMsg dflags NoReason SevDump noSrcSpan
$ withPprStyle (mkDumpStyle print_unqual) (pprModIface iface)
$ withPprStyle (mkDumpStyle print_unqual)
$ pprWithUnitState unit_state
$ pprModIface iface
-- Show a ModIface but don't display details; suitable for ModIfaces stored in
-- the EPT.
......
......@@ -123,7 +123,9 @@ mkFullIface hsc_env partial_iface mb_cg_infos = do
addFingerprints hsc_env partial_iface{ mi_decls = decls }
-- Debug printing
dumpIfSet_dyn (hsc_dflags hsc_env) Opt_D_dump_hi "FINAL INTERFACE" FormatText (pprModIface full_iface)
let unit_state = unitState (hsc_dflags hsc_env)
dumpIfSet_dyn (hsc_dflags hsc_env) Opt_D_dump_hi "FINAL INTERFACE" FormatText
(pprWithUnitState unit_state $ pprModIface full_iface)
return full_iface
......