summaryrefslogtreecommitdiff
path: root/compiler/codeGen/CodeGen
diff options
context:
space:
mode:
authorSylvain Henry <sylvain@haskus.fr>2019-08-13 17:26:32 +0200
committerSylvain Henry <sylvain@haskus.fr>2019-09-10 00:04:50 +0200
commit447864a94a1679b5b079e08bb7208a0005381cef (patch)
treebaa469c52620ce7ae02def3e5e6a6f109cc89f40 /compiler/codeGen/CodeGen
parent270fbe8512f04b6107755fa22bdec62205c0a567 (diff)
downloadhaskell-447864a94a1679b5b079e08bb7208a0005381cef.tar.gz
Module hierarchy: StgToCmm (#13009)
Add StgToCmm module hierarchy. Platform modules that are used in several other places (NCG, LLVM codegen, Cmm transformations) are put into GHC.Platform.
Diffstat (limited to 'compiler/codeGen/CodeGen')
-rw-r--r--compiler/codeGen/CodeGen/Platform.hs107
-rw-r--r--compiler/codeGen/CodeGen/Platform/ARM.hs10
-rw-r--r--compiler/codeGen/CodeGen/Platform/ARM64.hs10
-rw-r--r--compiler/codeGen/CodeGen/Platform/NoRegs.hs9
-rw-r--r--compiler/codeGen/CodeGen/Platform/PPC.hs10
-rw-r--r--compiler/codeGen/CodeGen/Platform/SPARC.hs10
-rw-r--r--compiler/codeGen/CodeGen/Platform/X86.hs10
-rw-r--r--compiler/codeGen/CodeGen/Platform/X86_64.hs10
8 files changed, 0 insertions, 176 deletions
diff --git a/compiler/codeGen/CodeGen/Platform.hs b/compiler/codeGen/CodeGen/Platform.hs
deleted file mode 100644
index bc216758a0..0000000000
--- a/compiler/codeGen/CodeGen/Platform.hs
+++ /dev/null
@@ -1,107 +0,0 @@
-
-module CodeGen.Platform
- (callerSaves, activeStgRegs, haveRegBase, globalRegMaybe, freeReg)
- where
-
-import GhcPrelude
-
-import CmmExpr
-import GHC.Platform
-import Reg
-
-import qualified CodeGen.Platform.ARM as ARM
-import qualified CodeGen.Platform.ARM64 as ARM64
-import qualified CodeGen.Platform.PPC as PPC
-import qualified CodeGen.Platform.SPARC as SPARC
-import qualified CodeGen.Platform.X86 as X86
-import qualified CodeGen.Platform.X86_64 as X86_64
-import qualified CodeGen.Platform.NoRegs as NoRegs
-
--- | Returns 'True' if this global register is stored in a caller-saves
--- machine register.
-
-callerSaves :: Platform -> GlobalReg -> Bool
-callerSaves platform
- | platformUnregisterised platform = NoRegs.callerSaves
- | otherwise
- = case platformArch platform of
- ArchX86 -> X86.callerSaves
- ArchX86_64 -> X86_64.callerSaves
- ArchSPARC -> SPARC.callerSaves
- ArchARM {} -> ARM.callerSaves
- ArchARM64 -> ARM64.callerSaves
- arch
- | arch `elem` [ArchPPC, ArchPPC_64 ELF_V1, ArchPPC_64 ELF_V2] ->
- PPC.callerSaves
-
- | otherwise -> NoRegs.callerSaves
-
--- | Here is where the STG register map is defined for each target arch.
--- The order matters (for the llvm backend anyway)! We must make sure to
--- maintain the order here with the order used in the LLVM calling conventions.
--- Note that also, this isn't all registers, just the ones that are currently
--- possbily mapped to real registers.
-activeStgRegs :: Platform -> [GlobalReg]
-activeStgRegs platform
- | platformUnregisterised platform = NoRegs.activeStgRegs
- | otherwise
- = case platformArch platform of
- ArchX86 -> X86.activeStgRegs
- ArchX86_64 -> X86_64.activeStgRegs
- ArchSPARC -> SPARC.activeStgRegs
- ArchARM {} -> ARM.activeStgRegs
- ArchARM64 -> ARM64.activeStgRegs
- arch
- | arch `elem` [ArchPPC, ArchPPC_64 ELF_V1, ArchPPC_64 ELF_V2] ->
- PPC.activeStgRegs
-
- | otherwise -> NoRegs.activeStgRegs
-
-haveRegBase :: Platform -> Bool
-haveRegBase platform
- | platformUnregisterised platform = NoRegs.haveRegBase
- | otherwise
- = case platformArch platform of
- ArchX86 -> X86.haveRegBase
- ArchX86_64 -> X86_64.haveRegBase
- ArchSPARC -> SPARC.haveRegBase
- ArchARM {} -> ARM.haveRegBase
- ArchARM64 -> ARM64.haveRegBase
- arch
- | arch `elem` [ArchPPC, ArchPPC_64 ELF_V1, ArchPPC_64 ELF_V2] ->
- PPC.haveRegBase
-
- | otherwise -> NoRegs.haveRegBase
-
-globalRegMaybe :: Platform -> GlobalReg -> Maybe RealReg
-globalRegMaybe platform
- | platformUnregisterised platform = NoRegs.globalRegMaybe
- | otherwise
- = case platformArch platform of
- ArchX86 -> X86.globalRegMaybe
- ArchX86_64 -> X86_64.globalRegMaybe
- ArchSPARC -> SPARC.globalRegMaybe
- ArchARM {} -> ARM.globalRegMaybe
- ArchARM64 -> ARM64.globalRegMaybe
- arch
- | arch `elem` [ArchPPC, ArchPPC_64 ELF_V1, ArchPPC_64 ELF_V2] ->
- PPC.globalRegMaybe
-
- | otherwise -> NoRegs.globalRegMaybe
-
-freeReg :: Platform -> RegNo -> Bool
-freeReg platform
- | platformUnregisterised platform = NoRegs.freeReg
- | otherwise
- = case platformArch platform of
- ArchX86 -> X86.freeReg
- ArchX86_64 -> X86_64.freeReg
- ArchSPARC -> SPARC.freeReg
- ArchARM {} -> ARM.freeReg
- ArchARM64 -> ARM64.freeReg
- arch
- | arch `elem` [ArchPPC, ArchPPC_64 ELF_V1, ArchPPC_64 ELF_V2] ->
- PPC.freeReg
-
- | otherwise -> NoRegs.freeReg
-
diff --git a/compiler/codeGen/CodeGen/Platform/ARM.hs b/compiler/codeGen/CodeGen/Platform/ARM.hs
deleted file mode 100644
index a2cb476e04..0000000000
--- a/compiler/codeGen/CodeGen/Platform/ARM.hs
+++ /dev/null
@@ -1,10 +0,0 @@
-{-# LANGUAGE CPP #-}
-
-module CodeGen.Platform.ARM where
-
-import GhcPrelude
-
-#define MACHREGS_NO_REGS 0
-#define MACHREGS_arm 1
-#include "../../../../includes/CodeGen.Platform.hs"
-
diff --git a/compiler/codeGen/CodeGen/Platform/ARM64.hs b/compiler/codeGen/CodeGen/Platform/ARM64.hs
deleted file mode 100644
index 6ace181356..0000000000
--- a/compiler/codeGen/CodeGen/Platform/ARM64.hs
+++ /dev/null
@@ -1,10 +0,0 @@
-{-# LANGUAGE CPP #-}
-
-module CodeGen.Platform.ARM64 where
-
-import GhcPrelude
-
-#define MACHREGS_NO_REGS 0
-#define MACHREGS_aarch64 1
-#include "../../../../includes/CodeGen.Platform.hs"
-
diff --git a/compiler/codeGen/CodeGen/Platform/NoRegs.hs b/compiler/codeGen/CodeGen/Platform/NoRegs.hs
deleted file mode 100644
index 4c074ee313..0000000000
--- a/compiler/codeGen/CodeGen/Platform/NoRegs.hs
+++ /dev/null
@@ -1,9 +0,0 @@
-{-# LANGUAGE CPP #-}
-
-module CodeGen.Platform.NoRegs where
-
-import GhcPrelude
-
-#define MACHREGS_NO_REGS 1
-#include "../../../../includes/CodeGen.Platform.hs"
-
diff --git a/compiler/codeGen/CodeGen/Platform/PPC.hs b/compiler/codeGen/CodeGen/Platform/PPC.hs
deleted file mode 100644
index f7eae6b4ca..0000000000
--- a/compiler/codeGen/CodeGen/Platform/PPC.hs
+++ /dev/null
@@ -1,10 +0,0 @@
-{-# LANGUAGE CPP #-}
-
-module CodeGen.Platform.PPC where
-
-import GhcPrelude
-
-#define MACHREGS_NO_REGS 0
-#define MACHREGS_powerpc 1
-#include "../../../../includes/CodeGen.Platform.hs"
-
diff --git a/compiler/codeGen/CodeGen/Platform/SPARC.hs b/compiler/codeGen/CodeGen/Platform/SPARC.hs
deleted file mode 100644
index 5d8dbb1da9..0000000000
--- a/compiler/codeGen/CodeGen/Platform/SPARC.hs
+++ /dev/null
@@ -1,10 +0,0 @@
-{-# LANGUAGE CPP #-}
-
-module CodeGen.Platform.SPARC where
-
-import GhcPrelude
-
-#define MACHREGS_NO_REGS 0
-#define MACHREGS_sparc 1
-#include "../../../../includes/CodeGen.Platform.hs"
-
diff --git a/compiler/codeGen/CodeGen/Platform/X86.hs b/compiler/codeGen/CodeGen/Platform/X86.hs
deleted file mode 100644
index 84d52c1585..0000000000
--- a/compiler/codeGen/CodeGen/Platform/X86.hs
+++ /dev/null
@@ -1,10 +0,0 @@
-{-# LANGUAGE CPP #-}
-
-module CodeGen.Platform.X86 where
-
-import GhcPrelude
-
-#define MACHREGS_NO_REGS 0
-#define MACHREGS_i386 1
-#include "../../../../includes/CodeGen.Platform.hs"
-
diff --git a/compiler/codeGen/CodeGen/Platform/X86_64.hs b/compiler/codeGen/CodeGen/Platform/X86_64.hs
deleted file mode 100644
index 1b2b5549ac..0000000000
--- a/compiler/codeGen/CodeGen/Platform/X86_64.hs
+++ /dev/null
@@ -1,10 +0,0 @@
-{-# LANGUAGE CPP #-}
-
-module CodeGen.Platform.X86_64 where
-
-import GhcPrelude
-
-#define MACHREGS_NO_REGS 0
-#define MACHREGS_x86_64 1
-#include "../../../../includes/CodeGen.Platform.hs"
-