summaryrefslogtreecommitdiff
path: root/utils/deriveConstants
diff options
context:
space:
mode:
authorSylvain Henry <sylvain@haskus.fr>2020-07-07 13:16:47 +0200
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-07-25 00:45:08 -0400
commit6333d7391068d8029eed3e8eff019b9e2c104c7b (patch)
treeed9c42bf6df586a976db83ff448b3efd16ef9764 /utils/deriveConstants
parent342a01af624840ba94f22256079ff4f3cee09ca2 (diff)
downloadhaskell-6333d7391068d8029eed3e8eff019b9e2c104c7b.tar.gz
Put PlatformConstants into Platform
Diffstat (limited to 'utils/deriveConstants')
-rw-r--r--utils/deriveConstants/Main.hs15
1 files changed, 9 insertions, 6 deletions
diff --git a/utils/deriveConstants/Main.hs b/utils/deriveConstants/Main.hs
index 1867d824b6..0b6247cf97 100644
--- a/utils/deriveConstants/Main.hs
+++ b/utils/deriveConstants/Main.hs
@@ -873,8 +873,10 @@ getWanted verbose os tmpdir gccProgram gccFlags nmProgram mobjdumpProgram
writeHaskellType :: FilePath -> [What Fst] -> IO ()
writeHaskellType fn ws = writeFile fn xs
where xs = unlines [header, body, footer]
- header = "data PlatformConstants = PlatformConstants {"
- footer = " } deriving Read"
+ header = "module GHC.Platform.Constants where\n\n\
+ \import Prelude\n\n\
+ \data PlatformConstants = PlatformConstants {"
+ footer = " } deriving (Show,Read,Eq)"
body = intercalate ",\n" (concatMap doWhat ws)
doWhat (GetClosureSize name _) = [" pc_" ++ name ++ " :: Int"]
@@ -909,16 +911,17 @@ writeHaskellWrappers :: FilePath -> [What Fst] -> IO ()
writeHaskellWrappers fn ws = writeFile fn xs
where xs = unlines body
body = concatMap doWhat ws
+ constants = " (platformConstants (targetPlatform dflags))"
doWhat (GetFieldType {}) = []
doWhat (GetClosureSize {}) = []
doWhat (GetWord name _) = [haskellise name ++ " :: DynFlags -> Int",
- haskellise name ++ " dflags = pc_" ++ name ++ " (platformConstants dflags)"]
+ haskellise name ++ " dflags = pc_" ++ name ++ constants]
doWhat (GetInt name _) = [haskellise name ++ " :: DynFlags -> Int",
- haskellise name ++ " dflags = pc_" ++ name ++ " (platformConstants dflags)"]
+ haskellise name ++ " dflags = pc_" ++ name ++ constants]
doWhat (GetNatural name _) = [haskellise name ++ " :: DynFlags -> Integer",
- haskellise name ++ " dflags = pc_" ++ name ++ " (platformConstants dflags)"]
+ haskellise name ++ " dflags = pc_" ++ name ++ constants]
doWhat (GetBool name _) = [haskellise name ++ " :: DynFlags -> Bool",
- haskellise name ++ " dflags = pc_" ++ name ++ " (platformConstants dflags)"]
+ haskellise name ++ " dflags = pc_" ++ name ++ constants]
doWhat (StructFieldMacro {}) = []
doWhat (ClosureFieldMacro {}) = []
doWhat (ClosurePayloadMacro {}) = []