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
  • 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
  • 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
  • zaquest/ghc
  • fangyi-zhou/ghc
  • augyg/ghc
  • rkirkman/ghc
  • gulin.serge/ghc-windows-aarch64-bootstrap
  • iris/ghc
  • kwxm/ghc
  • maralorn/ghc
  • rafl/ghc
  • nikshalark/ghc
  • mrcjkb/ghc
  • blackheaven/ghc
  • laurenyim/ghc
  • bolt12/ghc
648 results
Show changes
Commits on Source (453)
Showing
with 179 additions and 103 deletions
...@@ -74,7 +74,8 @@ module BasicTypes( ...@@ -74,7 +74,8 @@ module BasicTypes(
isNeverActive, isAlwaysActive, isEarlyActive, isNeverActive, isAlwaysActive, isEarlyActive,
RuleMatchInfo(..), isConLike, isFunLike, RuleMatchInfo(..), isConLike, isFunLike,
InlineSpec(..), InlineSpec(..),
InlinePragma(..), defaultInlinePragma, alwaysInlinePragma, InlinePragma(..), Superinlinable,
defaultInlinePragma, alwaysInlinePragma,
neverInlinePragma, dfunInlinePragma, neverInlinePragma, dfunInlinePragma,
isDefaultInlinePragma, isDefaultInlinePragma,
isInlinePragma, isInlinablePragma, isAnyInlinePragma, isInlinePragma, isInlinablePragma, isAnyInlinePragma,
...@@ -92,6 +93,7 @@ import Outputable ...@@ -92,6 +93,7 @@ import Outputable
import Data.Data hiding (Fixity) import Data.Data hiding (Fixity)
import Data.Function (on) import Data.Function (on)
import Data.Maybe (isJust)
\end{code} \end{code}
%************************************************************************ %************************************************************************
...@@ -719,11 +721,13 @@ data InlinePragma -- Note [InlinePragma] ...@@ -719,11 +721,13 @@ data InlinePragma -- Note [InlinePragma]
data InlineSpec -- What the user's INLINE pragama looked like data InlineSpec -- What the user's INLINE pragama looked like
= Inline = Inline
| Inlinable | Inlinable Superinlinable
| NoInline | NoInline
| EmptyInlineSpec | EmptyInlineSpec
deriving( Eq, Data, Typeable, Show ) deriving( Eq, Data, Typeable, Show )
-- Show needed for Lexer.x -- Show needed for Lexer.x
type Superinlinable = Bool -- Marked as superinlinable rather than just inlinable?
\end{code} \end{code}
Note [InlinePragma] Note [InlinePragma]
...@@ -822,16 +826,19 @@ isInlinePragma prag = case inl_inline prag of ...@@ -822,16 +826,19 @@ isInlinePragma prag = case inl_inline prag of
_ -> False _ -> False
isInlinablePragma :: InlinePragma -> Bool isInlinablePragma :: InlinePragma -> Bool
isInlinablePragma prag = case inl_inline prag of isInlinablePragma = isJust . isInlinablePragma_maybe
Inlinable -> True
_ -> False isInlinablePragma_maybe :: InlinePragma -> Maybe Superinlinable
isInlinablePragma_maybe prag = case inl_inline prag of
Inlinable si -> Just si
_ -> Nothing
isAnyInlinePragma :: InlinePragma -> Bool isAnyInlinePragma :: InlinePragma -> Bool
-- INLINE or INLINABLE -- INLINE or INLINABLE
isAnyInlinePragma prag = case inl_inline prag of isAnyInlinePragma prag = case inl_inline prag of
Inline -> True Inline -> True
Inlinable -> True Inlinable _ -> True
_ -> False _ -> False
inlinePragmaSat :: InlinePragma -> Maybe Arity inlinePragmaSat :: InlinePragma -> Maybe Arity
inlinePragmaSat = inl_sat inlinePragmaSat = inl_sat
...@@ -859,10 +866,11 @@ instance Outputable RuleMatchInfo where ...@@ -859,10 +866,11 @@ instance Outputable RuleMatchInfo where
ppr FunLike = ptext (sLit "FUNLIKE") ppr FunLike = ptext (sLit "FUNLIKE")
instance Outputable InlineSpec where instance Outputable InlineSpec where
ppr Inline = ptext (sLit "INLINE") ppr Inline = ptext (sLit "INLINE")
ppr NoInline = ptext (sLit "NOINLINE") ppr NoInline = ptext (sLit "NOINLINE")
ppr Inlinable = ptext (sLit "INLINABLE") ppr (Inlinable False) = ptext (sLit "INLINABLE")
ppr EmptyInlineSpec = empty ppr (Inlinable True) = ptext (sLit "SUPERINLINABLE")
ppr EmptyInlineSpec = empty
instance Outputable InlinePragma where instance Outputable InlinePragma where
ppr (InlinePragma { inl_inline = inline, inl_act = activation ppr (InlinePragma { inl_inline = inline, inl_act = activation
......
...@@ -71,6 +71,9 @@ module Id ( ...@@ -71,6 +71,9 @@ module Id (
idInlinePragma, setInlinePragma, modifyInlinePragma, idInlinePragma, setInlinePragma, modifyInlinePragma,
idInlineActivation, setInlineActivation, idRuleMatchInfo, idInlineActivation, setInlineActivation, idRuleMatchInfo,
-- ** Supercompile pragma stuff
idSupercompilePragma, setSupercompilePragma,
-- ** One-shot lambdas -- ** One-shot lambdas
isOneShotBndr, isOneShotLambda, isStateHackType, isOneShotBndr, isOneShotLambda, isStateHackType,
setOneShotLambda, clearOneShotLambda, setOneShotLambda, clearOneShotLambda,
...@@ -138,6 +141,7 @@ infixl 1 `setIdUnfoldingLazily`, ...@@ -138,6 +141,7 @@ infixl 1 `setIdUnfoldingLazily`,
`setIdStrictness`, `setIdStrictness`,
`setIdSpecialisation`, `setIdSpecialisation`,
`setInlinePragma`, `setInlinePragma`,
`setSupercompilePragma`,
`setInlineActivation`, `setInlineActivation`,
`idCafInfo` `idCafInfo`
\end{code} \end{code}
...@@ -586,6 +590,17 @@ isConLikeId id = isDataConWorkId id || isConLike (idRuleMatchInfo id) ...@@ -586,6 +590,17 @@ isConLikeId id = isDataConWorkId id || isConLike (idRuleMatchInfo id)
\end{code} \end{code}
---------------------------------
-- SUPERCOMPILATION
\begin{code}
idSupercompilePragma :: Id -> SupercompilePragInfo
idSupercompilePragma id = supercompilePragInfo (idInfo id)
setSupercompilePragma :: Id -> SupercompilePragInfo -> Id
setSupercompilePragma id prag = modifyIdInfo (`setSupercompilePragInfo` prag) id
\end{code}
--------------------------------- ---------------------------------
-- ONE-SHOT LAMBDAS -- ONE-SHOT LAMBDAS
\begin{code} \begin{code}
......
...@@ -23,6 +23,7 @@ module IdInfo ( ...@@ -23,6 +23,7 @@ module IdInfo (
IdInfo, -- Abstract IdInfo, -- Abstract
vanillaIdInfo, noCafIdInfo, vanillaIdInfo, noCafIdInfo,
seqIdInfo, megaSeqIdInfo, seqIdInfo, megaSeqIdInfo,
isShortableIdInfo,
-- ** Zapping various forms of Info -- ** Zapping various forms of Info
zapLamInfo, zapDemandInfo, zapFragileInfo, zapLamInfo, zapDemandInfo, zapFragileInfo,
...@@ -43,6 +44,10 @@ module IdInfo ( ...@@ -43,6 +44,10 @@ module IdInfo (
InlinePragInfo, InlinePragInfo,
inlinePragInfo, setInlinePragInfo, inlinePragInfo, setInlinePragInfo,
-- ** The SupercompilePragInfo type
SupercompilePragInfo,
supercompilePragInfo, setSupercompilePragInfo,
-- ** The OccInfo type -- ** The OccInfo type
OccInfo(..), OccInfo(..),
isDeadOcc, isStrongLoopBreaker, isWeakLoopBreaker, isDeadOcc, isStrongLoopBreaker, isWeakLoopBreaker,
...@@ -93,6 +98,7 @@ import Data.Maybe ...@@ -93,6 +98,7 @@ import Data.Maybe
infixl 1 `setSpecInfo`, infixl 1 `setSpecInfo`,
`setArityInfo`, `setArityInfo`,
`setInlinePragInfo`, `setInlinePragInfo`,
`setSupercompilePragInfo`,
`setUnfoldingInfo`, `setUnfoldingInfo`,
`setLBVarInfo`, `setLBVarInfo`,
`setOccInfo`, `setOccInfo`,
...@@ -193,6 +199,7 @@ data IdInfo ...@@ -193,6 +199,7 @@ data IdInfo
cafInfo :: CafInfo, -- ^ 'Id' CAF info cafInfo :: CafInfo, -- ^ 'Id' CAF info
lbvarInfo :: LBVarInfo, -- ^ Info about a lambda-bound variable, if the 'Id' is one lbvarInfo :: LBVarInfo, -- ^ Info about a lambda-bound variable, if the 'Id' is one
inlinePragInfo :: InlinePragma, -- ^ Any inline pragma atached to the 'Id' inlinePragInfo :: InlinePragma, -- ^ Any inline pragma atached to the 'Id'
supercompilePragInfo :: SupercompilePragInfo, -- ^ Whether the 'Id' should be supercompiled
occInfo :: OccInfo, -- ^ How the 'Id' occurs in the program occInfo :: OccInfo, -- ^ How the 'Id' occurs in the program
strictnessInfo :: Maybe StrictSig, -- ^ Id strictness information. Reason for Maybe: strictnessInfo :: Maybe StrictSig, -- ^ Id strictness information. Reason for Maybe:
...@@ -242,6 +249,8 @@ setSpecInfo :: IdInfo -> SpecInfo -> IdInfo ...@@ -242,6 +249,8 @@ setSpecInfo :: IdInfo -> SpecInfo -> IdInfo
setSpecInfo info sp = sp `seq` info { specInfo = sp } setSpecInfo info sp = sp `seq` info { specInfo = sp }
setInlinePragInfo :: IdInfo -> InlinePragma -> IdInfo setInlinePragInfo :: IdInfo -> InlinePragma -> IdInfo
setInlinePragInfo info pr = pr `seq` info { inlinePragInfo = pr } setInlinePragInfo info pr = pr `seq` info { inlinePragInfo = pr }
setSupercompilePragInfo :: IdInfo -> SupercompilePragInfo -> IdInfo
setSupercompilePragInfo info pr = pr `seq` info { supercompilePragInfo = pr }
setOccInfo :: IdInfo -> OccInfo -> IdInfo setOccInfo :: IdInfo -> OccInfo -> IdInfo
setOccInfo info oc = oc `seq` info { occInfo = oc } setOccInfo info oc = oc `seq` info { occInfo = oc }
-- Try to avoid spack leaks by seq'ing -- Try to avoid spack leaks by seq'ing
...@@ -286,6 +295,7 @@ vanillaIdInfo ...@@ -286,6 +295,7 @@ vanillaIdInfo
unfoldingInfo = noUnfolding, unfoldingInfo = noUnfolding,
lbvarInfo = NoLBVarInfo, lbvarInfo = NoLBVarInfo,
inlinePragInfo = defaultInlinePragma, inlinePragInfo = defaultInlinePragma,
supercompilePragInfo = defaultSupercompilePragma,
occInfo = NoOccInfo, occInfo = NoOccInfo,
demandInfo = Nothing, demandInfo = Nothing,
strictnessInfo = Nothing strictnessInfo = Nothing
...@@ -295,6 +305,15 @@ vanillaIdInfo ...@@ -295,6 +305,15 @@ vanillaIdInfo
noCafIdInfo :: IdInfo noCafIdInfo :: IdInfo
noCafIdInfo = vanillaIdInfo `setCafInfo` NoCafRefs noCafIdInfo = vanillaIdInfo `setCafInfo` NoCafRefs
-- Used for built-in type Ids in MkId. -- Used for built-in type Ids in MkId.
isShortableIdInfo :: IdInfo -> Bool
-- True if there is no user-attached IdInfo on exported_id,
-- so we can safely discard it
-- See Note [Messing up the exported Id's IdInfo]
isShortableIdInfo info
= isEmptySpecInfo (specInfo info)
&& isDefaultInlinePragma (inlinePragInfo info)
&& not (isStableUnfolding (unfoldingInfo info))
\end{code} \end{code}
...@@ -347,6 +366,20 @@ ppArityInfo n = hsep [ptext (sLit "Arity"), int n] ...@@ -347,6 +366,20 @@ ppArityInfo n = hsep [ptext (sLit "Arity"), int n]
type InlinePragInfo = InlinePragma type InlinePragInfo = InlinePragma
\end{code} \end{code}
%************************************************************************
%* *
\subsection{Supercompile-pragma information}
%* *
%************************************************************************
\begin{code}
-- | Tells us whether the binding should be supercompiled.
type SupercompilePragInfo = Bool
defaultSupercompilePragma :: Bool
defaultSupercompilePragma = False
\end{code}
%************************************************************************ %************************************************************************
%* * %* *
......
...@@ -70,14 +70,9 @@ import BasicTypes ...@@ -70,14 +70,9 @@ import BasicTypes
import FastTypes import FastTypes
import FastString import FastString
import Outputable import Outputable
import Util ( iToBase62 )
-- import StaticFlags -- import StaticFlags
#if defined(__GLASGOW_HASKELL__)
--just for implementing a fast [0,61) -> Char function
import GHC.Exts (indexCharOffAddr#, Char(..))
#else
import Data.Array
#endif
import Data.Char ( chr, ord ) import Data.Char ( chr, ord )
\end{code} \end{code}
...@@ -251,42 +246,6 @@ instance Show Unique where ...@@ -251,42 +246,6 @@ instance Show Unique where
showsPrec p uniq = showsPrecSDoc p (pprUnique uniq) showsPrec p uniq = showsPrecSDoc p (pprUnique uniq)
\end{code} \end{code}
%************************************************************************
%* *
\subsection[Utils-base62]{Base-62 numbers}
%* *
%************************************************************************
A character-stingy way to read/write numbers (notably Uniques).
The ``62-its'' are \tr{[0-9a-zA-Z]}. We don't handle negative Ints.
Code stolen from Lennart.
\begin{code}
iToBase62 :: Int -> String
iToBase62 n_
= ASSERT(n_ >= 0) go (iUnbox n_) ""
where
go n cs | n <# _ILIT(62)
= case chooseChar62 n of { c -> c `seq` (c : cs) }
| otherwise
= case (quotRem (iBox n) 62) of { (q_, r_) ->
case iUnbox q_ of { q -> case iUnbox r_ of { r ->
case (chooseChar62 r) of { c -> c `seq`
(go q (c : cs)) }}}}
chooseChar62 :: FastInt -> Char
{-# INLINE chooseChar62 #-}
#if defined(__GLASGOW_HASKELL__)
--then FastInt == Int#
chooseChar62 n = C# (indexCharOffAddr# chars62 n)
!chars62 = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"#
#else
--Haskell98 arrays are portable
chooseChar62 n = (!) chars62 n
chars62 = listArray (0,61) "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
#endif
\end{code}
%************************************************************************ %************************************************************************
%* * %* *
\subsection[Uniques-prelude]{@Uniques@ for wired-in Prelude things} \subsection[Uniques-prelude]{@Uniques@ for wired-in Prelude things}
......
...@@ -39,7 +39,7 @@ module VarEnv ( ...@@ -39,7 +39,7 @@ module VarEnv (
unionInScope, elemInScopeSet, uniqAway, unionInScope, elemInScopeSet, uniqAway,
-- * The RnEnv2 type -- * The RnEnv2 type
RnEnv2, RnEnv2(..),
-- ** Operations on RnEnv2s -- ** Operations on RnEnv2s
mkRnEnv2, rnBndr2, rnBndrs2, mkRnEnv2, rnBndr2, rnBndrs2,
......
...@@ -260,8 +260,8 @@ lintCoreExpr (Var var) ...@@ -260,8 +260,8 @@ lintCoreExpr (Var var)
; checkL (isId var && not (isCoVar var)) ; checkL (isId var && not (isCoVar var))
(ptext (sLit "Non term variable") <+> ppr var) (ptext (sLit "Non term variable") <+> ppr var)
; checkDeadIdOcc var
; var' <- lookupIdInScope var ; var' <- lookupIdInScope var
; checkDeadIdOcc var'
; return (idType var') } ; return (idType var') }
lintCoreExpr (Lit lit) lintCoreExpr (Lit lit)
...@@ -276,8 +276,8 @@ lintCoreExpr (Cast expr co) ...@@ -276,8 +276,8 @@ lintCoreExpr (Cast expr co)
lintCoreExpr (Tick (Breakpoint _ ids) expr) lintCoreExpr (Tick (Breakpoint _ ids) expr)
= do forM_ ids $ \id -> do = do forM_ ids $ \id -> do
checkDeadIdOcc id id' <- lookupIdInScope id
lookupIdInScope id checkDeadIdOcc id'
lintCoreExpr expr lintCoreExpr expr
lintCoreExpr (Tick _other_tickish expr) lintCoreExpr (Tick _other_tickish expr)
......
...@@ -265,12 +265,11 @@ extendSubstList subst ((var,rhs):prs) = extendSubstList (extendSubst subst var r ...@@ -265,12 +265,11 @@ extendSubstList subst ((var,rhs):prs) = extendSubstList (extendSubst subst var r
-- | Find the substitution for an 'Id' in the 'Subst' -- | Find the substitution for an 'Id' in the 'Subst'
lookupIdSubst :: SDoc -> Subst -> Id -> CoreExpr lookupIdSubst :: SDoc -> Subst -> Id -> CoreExpr
lookupIdSubst doc (Subst in_scope ids _ _) v lookupIdSubst doc (Subst in_scope ids _ _) v
| not (isLocalId v) = Var v
| Just e <- lookupVarEnv ids v = e | Just e <- lookupVarEnv ids v = e
| Just v' <- lookupInScope in_scope v = Var v' | Just v' <- lookupInScope in_scope v = Var v'
-- Vital! See Note [Extending the Subst] -- Vital! See Note [Extending the Subst]
| otherwise = WARN( True, ptext (sLit "CoreSubst.lookupIdSubst") <+> doc <+> ppr v | otherwise = WARN( isLocalId v, ptext (sLit "CoreSubst.lookupIdSubst") <+> doc <+> ppr v
$$ ppr in_scope) $$ ppr in_scope)
Var v Var v
-- | Find the substitution for a 'TyVar' in the 'Subst' -- | Find the substitution for a 'TyVar' in the 'Subst'
......
...@@ -36,7 +36,7 @@ module CoreUnfold ( ...@@ -36,7 +36,7 @@ module CoreUnfold (
couldBeSmallEnoughToInline, inlineBoringOk, couldBeSmallEnoughToInline, inlineBoringOk,
certainlyWillInline, smallEnoughToInline, certainlyWillInline, smallEnoughToInline,
callSiteInline, CallCtxt(..), callSiteInline, tryUnfolding, CallCtxt(..),
-- Reexport from CoreSubst (it only live there so it can be used -- Reexport from CoreSubst (it only live there so it can be used
-- by the Very Simple Optimiser) -- by the Very Simple Optimiser)
...@@ -100,8 +100,8 @@ mkDFunUnfolding :: Type -> [CoreExpr] -> Unfolding ...@@ -100,8 +100,8 @@ mkDFunUnfolding :: Type -> [CoreExpr] -> Unfolding
mkDFunUnfolding dfun_ty ops mkDFunUnfolding dfun_ty ops
= DFunUnfolding dfun_nargs data_con ops = DFunUnfolding dfun_nargs data_con ops
where where
(tvs, n_theta, cls, _) = tcSplitDFunTy dfun_ty (tvs, theta, cls, _) = tcSplitDFunTy dfun_ty
dfun_nargs = length tvs + n_theta dfun_nargs = length tvs + length theta
data_con = classDataCon cls data_con = classDataCon cls
mkWwInlineRule :: Id -> CoreExpr -> Arity -> Unfolding mkWwInlineRule :: Id -> CoreExpr -> Arity -> Unfolding
...@@ -865,12 +865,13 @@ callSiteInline dflags id active_unfolding lone_variable arg_infos cont_info ...@@ -865,12 +865,13 @@ callSiteInline dflags id active_unfolding lone_variable arg_infos cont_info
-- idUnfolding checks for loop-breakers, returning NoUnfolding -- idUnfolding checks for loop-breakers, returning NoUnfolding
-- Things with an INLINE pragma may have an unfolding *and* -- Things with an INLINE pragma may have an unfolding *and*
-- be a loop breaker (maybe the knot is not yet untied) -- be a loop breaker (maybe the knot is not yet untied)
CoreUnfolding { uf_tmpl = unf_template, uf_is_top = is_top CoreUnfolding { uf_tmpl = unf_template, uf_is_top = is_top
, uf_is_work_free = is_wf, uf_arity = uf_arity , uf_is_work_free = is_wf, uf_arity = uf_arity
, uf_guidance = guidance, uf_expandable = is_exp } , uf_guidance = guidance, uf_expandable = is_exp }
| active_unfolding -> tryUnfolding dflags id lone_variable | active_unfolding -> if tryUnfolding dflags id lone_variable
arg_infos cont_info unf_template is_top arg_infos cont_info is_top
is_wf is_exp uf_arity guidance is_wf is_exp uf_arity guidance
then Just unf_template else Nothing
| dopt Opt_D_dump_inlinings dflags && dopt Opt_D_verbose_core2core dflags | dopt Opt_D_dump_inlinings dflags && dopt Opt_D_verbose_core2core dflags
-> pprTrace "Inactive unfolding:" (ppr id) Nothing -> pprTrace "Inactive unfolding:" (ppr id) Nothing
| otherwise -> Nothing | otherwise -> Nothing
...@@ -879,10 +880,10 @@ callSiteInline dflags id active_unfolding lone_variable arg_infos cont_info ...@@ -879,10 +880,10 @@ callSiteInline dflags id active_unfolding lone_variable arg_infos cont_info
DFunUnfolding {} -> Nothing -- Never unfold a DFun DFunUnfolding {} -> Nothing -- Never unfold a DFun
tryUnfolding :: DynFlags -> Id -> Bool -> [ArgSummary] -> CallCtxt tryUnfolding :: DynFlags -> Id -> Bool -> [ArgSummary] -> CallCtxt
-> CoreExpr -> Bool -> Bool -> Bool -> Arity -> UnfoldingGuidance -> Bool -> Bool -> Bool -> Arity -> UnfoldingGuidance
-> Maybe CoreExpr -> Bool
tryUnfolding dflags id lone_variable tryUnfolding dflags id lone_variable
arg_infos cont_info unf_template is_top arg_infos cont_info is_top
is_wf is_exp uf_arity guidance is_wf is_exp uf_arity guidance
-- uf_arity will typically be equal to (idArity id), -- uf_arity will typically be equal to (idArity id),
-- but may be less for InlineRules -- but may be less for InlineRules
...@@ -897,16 +898,13 @@ tryUnfolding dflags id lone_variable ...@@ -897,16 +898,13 @@ tryUnfolding dflags id lone_variable
text "guidance" <+> ppr guidance, text "guidance" <+> ppr guidance,
extra_doc, extra_doc,
text "ANSWER =" <+> if yes_or_no then text "YES" else text "NO"]) text "ANSWER =" <+> if yes_or_no then text "YES" else text "NO"])
result yes_or_no
| otherwise = result | otherwise = yes_or_no
where where
n_val_args = length arg_infos n_val_args = length arg_infos
saturated = n_val_args >= uf_arity saturated = n_val_args >= uf_arity
result | yes_or_no = Just unf_template
| otherwise = Nothing
interesting_args = any nonTriv arg_infos interesting_args = any nonTriv arg_infos
-- NB: (any nonTriv arg_infos) looks at the -- NB: (any nonTriv arg_infos) looks at the
-- over-saturated args too which is "wrong"; -- over-saturated args too which is "wrong";
......
...@@ -31,7 +31,7 @@ module CoreUtils ( ...@@ -31,7 +31,7 @@ module CoreUtils (
CoreStats(..), coreBindsStats, CoreStats(..), coreBindsStats,
-- * Hashing -- * Hashing
hashExpr, hashExpr, hashType, hashCoercion,
-- * Equality -- * Equality
cheapEqExpr, eqExpr, eqExprX, cheapEqExpr, eqExpr, eqExprX,
...@@ -1507,12 +1507,22 @@ hashExpr :: CoreExpr -> Int ...@@ -1507,12 +1507,22 @@ hashExpr :: CoreExpr -> Int
-- --
-- We must be careful that @\\x.x@ and @\\y.y@ map to the same hash code, -- We must be careful that @\\x.x@ and @\\y.y@ map to the same hash code,
-- (at least if we want the above invariant to be true). -- (at least if we want the above invariant to be true).
hashExpr = runHash . flip hash_expr
hashExpr e = fromIntegral (hash_expr (1,emptyVarEnv) e .&. 0x7fffffff) hashType :: Type -> Int
-- UniqFM doesn't like negative Ints -- ^ Same properties as 'hashExpr', but for types
hashType = runHash . flip fast_hash_type
hashCoercion :: Coercion -> Int
-- ^ Same properties as 'hashExpr', but for coercions
hashCoercion = runHash . flip fast_hash_co
type HashEnv = (Int, VarEnv Int) -- Hash code for bound variables type HashEnv = (Int, VarEnv Int) -- Hash code for bound variables
runHash :: (HashEnv -> Word32) -> Int
runHash f = fromIntegral (f (1,emptyVarEnv) .&. 0x7fffffff)
-- UniqFM doesn't like negative Ints
hash_expr :: HashEnv -> CoreExpr -> Word32 hash_expr :: HashEnv -> CoreExpr -> Word32
-- Word32, because we're expecting overflows here, and overflowing -- Word32, because we're expecting overflows here, and overflowing
-- signed types just isn't cool. In C it's even undefined. -- signed types just isn't cool. In C it's even undefined.
...@@ -1555,7 +1565,7 @@ fast_hash_co env co ...@@ -1555,7 +1565,7 @@ fast_hash_co env co
in foldr (\c n -> fast_hash_co env c + n) hash_tc cos in foldr (\c n -> fast_hash_co env c + n) hash_tc cos
| otherwise = 1 | otherwise = 1
extend_env :: HashEnv -> Var -> (Int, VarEnv Int) extend_env :: HashEnv -> Var -> HashEnv
extend_env (n,env) b = (n+1, extendVarEnv env b n) extend_env (n,env) b = (n+1, extendVarEnv env b n)
hashVar :: HashEnv -> Var -> Word32 hashVar :: HashEnv -> Var -> Word32
......
...@@ -13,7 +13,7 @@ module MkCore ( ...@@ -13,7 +13,7 @@ module MkCore (
mkCoreApp, mkCoreApps, mkCoreConApps, mkCoreApp, mkCoreApps, mkCoreConApps,
mkCoreLams, mkWildCase, mkIfThenElse, mkCoreLams, mkWildCase, mkIfThenElse,
mkWildValBinder, mkWildEvBinder, mkWildValBinder, mkWildEvBinder,
sortQuantVars, castBottomExpr, sortQuantVars, quantVarLe, castBottomExpr,
-- * Constructing boxed literals -- * Constructing boxed literals
mkWordExpr, mkWordExprWord, mkWordExpr, mkWordExprWord,
...@@ -105,9 +105,10 @@ infixl 4 `mkCoreApp`, `mkCoreApps` ...@@ -105,9 +105,10 @@ infixl 4 `mkCoreApp`, `mkCoreApps`
sortQuantVars :: [Var] -> [Var] sortQuantVars :: [Var] -> [Var]
-- Sort the variables (KindVars, TypeVars, and Ids) -- Sort the variables (KindVars, TypeVars, and Ids)
-- into order: Kind, then Type, then Id -- into order: Kind, then Type, then Id
sortQuantVars = sortLe le sortQuantVars = sortLe quantVarLe
where
v1 `le` v2 = case (is_tv v1, is_tv v2) of quantVarLe :: Var -> Var -> Bool
v1 `quantVarLe` v2 = case (is_tv v1, is_tv v2) of
(True, False) -> True (True, False) -> True
(False, True) -> False (False, True) -> False
(True, True) -> (True, True) ->
...@@ -116,6 +117,7 @@ sortQuantVars = sortLe le ...@@ -116,6 +117,7 @@ sortQuantVars = sortLe le
(False, True) -> False (False, True) -> False
_ -> v1 <= v2 -- Same family _ -> v1 <= v2 -- Same family
(False, False) -> v1 <= v2 (False, False) -> v1 <= v2
where
is_tv v = isTyVar v is_tv v = isTyVar v
is_kv v = isKindVar v is_kv v = isKindVar v
......
...@@ -358,6 +358,7 @@ ppIdInfo id info ...@@ -358,6 +358,7 @@ ppIdInfo id info
, (has_caf_info, ptext (sLit "Caf=") <> ppr caf_info) , (has_caf_info, ptext (sLit "Caf=") <> ppr caf_info)
, (has_strictness, ptext (sLit "Str=") <> pprStrictness str_info) , (has_strictness, ptext (sLit "Str=") <> pprStrictness str_info)
, (has_unf, ptext (sLit "Unf=") <> ppr unf_info) , (has_unf, ptext (sLit "Unf=") <> ppr unf_info)
, (sc_info, ptext (sLit "SC=") <> ppr sc_info)
, (not (null rules), ptext (sLit "RULES:") <+> vcat (map pprRule rules)) , (not (null rules), ptext (sLit "RULES:") <+> vcat (map pprRule rules))
] -- Inline pragma, occ, demand, lbvar info ] -- Inline pragma, occ, demand, lbvar info
-- printed out with all binders (when debug is on); -- printed out with all binders (when debug is on);
...@@ -379,6 +380,8 @@ ppIdInfo id info ...@@ -379,6 +380,8 @@ ppIdInfo id info
unf_info = unfoldingInfo info unf_info = unfoldingInfo info
has_unf = hasSomeUnfolding unf_info has_unf = hasSomeUnfolding unf_info
sc_info = supercompilePragInfo info
rules = specInfoRules (specInfo info) rules = specInfoRules (specInfo info)
showAttributes :: [(Bool,SDoc)] -> SDoc showAttributes :: [(Bool,SDoc)] -> SDoc
......
...@@ -216,7 +216,7 @@ makeCorePair gbl_id is_default_method dict_arity rhs ...@@ -216,7 +216,7 @@ makeCorePair gbl_id is_default_method dict_arity rhs
= case inlinePragmaSpec inline_prag of = case inlinePragmaSpec inline_prag of
EmptyInlineSpec -> (gbl_id, rhs) EmptyInlineSpec -> (gbl_id, rhs)
NoInline -> (gbl_id, rhs) NoInline -> (gbl_id, rhs)
Inlinable -> (gbl_id `setIdUnfolding` inlinable_unf, rhs) Inlinable _ -> (gbl_id `setIdUnfolding` inlinable_unf, rhs)
Inline -> inline_pair Inline -> inline_pair
where where
......
...@@ -535,9 +535,9 @@ rep_sig (L _ (GenericSig nm _)) = failWithDs msg ...@@ -535,9 +535,9 @@ rep_sig (L _ (GenericSig nm _)) = failWithDs msg
where msg = vcat [ ptext (sLit "Illegal default signature for") <+> quotes (ppr nm) where msg = vcat [ ptext (sLit "Illegal default signature for") <+> quotes (ppr nm)
, ptext (sLit "Default signatures are not supported by Template Haskell") ] , ptext (sLit "Default signatures are not supported by Template Haskell") ]
rep_sig (L loc (InlineSig nm ispec)) = rep_inline nm ispec loc rep_sig (L loc (InlineSig (Just nm) ispec)) = rep_inline nm ispec loc
rep_sig (L loc (SpecSig nm ty ispec)) = rep_specialise nm ty ispec loc rep_sig (L loc (SpecSig nm ty ispec)) = rep_specialise nm ty ispec loc
rep_sig _ = return [] rep_sig _ = return []
rep_ty_sig :: SrcSpan -> LHsType Name -> Located Name rep_ty_sig :: SrcSpan -> LHsType Name -> Located Name
-> DsM (SrcSpan, Core TH.DecQ) -> DsM (SrcSpan, Core TH.DecQ)
......
...@@ -56,6 +56,7 @@ Library ...@@ -56,6 +56,7 @@ Library
containers >= 0.1 && < 0.6, containers >= 0.1 && < 0.6,
array >= 0.1 && < 0.5, array >= 0.1 && < 0.5,
filepath >= 1 && < 1.4, filepath >= 1 && < 1.4,
xhtml,
Cabal, Cabal,
hpc hpc
...@@ -127,6 +128,7 @@ Library ...@@ -127,6 +128,7 @@ Library
specialise specialise
stgSyn stgSyn
stranal stranal
supercompile
typecheck typecheck
types types
utils utils
...@@ -444,6 +446,31 @@ Library ...@@ -444,6 +446,31 @@ Library
UniqFM UniqFM
UniqSet UniqSet
Util Util
Supercompile.GHC
Supercompile.Core.FreeVars
Supercompile.Core.Renaming
Supercompile.Core.Size
Supercompile.Core.Syntax
Supercompile.Core.Tag
Supercompile.Drive.Match
Supercompile.Drive.MSG
Supercompile.Drive.Process
Supercompile.Drive.Process1
Supercompile.Drive.Process2
Supercompile.Drive.Process3
Supercompile.Drive.Split
Supercompile.Drive.Split2
Supercompile.Evaluator.Deeds
Supercompile.Evaluator.Evaluate
Supercompile.Evaluator.FreeVars
Supercompile.Evaluator.Residualise
Supercompile.Evaluator.Syntax
Supercompile.StaticFlags
Supercompile.Termination.Combinators
Supercompile.Termination.Generaliser
Supercompile.Termination.TagBag
Supercompile.Utilities
Supercompile
Vectorise.Builtins.Base Vectorise.Builtins.Base
Vectorise.Builtins.Initialise Vectorise.Builtins.Initialise
Vectorise.Builtins Vectorise.Builtins
......
...@@ -413,7 +413,7 @@ cvt_conv TH.StdCall = StdCallConv ...@@ -413,7 +413,7 @@ cvt_conv TH.StdCall = StdCallConv
cvtPragmaD :: Pragma -> CvtM (Sig RdrName) cvtPragmaD :: Pragma -> CvtM (Sig RdrName)
cvtPragmaD (InlineP nm ispec) cvtPragmaD (InlineP nm ispec)
= do { nm' <- vNameL nm = do { nm' <- vNameL nm
; return $ InlineSig nm' (cvtInlineSpec (Just ispec)) } ; return $ InlineSig (Just nm') (cvtInlineSpec (Just ispec)) }
cvtPragmaD (SpecialiseP nm ty opt_ispec) cvtPragmaD (SpecialiseP nm ty opt_ispec)
= do { nm' <- vNameL nm = do { nm' <- vNameL nm
......
...@@ -470,8 +470,8 @@ data Sig name -- Signatures and pragmas ...@@ -470,8 +470,8 @@ data Sig name -- Signatures and pragmas
-- An inline pragma -- An inline pragma
-- {#- INLINE f #-} -- {#- INLINE f #-}
| InlineSig (Located name) -- Function name | InlineSig (Maybe (Located name)) -- Function name: Nothing if applies to whole module
InlinePragma -- Never defaultInlinePragma InlinePragma -- Never defaultInlinePragma
-- A specialisation pragma -- A specialisation pragma
-- {-# SPECIALISE f :: Int -> Int #-} -- {-# SPECIALISE f :: Int -> Int #-}
...@@ -485,6 +485,10 @@ data Sig name -- Signatures and pragmas ...@@ -485,6 +485,10 @@ data Sig name -- Signatures and pragmas
-- {-# SPECIALISE instance Eq [Int] #-} -- {-# SPECIALISE instance Eq [Int] #-}
| SpecInstSig (LHsType name) -- (Class tys); should be a specialisation of the | SpecInstSig (LHsType name) -- (Class tys); should be a specialisation of the
-- current instance decl -- current instance decl
-- A supercompilation pragma
-- {-# SUPERCOMPILE f #-}
| SupercompileSig (Located name) -- Function name
deriving (Data, Typeable) deriving (Data, Typeable)
...@@ -548,15 +552,20 @@ isSpecInstLSig _ = False ...@@ -548,15 +552,20 @@ isSpecInstLSig _ = False
isPragLSig :: LSig name -> Bool isPragLSig :: LSig name -> Bool
-- Identifies pragmas -- Identifies pragmas
isPragLSig (L _ (SpecSig {})) = True isPragLSig (L _ (SpecSig {})) = True
isPragLSig (L _ (InlineSig {})) = True isPragLSig (L _ (InlineSig {})) = True
isPragLSig _ = False isPragLSig (L _ (SupercompileSig {})) = True
isPragLSig _ = False
isInlineLSig :: LSig name -> Bool isInlineLSig :: LSig name -> Bool
-- Identifies inline pragmas -- Identifies inline pragmas
isInlineLSig (L _ (InlineSig {})) = True isInlineLSig (L _ (InlineSig {})) = True
isInlineLSig _ = False isInlineLSig _ = False
isSupercompileLSig :: LSig name -> Bool
isSupercompileLSig (L _ (SupercompileSig {})) = True
isSupercompileLSig _ = False
hsSigDoc :: Sig name -> SDoc hsSigDoc :: Sig name -> SDoc
hsSigDoc (TypeSig {}) = ptext (sLit "type signature") hsSigDoc (TypeSig {}) = ptext (sLit "type signature")
hsSigDoc (GenericSig {}) = ptext (sLit "default type signature") hsSigDoc (GenericSig {}) = ptext (sLit "default type signature")
...@@ -564,6 +573,7 @@ hsSigDoc (IdSig {}) = ptext (sLit "id signature") ...@@ -564,6 +573,7 @@ hsSigDoc (IdSig {}) = ptext (sLit "id signature")
hsSigDoc (SpecSig {}) = ptext (sLit "SPECIALISE pragma") hsSigDoc (SpecSig {}) = ptext (sLit "SPECIALISE pragma")
hsSigDoc (InlineSig {}) = ptext (sLit "INLINE pragma") hsSigDoc (InlineSig {}) = ptext (sLit "INLINE pragma")
hsSigDoc (SpecInstSig {}) = ptext (sLit "SPECIALISE instance pragma") hsSigDoc (SpecInstSig {}) = ptext (sLit "SPECIALISE instance pragma")
hsSigDoc (SupercompileSig {}) = ptext (sLit "SUPERCOMPILE pragma")
hsSigDoc (FixSig {}) = ptext (sLit "fixity declaration") hsSigDoc (FixSig {}) = ptext (sLit "fixity declaration")
\end{code} \end{code}
...@@ -578,7 +588,8 @@ overlapHsSig sig1 sig2 = case (unLoc sig1, unLoc sig2) of ...@@ -578,7 +588,8 @@ overlapHsSig sig1 sig2 = case (unLoc sig1, unLoc sig2) of
(IdSig n1, IdSig n2) -> n1 == n2 (IdSig n1, IdSig n2) -> n1 == n2
(TypeSig ns1 _, TypeSig ns2 _) -> ns1 `overlaps_with` ns2 (TypeSig ns1 _, TypeSig ns2 _) -> ns1 `overlaps_with` ns2
(GenericSig ns1 _, GenericSig ns2 _) -> ns1 `overlaps_with` ns2 (GenericSig ns1 _, GenericSig ns2 _) -> ns1 `overlaps_with` ns2
(InlineSig n1 _, InlineSig n2 _) -> unLoc n1 == unLoc n2 (InlineSig n1 _, InlineSig n2 _) -> fmap unLoc n1 == fmap unLoc n2
(SupercompileSig n1, SupercompileSig n2) -> unLoc n1 == unLoc n2
-- For specialisations, we don't have equality over HsType, so it's not -- For specialisations, we don't have equality over HsType, so it's not
-- convenient to spot duplicate specialisations here. Check for this later, -- convenient to spot duplicate specialisations here. Check for this later,
-- when we're in Type land -- when we're in Type land
...@@ -597,7 +608,8 @@ ppr_sig (GenericSig vars ty) = ptext (sLit "default") <+> pprVarSig (map un ...@@ -597,7 +608,8 @@ ppr_sig (GenericSig vars ty) = ptext (sLit "default") <+> pprVarSig (map un
ppr_sig (IdSig id) = pprVarSig [id] (ppr (varType id)) ppr_sig (IdSig id) = pprVarSig [id] (ppr (varType id))
ppr_sig (FixSig fix_sig) = ppr fix_sig ppr_sig (FixSig fix_sig) = ppr fix_sig
ppr_sig (SpecSig var ty inl) = pragBrackets (pprSpec var (ppr ty) inl) ppr_sig (SpecSig var ty inl) = pragBrackets (pprSpec var (ppr ty) inl)
ppr_sig (InlineSig var inl) = pragBrackets (ppr inl <+> ppr var) ppr_sig (InlineSig mb_var inl) = pragBrackets (ppr inl <+> maybe (ptext (sLit "module")) ppr mb_var)
ppr_sig (SupercompileSig var) = pragBrackets (ppr var)
ppr_sig (SpecInstSig ty) = pragBrackets (ptext (sLit "SPECIALIZE instance") <+> ppr ty) ppr_sig (SpecInstSig ty) = pragBrackets (ptext (sLit "SPECIALIZE instance") <+> ppr ty)
instance Outputable name => Outputable (FixitySig name) where instance Outputable name => Outputable (FixitySig name) where
......
...@@ -741,17 +741,19 @@ instance Binary InlinePragma where ...@@ -741,17 +741,19 @@ instance Binary InlinePragma where
return (InlinePragma a b c d) return (InlinePragma a b c d)
instance Binary InlineSpec where instance Binary InlineSpec where
put_ bh EmptyInlineSpec = putByte bh 0 put_ bh EmptyInlineSpec = putByte bh 0
put_ bh Inline = putByte bh 1 put_ bh Inline = putByte bh 1
put_ bh Inlinable = putByte bh 2 put_ bh (Inlinable False) = putByte bh 2
put_ bh NoInline = putByte bh 3 put_ bh NoInline = putByte bh 3
put_ bh (Inlinable True) = putByte bh 4
get bh = do h <- getByte bh get bh = do h <- getByte bh
case h of case h of
0 -> return EmptyInlineSpec 0 -> return EmptyInlineSpec
1 -> return Inline 1 -> return Inline
2 -> return Inlinable 2 -> return (Inlinable False)
_ -> return NoInline 3 -> return NoInline
_ -> return (Inlinable True)
instance Binary HsBang where instance Binary HsBang where
put_ bh HsNoBang = putByte bh 0 put_ bh HsNoBang = putByte bh 0
......
...@@ -194,6 +194,7 @@ data DynFlag ...@@ -194,6 +194,7 @@ data DynFlag
| Opt_D_dump_simpl_iterations | Opt_D_dump_simpl_iterations
| Opt_D_dump_simpl_phases | Opt_D_dump_simpl_phases
| Opt_D_dump_spec | Opt_D_dump_spec
| Opt_D_dump_supercomp
| Opt_D_dump_prep | Opt_D_dump_prep
| Opt_D_dump_stg | Opt_D_dump_stg
| Opt_D_dump_stranal | Opt_D_dump_stranal
...@@ -246,6 +247,7 @@ data DynFlag ...@@ -246,6 +247,7 @@ data DynFlag
| Opt_CSE | Opt_CSE
| Opt_LiberateCase | Opt_LiberateCase
| Opt_SpecConstr | Opt_SpecConstr
| Opt_Supercompilation
| Opt_DoLambdaEtaExpansion | Opt_DoLambdaEtaExpansion
| Opt_IgnoreAsserts | Opt_IgnoreAsserts
| Opt_DoEtaReduction | Opt_DoEtaReduction
...@@ -1616,6 +1618,7 @@ dynamic_flags = [ ...@@ -1616,6 +1618,7 @@ dynamic_flags = [
, Flag "ddump-simpl-iterations" (setDumpFlag Opt_D_dump_simpl_iterations) , Flag "ddump-simpl-iterations" (setDumpFlag Opt_D_dump_simpl_iterations)
, Flag "ddump-simpl-phases" (OptPrefix setDumpSimplPhases) , Flag "ddump-simpl-phases" (OptPrefix setDumpSimplPhases)
, Flag "ddump-spec" (setDumpFlag Opt_D_dump_spec) , Flag "ddump-spec" (setDumpFlag Opt_D_dump_spec)
, Flag "ddump-supercomp" (setDumpFlag Opt_D_dump_supercomp)
, Flag "ddump-prep" (setDumpFlag Opt_D_dump_prep) , Flag "ddump-prep" (setDumpFlag Opt_D_dump_prep)
, Flag "ddump-stg" (setDumpFlag Opt_D_dump_stg) , Flag "ddump-stg" (setDumpFlag Opt_D_dump_stg)
, Flag "ddump-stranal" (setDumpFlag Opt_D_dump_stranal) , Flag "ddump-stranal" (setDumpFlag Opt_D_dump_stranal)
...@@ -1857,6 +1860,7 @@ fFlags = [ ...@@ -1857,6 +1860,7 @@ fFlags = [
( "full-laziness", Opt_FullLaziness, nop ), ( "full-laziness", Opt_FullLaziness, nop ),
( "liberate-case", Opt_LiberateCase, nop ), ( "liberate-case", Opt_LiberateCase, nop ),
( "spec-constr", Opt_SpecConstr, nop ), ( "spec-constr", Opt_SpecConstr, nop ),
( "supercompilation", Opt_Supercompilation, nop ),
( "cse", Opt_CSE, nop ), ( "cse", Opt_CSE, nop ),
( "pedantic-bottoms", Opt_PedanticBottoms, nop ), ( "pedantic-bottoms", Opt_PedanticBottoms, nop ),
( "ignore-interface-pragmas", Opt_IgnoreInterfacePragmas, nop ), ( "ignore-interface-pragmas", Opt_IgnoreInterfacePragmas, nop ),
......
...@@ -205,7 +205,8 @@ isStaticFlag f = ...@@ -205,7 +205,8 @@ isStaticFlag f =
"funfolding-dict-threshold", "funfolding-dict-threshold",
"funfolding-use-threshold", "funfolding-use-threshold",
"funfolding-fun-discount", "funfolding-fun-discount",
"funfolding-keeness-factor" "funfolding-keeness-factor",
"fsupercompiler"
] ]
unregFlags :: [Located String] unregFlags :: [Located String]
......
...@@ -93,6 +93,9 @@ module StaticFlags ( ...@@ -93,6 +93,9 @@ module StaticFlags (
-- For the parser -- For the parser
addOpt, removeOpt, addWay, getWayFlags, v_opt_C_ready, addOpt, removeOpt, addWay, getWayFlags, v_opt_C_ready,
-- For the supercompiler, which parses its static flags elsewhere
lookUp, lookup_def_int, lookup_str,
-- Saving/restoring globals -- Saving/restoring globals
saveStaticFlagGlobals, restoreStaticFlagGlobals saveStaticFlagGlobals, restoreStaticFlagGlobals
) where ) where
......