diff options
author | Ian Lynagh <ian@well-typed.com> | 2012-08-21 17:44:38 +0100 |
---|---|---|
committer | Ian Lynagh <ian@well-typed.com> | 2012-08-21 17:44:38 +0100 |
commit | 75700644a7430612b40ba94476a5749594010671 (patch) | |
tree | 4f1717e39ef576a35cbd65706582067b56d14487 /compiler/codeGen/CodeGen | |
parent | 07295e96981b29cc6fb88b334d8ebd4b1b807516 (diff) | |
download | haskell-75700644a7430612b40ba94476a5749594010671.tar.gz |
Move activeStgRegs into CodeGen.Platform
Diffstat (limited to 'compiler/codeGen/CodeGen')
-rw-r--r-- | compiler/codeGen/CodeGen/Platform.hs (renamed from compiler/codeGen/CodeGen/CallerSaves.hs) | 22 | ||||
-rw-r--r-- | compiler/codeGen/CodeGen/Platform/ARM.hs | 4 | ||||
-rw-r--r-- | compiler/codeGen/CodeGen/Platform/NoRegs.hs | 4 | ||||
-rw-r--r-- | compiler/codeGen/CodeGen/Platform/PPC.hs | 4 | ||||
-rw-r--r-- | compiler/codeGen/CodeGen/Platform/PPC_Darwin.hs | 4 | ||||
-rw-r--r-- | compiler/codeGen/CodeGen/Platform/SPARC.hs | 4 | ||||
-rw-r--r-- | compiler/codeGen/CodeGen/Platform/X86.hs | 4 | ||||
-rw-r--r-- | compiler/codeGen/CodeGen/Platform/X86_64.hs | 4 |
8 files changed, 35 insertions, 15 deletions
diff --git a/compiler/codeGen/CodeGen/CallerSaves.hs b/compiler/codeGen/CodeGen/Platform.hs index b6c709df8c..66e8f85aff 100644 --- a/compiler/codeGen/CodeGen/CallerSaves.hs +++ b/compiler/codeGen/CodeGen/Platform.hs @@ -1,5 +1,5 @@ -module CodeGen.CallerSaves (callerSaves) where +module CodeGen.Platform (callerSaves, activeStgRegs) where import CmmExpr import Platform @@ -30,3 +30,23 @@ callerSaves platform | 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 + = case platformArch platform of + ArchX86 -> X86.activeStgRegs + ArchX86_64 -> X86_64.activeStgRegs + ArchSPARC -> SPARC.activeStgRegs + ArchARM {} -> ARM.activeStgRegs + arch + | arch `elem` [ArchPPC, ArchPPC_64] -> + case platformOS platform of + OSDarwin -> PPC_Darwin.activeStgRegs + _ -> PPC.activeStgRegs + + | otherwise -> NoRegs.activeStgRegs + diff --git a/compiler/codeGen/CodeGen/Platform/ARM.hs b/compiler/codeGen/CodeGen/Platform/ARM.hs index 0116139313..cad3eb7f50 100644 --- a/compiler/codeGen/CodeGen/Platform/ARM.hs +++ b/compiler/codeGen/CodeGen/Platform/ARM.hs @@ -1,9 +1,9 @@ -module CodeGen.Platform.ARM (callerSaves) where +module CodeGen.Platform.ARM where import CmmExpr #define MACHREGS_NO_REGS 0 #define MACHREGS_arm 1 -#include "../../../../includes/CallerSaves.part.hs" +#include "../../../../includes/CodeGen.Platform.hs" diff --git a/compiler/codeGen/CodeGen/Platform/NoRegs.hs b/compiler/codeGen/CodeGen/Platform/NoRegs.hs index ff39dd90ae..6d7c3342d0 100644 --- a/compiler/codeGen/CodeGen/Platform/NoRegs.hs +++ b/compiler/codeGen/CodeGen/Platform/NoRegs.hs @@ -1,8 +1,8 @@ -module CodeGen.Platform.NoRegs (callerSaves) where +module CodeGen.Platform.NoRegs where import CmmExpr #define MACHREGS_NO_REGS 1 -#include "../../../../includes/CallerSaves.part.hs" +#include "../../../../includes/CodeGen.Platform.hs" diff --git a/compiler/codeGen/CodeGen/Platform/PPC.hs b/compiler/codeGen/CodeGen/Platform/PPC.hs index c4c975a58f..19d0609ae2 100644 --- a/compiler/codeGen/CodeGen/Platform/PPC.hs +++ b/compiler/codeGen/CodeGen/Platform/PPC.hs @@ -1,9 +1,9 @@ -module CodeGen.Platform.PPC (callerSaves) where +module CodeGen.Platform.PPC where import CmmExpr #define MACHREGS_NO_REGS 0 #define MACHREGS_powerpc 1 -#include "../../../../includes/CallerSaves.part.hs" +#include "../../../../includes/CodeGen.Platform.hs" diff --git a/compiler/codeGen/CodeGen/Platform/PPC_Darwin.hs b/compiler/codeGen/CodeGen/Platform/PPC_Darwin.hs index a0cbe7e433..a53ee06cc2 100644 --- a/compiler/codeGen/CodeGen/Platform/PPC_Darwin.hs +++ b/compiler/codeGen/CodeGen/Platform/PPC_Darwin.hs @@ -1,10 +1,10 @@ -module CodeGen.Platform.PPC_Darwin (callerSaves) where +module CodeGen.Platform.PPC_Darwin where import CmmExpr #define MACHREGS_NO_REGS 0 #define MACHREGS_powerpc 1 #define MACHREGS_darwin 1 -#include "../../../../includes/CallerSaves.part.hs" +#include "../../../../includes/CodeGen.Platform.hs" diff --git a/compiler/codeGen/CodeGen/Platform/SPARC.hs b/compiler/codeGen/CodeGen/Platform/SPARC.hs index 86b949469e..391d6c8086 100644 --- a/compiler/codeGen/CodeGen/Platform/SPARC.hs +++ b/compiler/codeGen/CodeGen/Platform/SPARC.hs @@ -1,9 +1,9 @@ -module CodeGen.Platform.SPARC (callerSaves) where +module CodeGen.Platform.SPARC where import CmmExpr #define MACHREGS_NO_REGS 0 #define MACHREGS_sparc 1 -#include "../../../../includes/CallerSaves.part.hs" +#include "../../../../includes/CodeGen.Platform.hs" diff --git a/compiler/codeGen/CodeGen/Platform/X86.hs b/compiler/codeGen/CodeGen/Platform/X86.hs index c19bf9dcfb..c5ea94f68c 100644 --- a/compiler/codeGen/CodeGen/Platform/X86.hs +++ b/compiler/codeGen/CodeGen/Platform/X86.hs @@ -1,9 +1,9 @@ -module CodeGen.Platform.X86 (callerSaves) where +module CodeGen.Platform.X86 where import CmmExpr #define MACHREGS_NO_REGS 0 #define MACHREGS_i386 1 -#include "../../../../includes/CallerSaves.part.hs" +#include "../../../../includes/CodeGen.Platform.hs" diff --git a/compiler/codeGen/CodeGen/Platform/X86_64.hs b/compiler/codeGen/CodeGen/Platform/X86_64.hs index 59cf788e43..c5aa0808b6 100644 --- a/compiler/codeGen/CodeGen/Platform/X86_64.hs +++ b/compiler/codeGen/CodeGen/Platform/X86_64.hs @@ -1,9 +1,9 @@ -module CodeGen.Platform.X86_64 (callerSaves) where +module CodeGen.Platform.X86_64 where import CmmExpr #define MACHREGS_NO_REGS 0 #define MACHREGS_x86_64 1 -#include "../../../../includes/CallerSaves.part.hs" +#include "../../../../includes/CodeGen.Platform.hs" |