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
  • fangyi-zhou/ghc
  • augyg/ghc
640 results
Show changes
Showing
with 13103 additions and 0 deletions
\begin{code}
module Main (main) where
main :: IO ()
main = putStr "Hello world!"
\end{code}
# -----------------------------------------------------------------------------
#
# (c) 2009 The University of Glasgow
#
# This file is part of the GHC build system.
#
# To understand how the build system works and how to modify it, see
# https://gitlab.haskell.org/ghc/ghc/wikis/building/architecture
# https://gitlab.haskell.org/ghc/ghc/wikis/building/modifying
#
# -----------------------------------------------------------------------------
.PHONY: default_target
default_target: all
# Ideally we'd just include something to give us variables
# for paths and arguments to tools etc, and those set in mk/build.mk.
TOP=..
include $(TOP)/mk/tree.mk
include $(TOP)/mk/config.mk
ifeq "$(TEST_PREP)" "YES"
BIN_DIST_TEST_TAR_COMP = ../$(BIN_DIST_PREP_TAR_COMP)
else
BIN_DIST_TEST_TAR_COMP = ../$(BIN_DIST_TAR_COMP)
endif
all:
"$(RM)" $(RM_OPTS_REC) $(BIN_DIST_INST_SUBDIR)
"$(RM)" $(RM_OPTS_REC) a/b/c/*
"$(RM)" $(RM_OPTS) HelloWorld HelloWorld.o HelloWorld.hi output
# We use the a/b/c subdirectory as configure looks for install-sh in
# . .. ../.. and we don't want it to find the build system's install-sh.
#
# NB. tar has funny interpretation of filenames sometimes (thinking
# c:/foo is a remote file), so it's safer to bzip and then pipe into
# tar rather than using tar -xjf:
cd a/b/c/ && $(TAR_COMP_CMD) -cd ../../../$(BIN_DIST_TEST_TAR_COMP) | $(TAR_CMD) -xf -
ifeq "$(Windows)" "YES"
mv a/b/c/$(BIN_DIST_NAME) $(BIN_DIST_INST_DIR)
else
cd a/b/c/$(BIN_DIST_NAME) && ./configure --prefix=$(BIN_DIST_INST_DIR)
cd a/b/c/$(BIN_DIST_NAME) && $(MAKE) install
endif
$(BIN_DIST_INST_DIR)/bin/runghc HelloWorld > output
$(CONTEXT_DIFF) output expected_output
$(BIN_DIST_INST_DIR)/bin/ghc --make HelloWorld
./HelloWorld > output
$(CONTEXT_DIFF) output expected_output
# Without --no-user-package-db we might pick up random packages from ~/.ghc
$(BIN_DIST_INST_DIR)/bin/ghc-pkg check --no-user-package-db
ifeq "$(TEST_PROF)" "yes"
$(BIN_DIST_INST_DIR)/bin/ghc --make -prof HelloWorld
./HelloWorld > output
$(CONTEXT_DIFF) output expected_output
endif
clean distclean:
"$(RM)" $(RM_OPTS_REC) $(BIN_DIST_INST_SUBDIR)
"$(RM)" $(RM_OPTS_REC) a/b/c/*
"$(RM)" $(RM_OPTS) HelloWorld HelloWorld.o HelloWorld.hi output
# Ignore a load of other standard targets
install install-docs doc:
@:
show:
@echo '$(VALUE)="$($(VALUE))"'
#!/bin/sh
EXPECTED_VERSION="$1"
# Our shared libraries are currently executable (is that a bug?), so
# we exclude anything that looks like a shared library
for f in `find bindisttest/a/b/c -type f -perm -u+x ! -name '*.so' ! -name '*.dylib' ! -name '*.dll'`
do
if grep -q '("GHC RTS", "YES")' "$f"
then
# Looks like a GHC executable. Is it for the right version?
THIS_VERSION=`./$f +RTS --info | grep '"GHC version"' | sed -e 's/^ ,("GHC version", "//' -e 's/")$//'`
if [ "$THIS_VERSION" != "$EXPECTED_VERSION" ]
then
echo "Bad GHC version '$THIS_VERSION' for '$f'" >&2
exit 1
fi
fi
done
Hello world!
\ No newline at end of file
# See Note [Spaces in TEST_HC].
echo
echo 'Possible fix: put quotes around $(TEST_HC) in your Makefile.'
#!/usr/bin/env python3
import glob
import os
import os.path
import sys
from textwrap import dedent
import subprocess
import re
import shutil
# Packages whose libraries aren't in the submodule root
EXCEPTIONS = {
'libraries/containers/': 'libraries/containers/containers/'
}
def print_err(s):
print(dedent(s), file=sys.stderr)
def die(mesg):
print_err(mesg)
sys.exit(1)
def check_boot_packages():
# Check that we have all boot packages.
for l in open('packages', 'r'):
if l.startswith('#'):
continue
parts = [part for part in l.split(' ') if part]
if len(parts) != 4:
die("Error: Bad line in packages file: " + l)
dir_ = parts[0]
tag = parts[1]
# If tag is not "-" then it is an optional repository, so its
# absence isn't an error.
if tag == '-':
# We would like to just check for a .git directory here,
# but in an lndir tree we avoid making .git directories,
# so it doesn't exist. We therefore require that every repo
# has a LICENSE file instead.
license_path = os.path.join(EXCEPTIONS.get(dir_+'/', dir_), 'LICENSE')
if not os.path.isfile(license_path):
die("""\
Error: %s doesn't exist
Maybe you haven't run 'git submodule update --init'?
""" % license_path)
def autoreconf():
# Run autoreconf on everything that needs it.
processes = {}
if os.name == 'nt':
# Get the normalized ACLOCAL_PATH for Windows
# This is necessary since on Windows this will be a Windows
# path, which autoreconf doesn't know doesn't know how to handle.
ac_local = os.getenv('ACLOCAL_PATH', '')
ac_local_arg = re.sub(r';', r':', ac_local)
ac_local_arg = re.sub(r'\\', r'/', ac_local_arg)
ac_local_arg = re.sub(r'(\w):/', r'/\1/', ac_local_arg)
reconf_cmd = 'ACLOCAL_PATH=%s autoreconf' % ac_local_arg
else:
reconf_cmd = 'autoreconf'
for dir_ in ['.', 'rts'] + glob.glob('libraries/*/'):
if os.path.isfile(os.path.join(dir_, 'configure.ac')):
print("Booting %s" % dir_)
processes[dir_] = subprocess.Popen(['sh', '-c', reconf_cmd], cwd=dir_)
# Wait for all child processes to finish.
fail = False
for k,v in processes.items():
code = v.wait()
if code != 0:
print_err('autoreconf in %s failed with exit code %d' % (k, code))
fail = True
if fail:
sys.exit(1)
check_boot_packages()
autoreconf()
packages: ./compiler
./utils/genprimopcode/
./utils/deriveConstants/
./ghc/
-- ./libraries/array
-- ./libraries/base
./libraries/binary
./libraries/bytestring
./libraries/Cabal/Cabal
./libraries/Cabal/Cabal-syntax
./libraries/containers/containers/
-- ./libraries/deepseq/
./libraries/directory/
./libraries/exceptions/
./libraries/file-io/
./libraries/filepath/
-- ./libraries/ghc-bignum/
./libraries/ghc-boot/
-- ./libraries/ghc-boot-th/
./libraries/ghc-compact
./libraries/ghc-experimental
./libraries/ghc-heap
./libraries/ghci
-- ./libraries/ghc-prim
./libraries/haskeline
./libraries/directory
./libraries/hpc
-- ./libraries/integer-gmp
./libraries/mtl/
./libraries/os-string/
./libraries/parsec/
-- ./libraries/pretty/
./libraries/process/
./libraries/semaphore-compat
./libraries/stm
-- ./libraries/template-haskell/
./libraries/terminfo/
./libraries/text
./libraries/time
./libraries/transformers/
./libraries/unix/
./libraries/Win32/
./libraries/xhtml/
./utils/ghc-pkg
./utils/ghc-toolchain
./utils/ghc-toolchain/exe
./utils/haddock
./utils/haddock/haddock-api
./utils/haddock/haddock-library
./utils/hp2ps
./utils/hpc
./utils/hsc2hs
./utils/runghc
./utils/unlit
./utils/iserv
./linters/**/*.cabal
constraints: ghc +internal-interpreter +dynamic-system-linke,
ghc-bin +internal-interpreter +threaded,
ghci +internal-interpreter,
haddock +in-ghc-tree,
any.array installed,
any.base installed,
any.deepseq installed,
any.ghc-bignum installed,
any.ghc-boot-th installed,
any.integer-gmp installed,
any.pretty installed,
any.template-haskell installed
benchmarks: False
tests: False
allow-boot-library-installs: True
-- Workaround for https://github.com/haskell/cabal/issues/7297
package *
library-vanilla: True
shared: True
executable-profiling: False
executable-dynamic: True
-Wimplicit
-include
rts/include/ghcversion.h
-Irts/include
-I_build/stage1/rts/build
-I_build/stage1/rts/build/include
-Irts
-Ilibraries/ghc-internal/include
-I_build/stage1/libraries/ghc-internal/build/include
-Ilibraries/ghc-bignum/include
-I_build/stage1/libraries/ghc-bignum/build/include
-Wno-unknown-pragmas
-Wall
-Wextra
-Wstrict-prototypes
-Wmissing-prototypes
-Wmissing-declarations
-Winline
-Wpointer-arith
-Wmissing-noreturn
-Wnested-externs
-Wredundant-decls
-Wundef
-DFS_NAMESPACE=rts
-DCOMPILING_RTS
-DTHREADED_RTS
-DDEBUG
-DDYNAMIC
-DPROFILING
# HLint configuration file
# https://github.com/ndmitchell/hlint
##########################
- ignore: {}
- warn: {name: Unused LANGUAGE pragma}
- warn: {name: Use fewer LANGUAGE pragmas}
- warn: {name: Redundant return}
- warn: {name: Redundant True guards}
- warn: {name: Redundant variable capture}
- warn: {name: Redundant void}
- warn: {name: Redundant as}
- warn: {name: Use fewer imports}
- warn: {name: Redundant as-pattern}
- warn: {name: Redundant where}
## Exceptions
# Sometimes, the hlint parser flags some functions and modules as incorrectly
# using a language extension. Some other times, we need to make exceptions to
# lints that we otherwise want applied elsewhere. Such exceptions are listed
# below.
- ignore: {name: Redundant do, within: [GHC.SysTools.Terminal, GHC.Utils.Binary]}
- ignore: {name: Use fewer imports, within: [GHC.Parser, GHC.Cmm.Parser ] }
- ignore: {name: Redundant return, within: [GHC.Data.FastString] }
- ignore: {within: [GHC.Parser, GHC.Parser.Lexer, GHC.Parser.HaddockLex] }
## Restricted modules
- warn: {name: Avoid restricted module}
# see comments in affected modules
- modules:
- {name: [GHC.Driver.Backend.Internal], within: [GHC.Driver.Backend], message: "This module is for clients of the GHC API only. Do not use it within the compiler."}
import GHC.Cmm.Expr
#if !(defined(MACHREGS_i386) || defined(MACHREGS_x86_64) \
|| defined(MACHREGS_powerpc) || defined(MACHREGS_aarch64) \
|| defined(MACHREGS_riscv64))
import GHC.Utils.Panic.Plain
#endif
import GHC.Platform.Reg
#include "MachRegs.h"
#if defined(MACHREGS_i386) || defined(MACHREGS_x86_64)
# if defined(MACHREGS_i386)
# define eax 0
# define ebx 1
# define ecx 2
# define edx 3
# define esi 4
# define edi 5
# define ebp 6
# define esp 7
# endif
# if defined(MACHREGS_x86_64)
# define rax 0
# define rbx 1
# define rcx 2
# define rdx 3
# define rsi 4
# define rdi 5
# define rbp 6
# define rsp 7
# define r8 8
# define r9 9
# define r10 10
# define r11 11
# define r12 12
# define r13 13
# define r14 14
# define r15 15
# endif
-- N.B. XMM, YMM, and ZMM are all aliased to the same hardware registers hence
-- being assigned the same RegNos.
# define xmm0 16
# define xmm1 17
# define xmm2 18
# define xmm3 19
# define xmm4 20
# define xmm5 21
# define xmm6 22
# define xmm7 23
# define xmm8 24
# define xmm9 25
# define xmm10 26
# define xmm11 27
# define xmm12 28
# define xmm13 29
# define xmm14 30
# define xmm15 31
# define ymm0 16
# define ymm1 17
# define ymm2 18
# define ymm3 19
# define ymm4 20
# define ymm5 21
# define ymm6 22
# define ymm7 23
# define ymm8 24
# define ymm9 25
# define ymm10 26
# define ymm11 27
# define ymm12 28
# define ymm13 29
# define ymm14 30
# define ymm15 31
# define zmm0 16
# define zmm1 17
# define zmm2 18
# define zmm3 19
# define zmm4 20
# define zmm5 21
# define zmm6 22
# define zmm7 23
# define zmm8 24
# define zmm9 25
# define zmm10 26
# define zmm11 27
# define zmm12 28
# define zmm13 29
# define zmm14 30
# define zmm15 31
-- Note: these are only needed for ARM/AArch64 because globalRegMaybe is now used in CmmSink.hs.
-- Since it's only used to check 'isJust', the actual values don't matter, thus
-- I'm not sure if these are the correct numberings.
-- Normally, the register names are just stringified as part of the REG() macro
#elif defined(MACHREGS_powerpc) || defined(MACHREGS_arm) \
|| defined(MACHREGS_aarch64)
# define r0 0
# define r1 1
# define r2 2
# define r3 3
# define r4 4
# define r5 5
# define r6 6
# define r7 7
# define r8 8
# define r9 9
# define r10 10
# define r11 11
# define r12 12
# define r13 13
# define r14 14
# define r15 15
# define r16 16
# define r17 17
# define r18 18
# define r19 19
# define r20 20
# define r21 21
# define r22 22
# define r23 23
# define r24 24
# define r25 25
# define r26 26
# define r27 27
# define r28 28
# define r29 29
# define r30 30
# define r31 31
-- See note above. These aren't actually used for anything except satisfying the compiler for globalRegMaybe
-- so I'm unsure if they're the correct numberings, should they ever be attempted to be used in the NCG.
#if defined(MACHREGS_aarch64) || defined(MACHREGS_arm)
# define s0 32
# define s1 33
# define s2 34
# define s3 35
# define s4 36
# define s5 37
# define s6 38
# define s7 39
# define s8 40
# define s9 41
# define s10 42
# define s11 43
# define s12 44
# define s13 45
# define s14 46
# define s15 47
# define s16 48
# define s17 49
# define s18 50
# define s19 51
# define s20 52
# define s21 53
# define s22 54
# define s23 55
# define s24 56
# define s25 57
# define s26 58
# define s27 59
# define s28 60
# define s29 61
# define s30 62
# define s31 63
# define d0 32
# define d1 33
# define d2 34
# define d3 35
# define d4 36
# define d5 37
# define d6 38
# define d7 39
# define d8 40
# define d9 41
# define d10 42
# define d11 43
# define d12 44
# define d13 45
# define d14 46
# define d15 47
# define d16 48
# define d17 49
# define d18 50
# define d19 51
# define d20 52
# define d21 53
# define d22 54
# define d23 55
# define d24 56
# define d25 57
# define d26 58
# define d27 59
# define d28 60
# define d29 61
# define d30 62
# define d31 63
# define q0 32
# define q1 33
# define q2 34
# define q3 35
# define q4 36
# define q5 37
# define q6 38
# define q7 39
# define q8 40
# define q9 41
# define q10 42
# define q11 43
# define q12 44
# define q13 45
# define q14 46
# define q15 47
# define q16 48
# define q17 49
# define q18 50
# define q19 51
# define q20 52
# define q21 53
# define q22 54
# define q23 55
# define q24 56
# define q25 57
# define q26 58
# define q27 59
# define q28 60
# define q29 61
# define q30 62
# define q31 63
#endif
# if defined(MACHREGS_darwin)
# define f0 32
# define f1 33
# define f2 34
# define f3 35
# define f4 36
# define f5 37
# define f6 38
# define f7 39
# define f8 40
# define f9 41
# define f10 42
# define f11 43
# define f12 44
# define f13 45
# define f14 46
# define f15 47
# define f16 48
# define f17 49
# define f18 50
# define f19 51
# define f20 52
# define f21 53
# define f22 54
# define f23 55
# define f24 56
# define f25 57
# define f26 58
# define f27 59
# define f28 60
# define f29 61
# define f30 62
# define f31 63
# else
# define fr0 32
# define fr1 33
# define fr2 34
# define fr3 35
# define fr4 36
# define fr5 37
# define fr6 38
# define fr7 39
# define fr8 40
# define fr9 41
# define fr10 42
# define fr11 43
# define fr12 44
# define fr13 45
# define fr14 46
# define fr15 47
# define fr16 48
# define fr17 49
# define fr18 50
# define fr19 51
# define fr20 52
# define fr21 53
# define fr22 54
# define fr23 55
# define fr24 56
# define fr25 57
# define fr26 58
# define fr27 59
# define fr28 60
# define fr29 61
# define fr30 62
# define fr31 63
# endif
#elif defined(MACHREGS_s390x)
# define r0 0
# define r1 1
# define r2 2
# define r3 3
# define r4 4
# define r5 5
# define r6 6
# define r7 7
# define r8 8
# define r9 9
# define r10 10
# define r11 11
# define r12 12
# define r13 13
# define r14 14
# define r15 15
# define f0 16
# define f1 17
# define f2 18
# define f3 19
# define f4 20
# define f5 21
# define f6 22
# define f7 23
# define f8 24
# define f9 25
# define f10 26
# define f11 27
# define f12 28
# define f13 29
# define f14 30
# define f15 31
#elif defined(MACHREGS_riscv64)
# define zero 0
# define ra 1
# define sp 2
# define gp 3
# define tp 4
# define t0 5
# define t1 6
# define t2 7
# define s0 8
# define s1 9
# define a0 10
# define a1 11
# define a2 12
# define a3 13
# define a4 14
# define a5 15
# define a6 16
# define a7 17
# define s2 18
# define s3 19
# define s4 20
# define s5 21
# define s6 22
# define s7 23
# define s8 24
# define s9 25
# define s10 26
# define s11 27
# define t3 28
# define t4 29
# define t5 30
# define t6 31
# define ft0 32
# define ft1 33
# define ft2 34
# define ft3 35
# define ft4 36
# define ft5 37
# define ft6 38
# define ft7 39
# define fs0 40
# define fs1 41
# define fa0 42
# define fa1 43
# define fa2 44
# define fa3 45
# define fa4 46
# define fa5 47
# define fa6 48
# define fa7 49
# define fs2 50
# define fs3 51
# define fs4 52
# define fs5 53
# define fs6 54
# define fs7 55
# define fs8 56
# define fs9 57
# define fs10 58
# define fs11 59
# define ft8 60
# define ft9 61
# define ft10 62
# define ft11 63
#elif defined(MACHREGS_loongarch64)
# define zero 0
# define ra 1
# define tp 2
# define sp 3
# define a0 4
# define a1 5
# define a2 6
# define a3 7
# define a4 8
# define a5 9
# define a6 10
# define a7 11
# define t0 12
# define t1 13
# define t2 14
# define t3 15
# define t4 16
# define t5 17
# define t6 18
# define t7 19
# define t8 20
# define u0 21
# define fp 22
# define s0 23
# define s1 24
# define s2 25
# define s3 26
# define s4 27
# define s5 28
# define s6 29
# define s7 30
# define s8 31
# define fa0 32
# define fa1 33
# define fa2 34
# define fa3 35
# define fa4 36
# define fa5 37
# define fa6 38
# define fa7 39
# define ft0 40
# define ft1 41
# define ft2 42
# define ft3 43
# define ft4 44
# define ft5 45
# define ft6 46
# define ft7 47
# define ft8 48
# define ft9 49
# define ft10 50
# define ft11 51
# define ft12 52
# define ft13 53
# define ft14 54
# define ft15 55
# define fs0 56
# define fs1 57
# define fs2 58
# define fs3 59
# define fs4 60
# define fs5 61
# define fs6 62
# define fs7 63
#endif
-- See also Note [Caller saves and callee-saves regs.]
callerSaves :: GlobalReg -> Bool
#if defined(CALLER_SAVES_Base)
callerSaves BaseReg = True
#endif
#if defined(CALLER_SAVES_R1)
callerSaves (VanillaReg 1) = True
#endif
#if defined(CALLER_SAVES_R2)
callerSaves (VanillaReg 2) = True
#endif
#if defined(CALLER_SAVES_R3)
callerSaves (VanillaReg 3) = True
#endif
#if defined(CALLER_SAVES_R4)
callerSaves (VanillaReg 4) = True
#endif
#if defined(CALLER_SAVES_R5)
callerSaves (VanillaReg 5) = True
#endif
#if defined(CALLER_SAVES_R6)
callerSaves (VanillaReg 6) = True
#endif
#if defined(CALLER_SAVES_R7)
callerSaves (VanillaReg 7) = True
#endif
#if defined(CALLER_SAVES_R8)
callerSaves (VanillaReg 8) = True
#endif
#if defined(CALLER_SAVES_R9)
callerSaves (VanillaReg 9) = True
#endif
#if defined(CALLER_SAVES_R10)
callerSaves (VanillaReg 10) = True
#endif
#if defined(CALLER_SAVES_F1)
callerSaves (FloatReg 1) = True
#endif
#if defined(CALLER_SAVES_F2)
callerSaves (FloatReg 2) = True
#endif
#if defined(CALLER_SAVES_F3)
callerSaves (FloatReg 3) = True
#endif
#if defined(CALLER_SAVES_F4)
callerSaves (FloatReg 4) = True
#endif
#if defined(CALLER_SAVES_F5)
callerSaves (FloatReg 5) = True
#endif
#if defined(CALLER_SAVES_F6)
callerSaves (FloatReg 6) = True
#endif
#if defined(CALLER_SAVES_D1)
callerSaves (DoubleReg 1) = True
#endif
#if defined(CALLER_SAVES_D2)
callerSaves (DoubleReg 2) = True
#endif
#if defined(CALLER_SAVES_D3)
callerSaves (DoubleReg 3) = True
#endif
#if defined(CALLER_SAVES_D4)
callerSaves (DoubleReg 4) = True
#endif
#if defined(CALLER_SAVES_D5)
callerSaves (DoubleReg 5) = True
#endif
#if defined(CALLER_SAVES_D6)
callerSaves (DoubleReg 6) = True
#endif
#if defined(CALLER_SAVES_L1)
callerSaves (LongReg 1) = True
#endif
#if defined(CALLER_SAVES_Sp)
callerSaves Sp = True
#endif
#if defined(CALLER_SAVES_SpLim)
callerSaves SpLim = True
#endif
#if defined(CALLER_SAVES_Hp)
callerSaves Hp = True
#endif
#if defined(CALLER_SAVES_HpLim)
callerSaves HpLim = True
#endif
#if defined(CALLER_SAVES_CCCS)
callerSaves CCCS = True
#endif
#if defined(CALLER_SAVES_CurrentTSO)
callerSaves CurrentTSO = True
#endif
#if defined(CALLER_SAVES_CurrentNursery)
callerSaves CurrentNursery = True
#endif
callerSaves _ = False
activeStgRegs :: [GlobalReg]
activeStgRegs = [
#if defined(REG_Base)
BaseReg
#endif
#if defined(REG_Sp)
,Sp
#endif
#if defined(REG_Hp)
,Hp
#endif
#if defined(REG_R1)
,VanillaReg 1
#endif
#if defined(REG_R2)
,VanillaReg 2
#endif
#if defined(REG_R3)
,VanillaReg 3
#endif
#if defined(REG_R4)
,VanillaReg 4
#endif
#if defined(REG_R5)
,VanillaReg 5
#endif
#if defined(REG_R6)
,VanillaReg 6
#endif
#if defined(REG_R7)
,VanillaReg 7
#endif
#if defined(REG_R8)
,VanillaReg 8
#endif
#if defined(REG_R9)
,VanillaReg 9
#endif
#if defined(REG_R10)
,VanillaReg 10
#endif
#if defined(REG_SpLim)
,SpLim
#endif
#if MAX_REAL_XMM_REG != 0
#if defined(REG_F1)
,FloatReg 1
#endif
#if defined(REG_D1)
,DoubleReg 1
#endif
#if defined(REG_XMM1)
,XmmReg 1
#endif
#if defined(REG_YMM1)
,YmmReg 1
#endif
#if defined(REG_ZMM1)
,ZmmReg 1
#endif
#if defined(REG_F2)
,FloatReg 2
#endif
#if defined(REG_D2)
,DoubleReg 2
#endif
#if defined(REG_XMM2)
,XmmReg 2
#endif
#if defined(REG_YMM2)
,YmmReg 2
#endif
#if defined(REG_ZMM2)
,ZmmReg 2
#endif
#if defined(REG_F3)
,FloatReg 3
#endif
#if defined(REG_D3)
,DoubleReg 3
#endif
#if defined(REG_XMM3)
,XmmReg 3
#endif
#if defined(REG_YMM3)
,YmmReg 3
#endif
#if defined(REG_ZMM3)
,ZmmReg 3
#endif
#if defined(REG_F4)
,FloatReg 4
#endif
#if defined(REG_D4)
,DoubleReg 4
#endif
#if defined(REG_XMM4)
,XmmReg 4
#endif
#if defined(REG_YMM4)
,YmmReg 4
#endif
#if defined(REG_ZMM4)
,ZmmReg 4
#endif
#if defined(REG_F5)
,FloatReg 5
#endif
#if defined(REG_D5)
,DoubleReg 5
#endif
#if defined(REG_XMM5)
,XmmReg 5
#endif
#if defined(REG_YMM5)
,YmmReg 5
#endif
#if defined(REG_ZMM5)
,ZmmReg 5
#endif
#if defined(REG_F6)
,FloatReg 6
#endif
#if defined(REG_D6)
,DoubleReg 6
#endif
#if defined(REG_XMM6)
,XmmReg 6
#endif
#if defined(REG_YMM6)
,YmmReg 6
#endif
#if defined(REG_ZMM6)
,ZmmReg 6
#endif
#else /* MAX_REAL_XMM_REG == 0 */
#if defined(REG_F1)
,FloatReg 1
#endif
#if defined(REG_F2)
,FloatReg 2
#endif
#if defined(REG_F3)
,FloatReg 3
#endif
#if defined(REG_F4)
,FloatReg 4
#endif
#if defined(REG_F5)
,FloatReg 5
#endif
#if defined(REG_F6)
,FloatReg 6
#endif
#if defined(REG_D1)
,DoubleReg 1
#endif
#if defined(REG_D2)
,DoubleReg 2
#endif
#if defined(REG_D3)
,DoubleReg 3
#endif
#if defined(REG_D4)
,DoubleReg 4
#endif
#if defined(REG_D5)
,DoubleReg 5
#endif
#if defined(REG_D6)
,DoubleReg 6
#endif
#endif /* MAX_REAL_XMM_REG == 0 */
]
haveRegBase :: Bool
#if defined(REG_Base)
haveRegBase = True
#else
haveRegBase = False
#endif
-- | Returns 'Nothing' if this global register is not stored
-- in a real machine register, otherwise returns @'Just' reg@, where
-- reg is the machine register it is stored in.
globalRegMaybe :: GlobalReg -> Maybe RealReg
#if defined(MACHREGS_i386) || defined(MACHREGS_x86_64) \
|| defined(MACHREGS_powerpc) \
|| defined(MACHREGS_arm) || defined(MACHREGS_aarch64) \
|| defined(MACHREGS_s390x) || defined(MACHREGS_riscv64) \
|| defined(MACHREGS_wasm32) \
|| defined(MACHREGS_loongarch64)
# if defined(REG_Base)
globalRegMaybe BaseReg = Just (RealRegSingle REG_Base)
# endif
# if defined(REG_R1)
globalRegMaybe (VanillaReg 1) = Just (RealRegSingle REG_R1)
# endif
# if defined(REG_R2)
globalRegMaybe (VanillaReg 2) = Just (RealRegSingle REG_R2)
# endif
# if defined(REG_R3)
globalRegMaybe (VanillaReg 3) = Just (RealRegSingle REG_R3)
# endif
# if defined(REG_R4)
globalRegMaybe (VanillaReg 4) = Just (RealRegSingle REG_R4)
# endif
# if defined(REG_R5)
globalRegMaybe (VanillaReg 5) = Just (RealRegSingle REG_R5)
# endif
# if defined(REG_R6)
globalRegMaybe (VanillaReg 6) = Just (RealRegSingle REG_R6)
# endif
# if defined(REG_R7)
globalRegMaybe (VanillaReg 7) = Just (RealRegSingle REG_R7)
# endif
# if defined(REG_R8)
globalRegMaybe (VanillaReg 8) = Just (RealRegSingle REG_R8)
# endif
# if defined(REG_R9)
globalRegMaybe (VanillaReg 9) = Just (RealRegSingle REG_R9)
# endif
# if defined(REG_R10)
globalRegMaybe (VanillaReg 10) = Just (RealRegSingle REG_R10)
# endif
# if defined(REG_F1)
globalRegMaybe (FloatReg 1) = Just (RealRegSingle REG_F1)
# endif
# if defined(REG_F2)
globalRegMaybe (FloatReg 2) = Just (RealRegSingle REG_F2)
# endif
# if defined(REG_F3)
globalRegMaybe (FloatReg 3) = Just (RealRegSingle REG_F3)
# endif
# if defined(REG_F4)
globalRegMaybe (FloatReg 4) = Just (RealRegSingle REG_F4)
# endif
# if defined(REG_F5)
globalRegMaybe (FloatReg 5) = Just (RealRegSingle REG_F5)
# endif
# if defined(REG_F6)
globalRegMaybe (FloatReg 6) = Just (RealRegSingle REG_F6)
# endif
# if defined(REG_D1)
globalRegMaybe (DoubleReg 1) = Just (RealRegSingle REG_D1)
# endif
# if defined(REG_D2)
globalRegMaybe (DoubleReg 2) = Just (RealRegSingle REG_D2)
# endif
# if defined(REG_D3)
globalRegMaybe (DoubleReg 3) = Just (RealRegSingle REG_D3)
# endif
# if defined(REG_D4)
globalRegMaybe (DoubleReg 4) = Just (RealRegSingle REG_D4)
# endif
# if defined(REG_D5)
globalRegMaybe (DoubleReg 5) = Just (RealRegSingle REG_D5)
# endif
# if defined(REG_D6)
globalRegMaybe (DoubleReg 6) = Just (RealRegSingle REG_D6)
# endif
# if MAX_REAL_XMM_REG != 0
# if defined(REG_XMM1)
globalRegMaybe (XmmReg 1) = Just (RealRegSingle REG_XMM1)
# endif
# if defined(REG_XMM2)
globalRegMaybe (XmmReg 2) = Just (RealRegSingle REG_XMM2)
# endif
# if defined(REG_XMM3)
globalRegMaybe (XmmReg 3) = Just (RealRegSingle REG_XMM3)
# endif
# if defined(REG_XMM4)
globalRegMaybe (XmmReg 4) = Just (RealRegSingle REG_XMM4)
# endif
# if defined(REG_XMM5)
globalRegMaybe (XmmReg 5) = Just (RealRegSingle REG_XMM5)
# endif
# if defined(REG_XMM6)
globalRegMaybe (XmmReg 6) = Just (RealRegSingle REG_XMM6)
# endif
# endif
# if defined(MAX_REAL_YMM_REG) && MAX_REAL_YMM_REG != 0
# if defined(REG_YMM1)
globalRegMaybe (YmmReg 1) = Just (RealRegSingle REG_YMM1)
# endif
# if defined(REG_YMM2)
globalRegMaybe (YmmReg 2) = Just (RealRegSingle REG_YMM2)
# endif
# if defined(REG_YMM3)
globalRegMaybe (YmmReg 3) = Just (RealRegSingle REG_YMM3)
# endif
# if defined(REG_YMM4)
globalRegMaybe (YmmReg 4) = Just (RealRegSingle REG_YMM4)
# endif
# if defined(REG_YMM5)
globalRegMaybe (YmmReg 5) = Just (RealRegSingle REG_YMM5)
# endif
# if defined(REG_YMM6)
globalRegMaybe (YmmReg 6) = Just (RealRegSingle REG_YMM6)
# endif
# endif
# if defined(MAX_REAL_ZMM_REG) && MAX_REAL_ZMM_REG != 0
# if defined(REG_ZMM1)
globalRegMaybe (ZmmReg 1) = Just (RealRegSingle REG_ZMM1)
# endif
# if defined(REG_ZMM2)
globalRegMaybe (ZmmReg 2) = Just (RealRegSingle REG_ZMM2)
# endif
# if defined(REG_ZMM3)
globalRegMaybe (ZmmReg 3) = Just (RealRegSingle REG_ZMM3)
# endif
# if defined(REG_ZMM4)
globalRegMaybe (ZmmReg 4) = Just (RealRegSingle REG_ZMM4)
# endif
# if defined(REG_ZMM5)
globalRegMaybe (ZmmReg 5) = Just (RealRegSingle REG_ZMM5)
# endif
# if defined(REG_ZMM6)
globalRegMaybe (ZmmReg 6) = Just (RealRegSingle REG_ZMM6)
# endif
# endif
# if defined(REG_Sp)
globalRegMaybe Sp = Just (RealRegSingle REG_Sp)
# endif
# if defined(REG_Lng1)
globalRegMaybe (LongReg 1) = Just (RealRegSingle REG_Lng1)
# endif
# if defined(REG_Lng2)
globalRegMaybe (LongReg 2) = Just (RealRegSingle REG_Lng2)
# endif
# if defined(REG_SpLim)
globalRegMaybe SpLim = Just (RealRegSingle REG_SpLim)
# endif
# if defined(REG_Hp)
globalRegMaybe Hp = Just (RealRegSingle REG_Hp)
# endif
# if defined(REG_HpLim)
globalRegMaybe HpLim = Just (RealRegSingle REG_HpLim)
# endif
# if defined(REG_CurrentTSO)
globalRegMaybe CurrentTSO = Just (RealRegSingle REG_CurrentTSO)
# endif
# if defined(REG_CurrentNursery)
globalRegMaybe CurrentNursery = Just (RealRegSingle REG_CurrentNursery)
# endif
# if defined(REG_MachSp)
globalRegMaybe MachSp = Just (RealRegSingle REG_MachSp)
# endif
globalRegMaybe _ = Nothing
#elif defined(MACHREGS_NO_REGS)
globalRegMaybe _ = Nothing
#else
globalRegMaybe = panic "globalRegMaybe not defined for this platform"
#endif
freeReg :: RegNo -> Bool
#if defined(MACHREGS_i386) || defined(MACHREGS_x86_64)
# if defined(MACHREGS_i386)
freeReg esp = False -- %esp is the C stack pointer
freeReg esi = False -- See Note [esi/edi/ebp not allocatable]
freeReg edi = False
freeReg ebp = False
# endif
# if defined(MACHREGS_x86_64)
freeReg rsp = False -- %rsp is the C stack pointer
# endif
{-
Note [esi/edi/ebp not allocatable]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
%esi is mapped to R1, so %esi would normally be allocatable while it
is not being used for R1. However, %esi has no 8-bit version on x86,
and the linear register allocator is not sophisticated enough to
handle this irregularity (we need more RegClasses). The
graph-colouring allocator also cannot handle this - it was designed
with more flexibility in mind, but the current implementation is
restricted to the same set of classes as the linear allocator.
Hence, on x86 esi, edi and ebp are treated as not allocatable.
-}
-- split patterns in two functions to prevent overlaps
freeReg r = freeRegBase r
freeRegBase :: RegNo -> Bool
# if defined(REG_Base)
freeRegBase REG_Base = False
# endif
# if defined(REG_Sp)
freeRegBase REG_Sp = False
# endif
# if defined(REG_SpLim)
freeRegBase REG_SpLim = False
# endif
# if defined(REG_Hp)
freeRegBase REG_Hp = False
# endif
# if defined(REG_HpLim)
freeRegBase REG_HpLim = False
# endif
-- All other regs are considered to be "free", because we can track
-- their liveness accurately.
freeRegBase _ = True
#elif defined(MACHREGS_powerpc)
freeReg 0 = False -- Used by code setting the back chain pointer
-- in stack reallocations on Linux.
-- Moreover r0 is not usable in all insns.
freeReg 1 = False -- The Stack Pointer
-- most ELF PowerPC OSes use r2 as a TOC pointer
freeReg 2 = False
freeReg 13 = False -- reserved for system thread ID on 64 bit
-- at least linux in -fPIC relies on r30 in PLT stubs
freeReg 30 = False
{- TODO: reserve r13 on 64 bit systems only and r30 on 32 bit respectively.
For now we use r30 on 64 bit and r13 on 32 bit as a temporary register
in stack handling code. See compiler/GHC/CmmToAsm/PPC/Instr.hs.
Later we might want to reserve r13 and r30 only where it is required.
Then use r12 as temporary register, which is also what the C ABI does.
-}
# if defined(REG_Base)
freeReg REG_Base = False
# endif
# if defined(REG_Sp)
freeReg REG_Sp = False
# endif
# if defined(REG_SpLim)
freeReg REG_SpLim = False
# endif
# if defined(REG_Hp)
freeReg REG_Hp = False
# endif
# if defined(REG_HpLim)
freeReg REG_HpLim = False
# endif
freeReg _ = True
#elif defined(MACHREGS_aarch64)
-- stack pointer / zero reg
freeReg 31 = False
-- link register
freeReg 30 = False
-- frame pointer
freeReg 29 = False
-- ip0 -- used for spill offset computations
freeReg 16 = False
#if defined(darwin_HOST_OS) || defined(ios_HOST_OS)
-- x18 is reserved by the platform on Darwin/iOS, and can not be used
-- More about ARM64 ABI that Apple platforms support:
-- https://developer.apple.com/documentation/xcode/writing-arm64-code-for-apple-platforms
-- https://github.com/Siguza/ios-resources/blob/master/bits/arm64.md
freeReg 18 = False
#endif
# if defined(REG_Base)
freeReg REG_Base = False
# endif
# if defined(REG_Sp)
freeReg REG_Sp = False
# endif
# if defined(REG_SpLim)
freeReg REG_SpLim = False
# endif
# if defined(REG_Hp)
freeReg REG_Hp = False
# endif
# if defined(REG_HpLim)
freeReg REG_HpLim = False
# endif
# if defined(REG_R1)
freeReg REG_R1 = False
# endif
# if defined(REG_R2)
freeReg REG_R2 = False
# endif
# if defined(REG_R3)
freeReg REG_R3 = False
# endif
# if defined(REG_R4)
freeReg REG_R4 = False
# endif
# if defined(REG_R5)
freeReg REG_R5 = False
# endif
# if defined(REG_R6)
freeReg REG_R6 = False
# endif
# if defined(REG_R7)
freeReg REG_R7 = False
# endif
# if defined(REG_R8)
freeReg REG_R8 = False
# endif
# if defined(REG_F1)
freeReg REG_F1 = False
# endif
# if defined(REG_F2)
freeReg REG_F2 = False
# endif
# if defined(REG_F3)
freeReg REG_F3 = False
# endif
# if defined(REG_F4)
freeReg REG_F4 = False
# endif
# if defined(REG_F5)
freeReg REG_F5 = False
# endif
# if defined(REG_F6)
freeReg REG_F6 = False
# endif
# if defined(REG_D1)
freeReg REG_D1 = False
# endif
# if defined(REG_D2)
freeReg REG_D2 = False
# endif
# if defined(REG_D3)
freeReg REG_D3 = False
# endif
# if defined(REG_D4)
freeReg REG_D4 = False
# endif
# if defined(REG_D5)
freeReg REG_D5 = False
# endif
# if defined(REG_D6)
freeReg REG_D6 = False
# endif
freeReg _ = True
#elif defined(MACHREGS_riscv64)
-- zero reg
freeReg 0 = False
-- link register
freeReg 1 = False
-- stack pointer
freeReg 2 = False
-- global pointer
freeReg 3 = False
-- thread pointer
freeReg 4 = False
-- frame pointer
freeReg 8 = False
-- made-up inter-procedural (ip) register
-- See Note [The made-up RISCV64 TMP (IP) register]
freeReg 31 = False
# if defined(REG_Base)
freeReg REG_Base = False
# endif
# if defined(REG_Sp)
freeReg REG_Sp = False
# endif
# if defined(REG_SpLim)
freeReg REG_SpLim = False
# endif
# if defined(REG_Hp)
freeReg REG_Hp = False
# endif
# if defined(REG_HpLim)
freeReg REG_HpLim = False
# endif
# if defined(REG_R1)
freeReg REG_R1 = False
# endif
# if defined(REG_R2)
freeReg REG_R2 = False
# endif
# if defined(REG_R3)
freeReg REG_R3 = False
# endif
# if defined(REG_R4)
freeReg REG_R4 = False
# endif
# if defined(REG_R5)
freeReg REG_R5 = False
# endif
# if defined(REG_R6)
freeReg REG_R6 = False
# endif
# if defined(REG_R7)
freeReg REG_R7 = False
# endif
# if defined(REG_R8)
freeReg REG_R8 = False
# endif
# if defined(REG_F1)
freeReg REG_F1 = False
# endif
# if defined(REG_F2)
freeReg REG_F2 = False
# endif
# if defined(REG_F3)
freeReg REG_F3 = False
# endif
# if defined(REG_F4)
freeReg REG_F4 = False
# endif
# if defined(REG_F5)
freeReg REG_F5 = False
# endif
# if defined(REG_F6)
freeReg REG_F6 = False
# endif
# if defined(REG_D1)
freeReg REG_D1 = False
# endif
# if defined(REG_D2)
freeReg REG_D2 = False
# endif
# if defined(REG_D3)
freeReg REG_D3 = False
# endif
# if defined(REG_D4)
freeReg REG_D4 = False
# endif
# if defined(REG_D5)
freeReg REG_D5 = False
# endif
# if defined(REG_D6)
freeReg REG_D6 = False
# endif
freeReg _ = True
#else
freeReg = panic "freeReg not defined for this platform"
#endif
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
module GHC.Builtin.PrimOps where
-- See W1 of Note [Tracking dependencies on primitives] in GHC.Internal.Base
import GHC.Base ()
data PrimOp
{-
This module contains helpers to cast variables
between different Int/WordReps in StgLand.
-}
module GHC.Builtin.PrimOps.Casts
( getCasts )
where
import GHC.Prelude
import GHC.Core.TyCon
import GHC.Utils.Outputable
import GHC.Utils.Panic
import GHC.Types.RepType
import GHC.Core.Type
import GHC.Builtin.Types.Prim
import GHC.Builtin.PrimOps
import GHC.Plugins (HasDebugCallStack)
{- Note [PrimRep based casting]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This module contains a number of utility functions useful when
converting between variables of differing PrimReps.
The general pattern is:
* We have two primReps `from_rep` and `to_rep`.
* We want a list of PrimOps we can apply to a variable of rep `from_rep`.
Applying the list of primOps in order takes us to `to_rep` from `from_rep` giving
us a variable of the returned type at each step.
E.g. we call `getCasts from_rep to_rep` and get back [(op1#,ty1),(op2#,ty2)].
We can use this result to construct a function of type
`StgExpr -> StgExpr` by construction an expression
case op1# <from> of (x' :: ty1) -> case op2# x' of x' -> <rhs_hole>
Ideally backends will compile the sequence of PrimOps to a no-op. E.g. by reusing
the same register but just relabeling it as another width.
However this is might not always be possible or the required optimizations
simply not implemented in the backend. This means currently many of these casts
will be cheap but not all of them will be completely zero-cost.
-}
-- | `getCasts from_rep to_rep` gives us a list of primops which when applied in order convert from_rep to to_rep.
-- See Note [PrimRep based casting]
getCasts :: PrimRep -> PrimRep -> [(PrimOp,Type)]
getCasts from_rep to_rep
-- No-op
| -- pprTrace "getCasts" (ppr (from_rep,to_rep)) $
to_rep == from_rep
= []
-- Float <-> Double
| to_rep == FloatRep =
assertPpr (from_rep == DoubleRep) (ppr from_rep <+> ppr to_rep) $
[(DoubleToFloatOp,floatPrimTy)]
| to_rep == DoubleRep =
assertPpr (from_rep == FloatRep) (ppr from_rep <+> ppr to_rep) $
[(FloatToDoubleOp,doublePrimTy)]
-- Addr <-> Word/Int
| to_rep == AddrRep = wordOrIntToAddrRep from_rep
| from_rep == AddrRep = addrToWordOrIntRep to_rep
-- Int* -> Int*
| primRepIsInt from_rep
, primRepIsInt to_rep
= sizedIntToSizedInt from_rep to_rep
-- Word* -> Word*
| primRepIsWord from_rep
, primRepIsWord to_rep
= sizedWordToSizedWord from_rep to_rep
-- Word* -> Int*
| primRepIsWord from_rep
, primRepIsInt to_rep
= let (op1,r1) = wordToIntRep from_rep
in (op1,primRepToType r1):sizedIntToSizedInt r1 to_rep
-- Int* -> Word*
| primRepIsInt from_rep
, primRepIsWord to_rep
= let (op1,r1) = intToWordRep from_rep
in (op1,primRepToType r1):sizedWordToSizedWord r1 to_rep
| otherwise = pprPanic "getCasts:Unexpect rep combination"
(ppr (from_rep,to_rep))
wordOrIntToAddrRep :: HasDebugCallStack => PrimRep -> [(PrimOp,Type)]
wordOrIntToAddrRep AddrRep = [] -- No-op argument is already AddrRep
wordOrIntToAddrRep IntRep = [(IntToAddrOp, addrPrimTy)]
wordOrIntToAddrRep WordRep = [(WordToIntOp,intPrimTy), (IntToAddrOp,addrPrimTy)]
wordOrIntToAddrRep r
| primRepIsInt r = (intToMachineInt r,intPrimTy):[(IntToAddrOp,addrPrimTy)]
| primRepIsWord r =
let (op1,r1) = wordToIntRep r
in (op1, primRepToType r1):[(intToMachineInt r1,intPrimTy), (IntToAddrOp,addrPrimTy)]
| otherwise = pprPanic "Rep not word or int rep" (ppr r)
addrToWordOrIntRep :: HasDebugCallStack => PrimRep -> [(PrimOp,Type)]
-- Machine sizes
addrToWordOrIntRep IntRep = [(AddrToIntOp, intPrimTy)]
addrToWordOrIntRep WordRep = [(AddrToIntOp,intPrimTy), (IntToWordOp,wordPrimTy)]
-- Explicitly sized reps
addrToWordOrIntRep r
| primRepIsWord r = (AddrToIntOp,intPrimTy) : (IntToWordOp,wordPrimTy) : sizedWordToSizedWord WordRep r
| primRepIsInt r = (AddrToIntOp,intPrimTy) : sizedIntToSizedInt IntRep r
| otherwise = pprPanic "Target rep not word or int rep" (ppr r)
-- WordX# -> IntX# (same size), argument is source rep
wordToIntRep :: HasDebugCallStack => PrimRep -> (PrimOp,PrimRep)
wordToIntRep rep
= case rep of
(WordRep) -> (WordToIntOp, IntRep)
(Word8Rep) -> (Word8ToInt8Op, Int8Rep)
(Word16Rep) -> (Word16ToInt16Op, Int16Rep)
(Word32Rep) -> (Word32ToInt32Op, Int32Rep)
(Word64Rep) -> (Word64ToInt64Op, Int64Rep)
_ -> pprPanic "Rep not a wordRep" (ppr rep)
-- IntX# -> WordX#, argument is source rep
intToWordRep :: HasDebugCallStack => PrimRep -> (PrimOp,PrimRep)
intToWordRep rep
= case rep of
(IntRep) -> (IntToWordOp, WordRep)
(Int8Rep) -> (Int8ToWord8Op, Word8Rep)
(Int16Rep) -> (Int16ToWord16Op, Word16Rep)
(Int32Rep) -> (Int32ToWord32Op, Word32Rep)
(Int64Rep) -> (Int64ToWord64Op, Word64Rep)
_ -> pprPanic "Rep not a wordRep" (ppr rep)
-- Casts between any size int to any other size of int
sizedIntToSizedInt :: HasDebugCallStack => PrimRep -> PrimRep -> [(PrimOp,Type)]
sizedIntToSizedInt r1 r2
| r1 == r2 = []
-- Cast to Int#
sizedIntToSizedInt r IntRep = [(intToMachineInt r,intPrimTy)]
-- Cast from Int#
sizedIntToSizedInt IntRep r = [(intFromMachineInt r,primRepToType r)]
-- Sized to differently sized must go over machine word.
sizedIntToSizedInt r1 r2 = (intToMachineInt r1,intPrimTy) : [(intFromMachineInt r2,primRepToType r2)]
-- Casts between any size Word to any other size of Word
sizedWordToSizedWord :: HasDebugCallStack => PrimRep -> PrimRep -> [(PrimOp,Type)]
sizedWordToSizedWord r1 r2
| r1 == r2 = []
-- Cast to Word#
sizedWordToSizedWord r WordRep = [(wordToMachineWord r,wordPrimTy)]
-- Cast from Word#
sizedWordToSizedWord WordRep r = [(wordFromMachineWord r, primRepToType r)]
-- Conversion between different non-machine sizes must go via machine word.
sizedWordToSizedWord r1 r2 = (wordToMachineWord r1,wordPrimTy) : [(wordFromMachineWord r2, primRepToType r2)]
-- Prefer the definitions above this line if possible
----------------------
-- Int*# to Int#
{-# INLINE intToMachineInt #-}
intToMachineInt :: HasDebugCallStack => PrimRep -> PrimOp
intToMachineInt r =
assertPpr (primRepIsInt r) (ppr r) $
case r of
(Int8Rep) -> Int8ToIntOp
(Int16Rep) -> Int16ToIntOp
(Int32Rep) -> Int32ToIntOp
(Int64Rep) -> Int64ToIntOp
_ -> pprPanic "Source rep not int" $ ppr r
-- Int# to Int*#
{-# INLINE intFromMachineInt #-}
intFromMachineInt :: HasDebugCallStack => PrimRep -> PrimOp
intFromMachineInt r =
assertPpr (primRepIsInt r) (ppr r) $
case r of
Int8Rep -> IntToInt8Op
Int16Rep -> IntToInt16Op
Int32Rep -> IntToInt32Op
Int64Rep -> IntToInt64Op
_ -> pprPanic "Dest rep not sized int" $ ppr r
-- Word# to Word*#
{-# INLINE wordFromMachineWord #-}
wordFromMachineWord :: HasDebugCallStack => PrimRep -> PrimOp
wordFromMachineWord r =
assert (primRepIsWord r) $
case r of
Word8Rep -> WordToWord8Op
Word16Rep -> WordToWord16Op
Word32Rep -> WordToWord32Op
Word64Rep -> WordToWord64Op
_ -> pprPanic "Dest rep not sized word" $ ppr r
-- Word*# to Word#
{-# INLINE wordToMachineWord #-}
wordToMachineWord :: HasDebugCallStack => PrimRep -> PrimOp
wordToMachineWord r =
assertPpr (primRepIsWord r) (text "Not a word rep:" <> ppr r) $
case r of
Word8Rep -> Word8ToWordOp
Word16Rep -> Word16ToWordOp
Word32Rep -> Word32ToWordOp
Word64Rep -> Word64ToWordOp
_ -> pprPanic "Dest rep not sized word" $ ppr r
This diff is collapsed.
This diff is collapsed.
module GHC.Builtin.Types where
import {-# SOURCE #-} GHC.Core.TyCon ( TyCon )
import {-# SOURCE #-} GHC.Core.TyCo.Rep (Type, Kind, RuntimeRepType)
import {-# SOURCE #-} GHC.Core.DataCon ( DataCon )
import GHC.Types.Basic (Arity, TupleSort, Boxity, ConTag)
import {-# SOURCE #-} GHC.Types.Name (Name)
listTyCon :: TyCon
typeSymbolKind :: Type
charTy :: Type
mkBoxedTupleTy :: [Type] -> Type
coercibleTyCon, heqTyCon :: TyCon
unitTy :: Type
unitTyCon :: TyCon
liftedTypeKindTyConName :: Name
constraintKindTyConName :: Name
liftedTypeKind, unliftedTypeKind, zeroBitTypeKind :: Kind
liftedTypeKindTyCon, unliftedTypeKindTyCon :: TyCon
liftedRepTyCon, unliftedRepTyCon :: TyCon
constraintKind :: Kind
runtimeRepTyCon, levityTyCon, vecCountTyCon, vecElemTyCon :: TyCon
runtimeRepTy, levityTy :: Type
boxedRepDataConTyCon, liftedDataConTyCon :: TyCon
vecRepDataConTyCon, tupleRepDataConTyCon :: TyCon
liftedRepTy, unliftedRepTy, zeroBitRepTy :: RuntimeRepType
liftedDataConTy, unliftedDataConTy :: Type
intRepDataConTy,
int8RepDataConTy, int16RepDataConTy, int32RepDataConTy, int64RepDataConTy,
wordRepDataConTy,
word8RepDataConTy, word16RepDataConTy, word32RepDataConTy, word64RepDataConTy,
addrRepDataConTy,
floatRepDataConTy, doubleRepDataConTy :: RuntimeRepType
vec2DataConTy, vec4DataConTy, vec8DataConTy, vec16DataConTy, vec32DataConTy,
vec64DataConTy :: Type
int8ElemRepDataConTy, int16ElemRepDataConTy, int32ElemRepDataConTy,
int64ElemRepDataConTy, word8ElemRepDataConTy, word16ElemRepDataConTy,
word32ElemRepDataConTy, word64ElemRepDataConTy, floatElemRepDataConTy,
doubleElemRepDataConTy :: Type
anyTypeOfKind :: Kind -> Type
unboxedTupleKind :: [Type] -> Type
multiplicityTyCon :: TyCon
multiplicityTy :: Type
oneDataConTy :: Type
oneDataConTyCon :: TyCon
manyDataConTy :: Type
manyDataConTyCon :: TyCon
unrestrictedFunTyCon :: TyCon
multMulTyCon :: TyCon
tupleTyConName :: TupleSort -> Arity -> Name
tupleDataConName :: Boxity -> Arity -> Name
integerTy, naturalTy :: Type
promotedTupleDataCon :: Boxity -> Arity -> TyCon
tupleDataCon :: Boxity -> Arity -> DataCon
tupleTyCon :: Boxity -> Arity -> TyCon
cTupleDataCon :: Arity -> DataCon
cTupleDataConName :: Arity -> Name
cTupleTyConName :: Arity -> Name
cTupleSelIdName :: ConTag -> Arity -> Name
sumDataCon :: ConTag -> Arity -> DataCon
sumTyCon :: Arity -> TyCon
This diff is collapsed.