From ea138284b7343bb1810cfbd0284a608dc57f7d46 Mon Sep 17 00:00:00 2001 From: ken Date: Sat, 4 Aug 2001 06:19:55 +0000 Subject: [PATCH] [project @ 2001-08-04 06:19:54 by ken] NB: This commit renames some files. In each of your build directories, you will need to: rm -f ghc/compiler/prelude/primops.txt rm -f ghc/compiler/prelude/primops.i rm -f ghc/lib/std/PrelGHC.hi-boot lndir ../fptools # or wherever your CVS working directory is The change: Run PrelGHC.hi-boot through the preprocesor, as we already do primops.txt. This commit introduces a new prefix, ".pp", which means "run through preprocesor". In a previous commit, I changed ghc/compiler/Makefile to preprocess primops.txt into primops.i. That is gone now. We now preprocess primops.txt.pp (a file in the CVS repository) into primops.txt (a platform-dependent file, created at build time). We also preprocess PrelGHC.hi-boot.pp (a file in the CVS repository) into PrelGHC.hi-boot (a platform-dependent file, created at build time). The reason for using the preprocessor is because fewer primops are defined if SUPPORT_LONG_LONGS is undefined. SUPPORT_LONG_LONGS is undefined on 64-bit architectures such as the Alpha. --- ghc/compiler/Makefile | 29 +++++++-------- .../prelude/{primops.txt => primops.txt.pp} | 6 ++-- ghc/lib/std/Makefile | 4 +-- .../std/{PrelGHC.hi-boot => PrelGHC.hi-boot.pp} | 37 ++++++++++++++++++-- ghc/utils/genprimopcode/Main.hs | 4 +-- mk/suffix.mk | 7 ++++ 6 files changed, 62 insertions(+), 25 deletions(-) rename ghc/compiler/prelude/{primops.txt => primops.txt.pp} (99%) rename ghc/lib/std/{PrelGHC.hi-boot => PrelGHC.hi-boot.pp} (92%) diff --git a/ghc/compiler/Makefile b/ghc/compiler/Makefile index a8e1a83..054a97a 100644 --- a/ghc/compiler/Makefile +++ b/ghc/compiler/Makefile @@ -1,5 +1,5 @@ # ----------------------------------------------------------------------------- -# $Id: Makefile,v 1.180 2001/08/02 05:15:33 qrczak Exp $ +# $Id: Makefile,v 1.181 2001/08/04 06:19:54 ken Exp $ TOP = .. include $(TOP)/mk/boilerplate.mk @@ -309,10 +309,7 @@ SRC_C_OPTS += -O -I. -IcodeGen # Generate supporting stuff for prelude/PrimOp.lhs # from prelude/primops.txt -# Run prelude/primops.txt through the preprocessor, to weed out -# primitives that don't (need to) exist on 64-bit architectures. -prelude/primops.i: prelude/primops.txt - $(CPP) -I$(GHC_INCLUDE_DIR) -x c $< 2>/dev/null | $(SED) -e '/^#/d' > $@ +CLEAN_FILES += prelude/primops.txt GENPOC=$(TOP)/utils/genprimopcode/genprimopcode @@ -336,27 +333,27 @@ ifneq "$(BootingFromHc)" "YES" depend :: $(PRIMOP_BITS) endif -primop-data-decl.hs-incl: prelude/primops.i +primop-data-decl.hs-incl: prelude/primops.txt $(GENPOC) --data-decl < $< > $@ -primop-tag.hs-incl: prelude/primops.i +primop-tag.hs-incl: prelude/primops.txt $(GENPOC) --primop-tag < $< > $@ -primop-list.hs-incl: prelude/primops.i +primop-list.hs-incl: prelude/primops.txt $(GENPOC) --primop-list < $< > $@ -primop-has-side-effects.hs-incl: prelude/primops.i +primop-has-side-effects.hs-incl: prelude/primops.txt $(GENPOC) --has-side-effects < $< > $@ -primop-out-of-line.hs-incl: prelude/primops.i +primop-out-of-line.hs-incl: prelude/primops.txt $(GENPOC) --out-of-line < $< > $@ -primop-commutable.hs-incl: prelude/primops.i +primop-commutable.hs-incl: prelude/primops.txt $(GENPOC) --commutable < $< > $@ -primop-needs-wrapper.hs-incl: prelude/primops.i +primop-needs-wrapper.hs-incl: prelude/primops.txt $(GENPOC) --needs-wrapper < $< > $@ -primop-can-fail.hs-incl: prelude/primops.i +primop-can-fail.hs-incl: prelude/primops.txt $(GENPOC) --can-fail < $< > $@ -primop-strictness.hs-incl: prelude/primops.i +primop-strictness.hs-incl: prelude/primops.txt $(GENPOC) --strictness < $< > $@ -primop-usage.hs-incl: prelude/primops.i +primop-usage.hs-incl: prelude/primops.txt $(GENPOC) --usage < $< > $@ -primop-primop-info.hs-incl: prelude/primops.i +primop-primop-info.hs-incl: prelude/primops.txt $(GENPOC) --primop-primop-info < $< > $@ diff --git a/ghc/compiler/prelude/primops.txt b/ghc/compiler/prelude/primops.txt.pp similarity index 99% rename from ghc/compiler/prelude/primops.txt rename to ghc/compiler/prelude/primops.txt.pp index 1ec7e39..4440d75 100644 --- a/ghc/compiler/prelude/primops.txt +++ b/ghc/compiler/prelude/primops.txt.pp @@ -1,5 +1,5 @@ ----------------------------------------------------------------------- --- $Id: primops.txt,v 1.23 2001/07/26 03:08:38 ken Exp $ +-- $Id: primops.txt.pp,v 1.1 2001/08/04 06:19:54 ken Exp $ -- -- Primitive Operations -- @@ -7,12 +7,12 @@ -- To add a new primop, you currently need to update the following files: -- --- - this file (ghc/compiler/prelude/primops.txt), which includes +-- - this file (ghc/compiler/prelude/primops.txt.pp), which includes -- the type of the primop, and various other properties (its -- strictness attributes, whether it is defined as a macro -- or as out-of-line code, etc.) -- --- - ghc/lib/std/PrelGHC.hi-boot, to declare the primop +-- - ghc/lib/std/PrelGHC.hi-boot.pp, to declare the primop -- -- - if the primop is inline (i.e. a macro), then: -- ghc/includes/PrimOps.h diff --git a/ghc/lib/std/Makefile b/ghc/lib/std/Makefile index e922063..3086179 100644 --- a/ghc/lib/std/Makefile +++ b/ghc/lib/std/Makefile @@ -72,7 +72,7 @@ SRC_MKDEPENDHS_OPTS += -I$(GHC_INCLUDE_DIR) #----------------------------------------------------------------------------- # Rules -PrelPrimopWrappers.hs: ../../compiler/prelude/primops.i +PrelPrimopWrappers.hs: ../../compiler/prelude/primops.txt rm -f $@ ../../utils/genprimopcode/genprimopcode --make-haskell-wrappers < $< > $@ @@ -95,7 +95,7 @@ HS_SRCS := $(filter-out PrelMain.lhs, $(HS_SRCS)) all :: PrelMain.dll_o endif -CLEAN_FILES += PrelGHC.hi $(foreach way, $(WAYS), PrelGHC.$(way)_hi) +CLEAN_FILES += PrelGHC.hi-boot PrelGHC.hi $(foreach way, $(WAYS), PrelGHC.$(way)_hi) #----------------------------------------------------------------------------- diff --git a/ghc/lib/std/PrelGHC.hi-boot b/ghc/lib/std/PrelGHC.hi-boot.pp similarity index 92% rename from ghc/lib/std/PrelGHC.hi-boot rename to ghc/lib/std/PrelGHC.hi-boot.pp index ace6e25..c577efd 100644 --- a/ghc/lib/std/PrelGHC.hi-boot +++ b/ghc/lib/std/PrelGHC.hi-boot.pp @@ -5,6 +5,9 @@ -- primitive operations and types that GHC knows about. --------------------------------------------------------------------------- +#include "config.h" +#include "Derived.h" + __interface "std" PrelGHC 1 0 where __export PrelGHC @@ -210,10 +213,12 @@ __export PrelGHC integer2Wordzh int2Integerzh word2Integerzh +#ifdef SUPPORT_LONG_LONGS integerToInt64zh integerToWord64zh int64ToIntegerzh word64ToIntegerzh +#endif andIntegerzh orIntegerzh xorIntegerzh @@ -242,11 +247,15 @@ __export PrelGHC indexInt8Arrayzh indexInt16Arrayzh indexInt32Arrayzh +#ifdef SUPPORT_LONG_LONGS indexInt64Arrayzh +#endif indexWord8Arrayzh indexWord16Arrayzh indexWord32Arrayzh +#ifdef SUPPORT_LONG_LONGS indexWord64Arrayzh +#endif readArrayzh readCharArrayzh @@ -260,11 +269,15 @@ __export PrelGHC readInt8Arrayzh readInt16Arrayzh readInt32Arrayzh +#ifdef SUPPORT_LONG_LONGS readInt64Arrayzh +#endif readWord8Arrayzh readWord16Arrayzh readWord32Arrayzh +#ifdef SUPPORT_LONG_LONGS readWord64Arrayzh +#endif writeArrayzh writeCharArrayzh @@ -278,11 +291,15 @@ __export PrelGHC writeInt8Arrayzh writeInt16Arrayzh writeInt32Arrayzh +#ifdef SUPPORT_LONG_LONGS writeInt64Arrayzh +#endif writeWord8Arrayzh writeWord16Arrayzh writeWord32Arrayzh +#ifdef SUPPORT_LONG_LONGS writeWord64Arrayzh +#endif indexCharOffAddrzh indexWideCharOffAddrzh @@ -295,11 +312,15 @@ __export PrelGHC indexInt8OffAddrzh indexInt16OffAddrzh indexInt32OffAddrzh +#ifdef SUPPORT_LONG_LONGS indexInt64OffAddrzh +#endif indexWord8OffAddrzh indexWord16OffAddrzh indexWord32OffAddrzh +#ifdef SUPPORT_LONG_LONGS indexWord64OffAddrzh +#endif readCharOffAddrzh readWideCharOffAddrzh @@ -312,11 +333,15 @@ __export PrelGHC readInt8OffAddrzh readInt16OffAddrzh readInt32OffAddrzh +#ifdef SUPPORT_LONG_LONGS readInt64OffAddrzh +#endif readWord8OffAddrzh readWord16OffAddrzh readWord32OffAddrzh +#ifdef SUPPORT_LONG_LONGS readWord64OffAddrzh +#endif writeCharOffAddrzh writeWideCharOffAddrzh @@ -330,11 +355,15 @@ __export PrelGHC writeInt8OffAddrzh writeInt16OffAddrzh writeInt32OffAddrzh +#ifdef SUPPORT_LONG_LONGS writeInt64OffAddrzh +#endif writeWord8OffAddrzh writeWord16OffAddrzh writeWord32OffAddrzh +#ifdef SUPPORT_LONG_LONGS writeWord64OffAddrzh +#endif eqForeignObjzh indexCharOffForeignObjzh @@ -348,11 +377,15 @@ __export PrelGHC indexInt8OffForeignObjzh indexInt16OffForeignObjzh indexInt32OffForeignObjzh +#ifdef SUPPORT_LONG_LONGS indexInt64OffForeignObjzh +#endif indexWord8OffForeignObjzh indexWord16OffForeignObjzh indexWord32OffForeignObjzh +#ifdef SUPPORT_LONG_LONGS indexWord64OffForeignObjzh +#endif unsafeFreezzeArrayzh -- Note zz in the middle unsafeFreezzeByteArrayzh -- Ditto @@ -402,7 +435,7 @@ __export PrelGHC addrToHValuezh ; --- Export PrelErr.error, so that others don't have to import PrelErr +-- Export PrelErr.error, so that others do not have to import PrelErr __export PrelErr error ; @@ -426,7 +459,7 @@ instance __forall s => {CCallable (StablePtrzh s)} = zdfCCallableStablePtrzh; 1 assert :: __forall a => PrelBase.Bool -> a -> a ; --- These guys don't really exist: +-- These guys do not really exist: -- 1 zdfCCallableCharzh :: {CCallable Charzh} ; 1 zdfCCallableDoublezh :: {CCallable Doublezh} ; diff --git a/ghc/utils/genprimopcode/Main.hs b/ghc/utils/genprimopcode/Main.hs index fa50d05..5100abf 100644 --- a/ghc/utils/genprimopcode/Main.hs +++ b/ghc/utils/genprimopcode/Main.hs @@ -14,7 +14,7 @@ import Maybe ( catMaybes ) main = getArgs >>= \args -> if length args /= 1 || head args `notElem` known_args - then error ("usage: genprimopcode command < primops.i > ...\n" + then error ("usage: genprimopcode command < primops.txt > ...\n" ++ " where command is one of\n" ++ unlines (map (" "++) known_args) ) @@ -302,7 +302,7 @@ arity = length . fst . flatTys -- Abstract syntax ----------------------------------------------- ------------------------------------------------------------------ --- info for all primops; the totality of the info in primops.txt +-- info for all primops; the totality of the info in primops.txt(.pp) data Info = Info [Option] [PrimOpSpec] -- defaults, primops deriving Show diff --git a/mk/suffix.mk b/mk/suffix.mk index cdc22c6..8ec5acb 100644 --- a/mk/suffix.mk +++ b/mk/suffix.mk @@ -271,3 +271,10 @@ endif %.$(way_)o : %.$(way_)rc @$(RM) $@ windres $< $@ + +#----------------------------------------------------------------------------- +# Preprocessor suffix rule + +% : %.pp + rm -f $@ + $(CPP) -I$(GHC_INCLUDE_DIR) -x c $< | $(SED) -e '/^#/d' > $@ -- 1.7.10.4