[project @ 2001-08-04 06:19:54 by ken]
authorken <unknown>
Sat, 4 Aug 2001 06:19:55 +0000 (06:19 +0000)
committerken <unknown>
Sat, 4 Aug 2001 06:19:55 +0000 (06:19 +0000)
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
ghc/compiler/prelude/primops.txt.pp [moved from ghc/compiler/prelude/primops.txt with 99% similarity]
ghc/lib/std/Makefile
ghc/lib/std/PrelGHC.hi-boot.pp [moved from ghc/lib/std/PrelGHC.hi-boot with 92% similarity]
ghc/utils/genprimopcode/Main.hs
mk/suffix.mk

index a8e1a83..054a97a 100644 (file)
@@ -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
 
 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
 
 #              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
 
 
 GENPOC=$(TOP)/utils/genprimopcode/genprimopcode
 
@@ -336,27 +333,27 @@ ifneq "$(BootingFromHc)" "YES"
 depend :: $(PRIMOP_BITS)
 endif
 
 depend :: $(PRIMOP_BITS)
 endif
 
-primop-data-decl.hs-incl: prelude/primops.i
+primop-data-decl.hs-incl: prelude/primops.txt
        $(GENPOC) --data-decl          < $< > $@
        $(GENPOC) --data-decl          < $< > $@
-primop-tag.hs-incl: prelude/primops.i
+primop-tag.hs-incl: prelude/primops.txt
        $(GENPOC) --primop-tag         < $< > $@
        $(GENPOC) --primop-tag         < $< > $@
-primop-list.hs-incl: prelude/primops.i
+primop-list.hs-incl: prelude/primops.txt
        $(GENPOC) --primop-list        < $< > $@
        $(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   < $< > $@
        $(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        < $< > $@
        $(GENPOC) --out-of-line        < $< > $@
-primop-commutable.hs-incl: prelude/primops.i
+primop-commutable.hs-incl: prelude/primops.txt
        $(GENPOC) --commutable         < $< > $@
        $(GENPOC) --commutable         < $< > $@
-primop-needs-wrapper.hs-incl: prelude/primops.i
+primop-needs-wrapper.hs-incl: prelude/primops.txt
        $(GENPOC) --needs-wrapper      < $< > $@
        $(GENPOC) --needs-wrapper      < $< > $@
-primop-can-fail.hs-incl: prelude/primops.i
+primop-can-fail.hs-incl: prelude/primops.txt
        $(GENPOC) --can-fail           < $< > $@
        $(GENPOC) --can-fail           < $< > $@
-primop-strictness.hs-incl: prelude/primops.i
+primop-strictness.hs-incl: prelude/primops.txt
        $(GENPOC) --strictness         < $< > $@
        $(GENPOC) --strictness         < $< > $@
-primop-usage.hs-incl: prelude/primops.i
+primop-usage.hs-incl: prelude/primops.txt
        $(GENPOC) --usage              < $< > $@
        $(GENPOC) --usage              < $< > $@
-primop-primop-info.hs-incl: prelude/primops.i
+primop-primop-info.hs-incl: prelude/primops.txt
        $(GENPOC) --primop-primop-info < $< > $@
 
 
        $(GENPOC) --primop-primop-info < $< > $@
 
 
similarity index 99%
rename from ghc/compiler/prelude/primops.txt
rename to ghc/compiler/prelude/primops.txt.pp
index 1ec7e39..4440d75 100644 (file)
@@ -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
 --
 --
 -- Primitive Operations
 --
@@ -7,12 +7,12 @@
 
 -- To add a new primop, you currently need to update the following files:
 --
 
 -- 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.)
 --
 --       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
 --
 --     - if the primop is inline (i.e. a macro), then:
 --             ghc/includes/PrimOps.h
index e922063..3086179 100644 (file)
@@ -72,7 +72,7 @@ SRC_MKDEPENDHS_OPTS += -I$(GHC_INCLUDE_DIR)
 #-----------------------------------------------------------------------------
 #      Rules
 
 #-----------------------------------------------------------------------------
 #      Rules
 
-PrelPrimopWrappers.hs: ../../compiler/prelude/primops.i
+PrelPrimopWrappers.hs: ../../compiler/prelude/primops.txt
        rm -f $@
        ../../utils/genprimopcode/genprimopcode --make-haskell-wrappers < $< > $@
 
        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
 
 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)
 
 
 #-----------------------------------------------------------------------------
 
 
 #-----------------------------------------------------------------------------
similarity index 92%
rename from ghc/lib/std/PrelGHC.hi-boot
rename to ghc/lib/std/PrelGHC.hi-boot.pp
index ace6e25..c577efd 100644 (file)
@@ -5,6 +5,9 @@
 --     primitive operations and types that GHC knows about.
 ---------------------------------------------------------------------------
 
 --     primitive operations and types that GHC knows about.
 ---------------------------------------------------------------------------
 
+#include "config.h"
+#include "Derived.h"
+
 __interface "std" PrelGHC 1 0 where
 
 __export PrelGHC
 __interface "std" PrelGHC 1 0 where
 
 __export PrelGHC
@@ -210,10 +213,12 @@ __export PrelGHC
   integer2Wordzh
   int2Integerzh
   word2Integerzh
   integer2Wordzh
   int2Integerzh
   word2Integerzh
+#ifdef SUPPORT_LONG_LONGS
   integerToInt64zh
   integerToWord64zh
   int64ToIntegerzh
   word64ToIntegerzh
   integerToInt64zh
   integerToWord64zh
   int64ToIntegerzh
   word64ToIntegerzh
+#endif
   andIntegerzh
   orIntegerzh
   xorIntegerzh
   andIntegerzh
   orIntegerzh
   xorIntegerzh
@@ -242,11 +247,15 @@ __export PrelGHC
   indexInt8Arrayzh
   indexInt16Arrayzh
   indexInt32Arrayzh
   indexInt8Arrayzh
   indexInt16Arrayzh
   indexInt32Arrayzh
+#ifdef SUPPORT_LONG_LONGS
   indexInt64Arrayzh
   indexInt64Arrayzh
+#endif
   indexWord8Arrayzh
   indexWord16Arrayzh
   indexWord32Arrayzh
   indexWord8Arrayzh
   indexWord16Arrayzh
   indexWord32Arrayzh
+#ifdef SUPPORT_LONG_LONGS
   indexWord64Arrayzh
   indexWord64Arrayzh
+#endif
 
   readArrayzh
   readCharArrayzh
 
   readArrayzh
   readCharArrayzh
@@ -260,11 +269,15 @@ __export PrelGHC
   readInt8Arrayzh
   readInt16Arrayzh
   readInt32Arrayzh
   readInt8Arrayzh
   readInt16Arrayzh
   readInt32Arrayzh
+#ifdef SUPPORT_LONG_LONGS
   readInt64Arrayzh
   readInt64Arrayzh
+#endif
   readWord8Arrayzh
   readWord16Arrayzh
   readWord32Arrayzh
   readWord8Arrayzh
   readWord16Arrayzh
   readWord32Arrayzh
+#ifdef SUPPORT_LONG_LONGS
   readWord64Arrayzh
   readWord64Arrayzh
+#endif
 
   writeArrayzh
   writeCharArrayzh
 
   writeArrayzh
   writeCharArrayzh
@@ -278,11 +291,15 @@ __export PrelGHC
   writeInt8Arrayzh
   writeInt16Arrayzh
   writeInt32Arrayzh
   writeInt8Arrayzh
   writeInt16Arrayzh
   writeInt32Arrayzh
+#ifdef SUPPORT_LONG_LONGS
   writeInt64Arrayzh
   writeInt64Arrayzh
+#endif
   writeWord8Arrayzh
   writeWord16Arrayzh
   writeWord32Arrayzh
   writeWord8Arrayzh
   writeWord16Arrayzh
   writeWord32Arrayzh
+#ifdef SUPPORT_LONG_LONGS
   writeWord64Arrayzh
   writeWord64Arrayzh
+#endif
 
   indexCharOffAddrzh
   indexWideCharOffAddrzh
 
   indexCharOffAddrzh
   indexWideCharOffAddrzh
@@ -295,11 +312,15 @@ __export PrelGHC
   indexInt8OffAddrzh
   indexInt16OffAddrzh
   indexInt32OffAddrzh
   indexInt8OffAddrzh
   indexInt16OffAddrzh
   indexInt32OffAddrzh
+#ifdef SUPPORT_LONG_LONGS
   indexInt64OffAddrzh
   indexInt64OffAddrzh
+#endif
   indexWord8OffAddrzh
   indexWord16OffAddrzh
   indexWord32OffAddrzh
   indexWord8OffAddrzh
   indexWord16OffAddrzh
   indexWord32OffAddrzh
+#ifdef SUPPORT_LONG_LONGS
   indexWord64OffAddrzh
   indexWord64OffAddrzh
+#endif
 
   readCharOffAddrzh
   readWideCharOffAddrzh
 
   readCharOffAddrzh
   readWideCharOffAddrzh
@@ -312,11 +333,15 @@ __export PrelGHC
   readInt8OffAddrzh
   readInt16OffAddrzh
   readInt32OffAddrzh
   readInt8OffAddrzh
   readInt16OffAddrzh
   readInt32OffAddrzh
+#ifdef SUPPORT_LONG_LONGS
   readInt64OffAddrzh
   readInt64OffAddrzh
+#endif
   readWord8OffAddrzh
   readWord16OffAddrzh
   readWord32OffAddrzh
   readWord8OffAddrzh
   readWord16OffAddrzh
   readWord32OffAddrzh
+#ifdef SUPPORT_LONG_LONGS
   readWord64OffAddrzh
   readWord64OffAddrzh
+#endif
 
   writeCharOffAddrzh
   writeWideCharOffAddrzh
 
   writeCharOffAddrzh
   writeWideCharOffAddrzh
@@ -330,11 +355,15 @@ __export PrelGHC
   writeInt8OffAddrzh
   writeInt16OffAddrzh
   writeInt32OffAddrzh
   writeInt8OffAddrzh
   writeInt16OffAddrzh
   writeInt32OffAddrzh
+#ifdef SUPPORT_LONG_LONGS
   writeInt64OffAddrzh
   writeInt64OffAddrzh
+#endif
   writeWord8OffAddrzh
   writeWord16OffAddrzh
   writeWord32OffAddrzh
   writeWord8OffAddrzh
   writeWord16OffAddrzh
   writeWord32OffAddrzh
+#ifdef SUPPORT_LONG_LONGS
   writeWord64OffAddrzh
   writeWord64OffAddrzh
+#endif
 
   eqForeignObjzh
   indexCharOffForeignObjzh
 
   eqForeignObjzh
   indexCharOffForeignObjzh
@@ -348,11 +377,15 @@ __export PrelGHC
   indexInt8OffForeignObjzh
   indexInt16OffForeignObjzh
   indexInt32OffForeignObjzh
   indexInt8OffForeignObjzh
   indexInt16OffForeignObjzh
   indexInt32OffForeignObjzh
+#ifdef SUPPORT_LONG_LONGS
   indexInt64OffForeignObjzh
   indexInt64OffForeignObjzh
+#endif
   indexWord8OffForeignObjzh
   indexWord16OffForeignObjzh
   indexWord32OffForeignObjzh
   indexWord8OffForeignObjzh
   indexWord16OffForeignObjzh
   indexWord32OffForeignObjzh
+#ifdef SUPPORT_LONG_LONGS
   indexWord64OffForeignObjzh
   indexWord64OffForeignObjzh
+#endif
 
   unsafeFreezzeArrayzh         -- Note zz in the middle
   unsafeFreezzeByteArrayzh     -- Ditto
 
   unsafeFreezzeArrayzh         -- Note zz in the middle
   unsafeFreezzeByteArrayzh     -- Ditto
@@ -402,7 +435,7 @@ __export PrelGHC
   addrToHValuezh
 ;
 
   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 ;
 
 
 __export PrelErr error ;
 
 
@@ -426,7 +459,7 @@ instance __forall s => {CCallable (StablePtrzh s)} = zdfCCallableStablePtrzh;
 
 1 assert :: __forall a => PrelBase.Bool -> a -> a ;
 
 
 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} ;
 --
 1 zdfCCallableCharzh :: {CCallable Charzh} ;
 1 zdfCCallableDoublezh :: {CCallable Doublezh} ;
index fa50d05..5100abf 100644 (file)
@@ -14,7 +14,7 @@ import Maybe ( catMaybes )
 
 main = getArgs >>= \args ->
        if length args /= 1 || head args `notElem` known_args
 
 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)
                   )
                    ++ "   where command is one of\n"
                    ++ unlines (map ("            "++) known_args)
                   )
@@ -302,7 +302,7 @@ arity = length . fst . flatTys
 -- Abstract syntax -----------------------------------------------
 ------------------------------------------------------------------
 
 -- 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
 data Info
    = Info [Option] [PrimOpSpec]   -- defaults, primops
      deriving Show
index cdc22c6..8ec5acb 100644 (file)
@@ -271,3 +271,10 @@ endif
 %.$(way_)o : %.$(way_)rc
        @$(RM) $@
        windres $< $@
 %.$(way_)o : %.$(way_)rc
        @$(RM) $@
        windres $< $@
+
+#-----------------------------------------------------------------------------
+# Preprocessor suffix rule
+
+% : %.pp
+       rm -f $@
+       $(CPP) -I$(GHC_INCLUDE_DIR) -x c $< | $(SED) -e '/^#/d' > $@