diff options
author | Ian Lynagh <ian@well-typed.com> | 2012-08-28 20:52:44 +0100 |
---|---|---|
committer | Ian Lynagh <ian@well-typed.com> | 2012-08-28 20:52:44 +0100 |
commit | c0907ed27351e4160c0c8b2a5c9877899d87aae9 (patch) | |
tree | ae34750faa31e4c334ef9e3a5556093d30c11dea /compiler/codeGen/CodeGen/Platform.hs | |
parent | 0e7d2906e706acdd716f121abb19c433986ae830 (diff) | |
download | haskell-c0907ed27351e4160c0c8b2a5c9877899d87aae9.tar.gz |
Move more code into codeGen/CodeGen/Platform.hs
HaskellMachRegs.h is no longer included in anything under compiler/
Also, includes/CodeGen.Platform.hs now includes "stg/MachRegs.h"
rather than <stg/MachRegs.h> which means that we always get the file
from the tree, rather than from the bootstrapping compiler.
Diffstat (limited to 'compiler/codeGen/CodeGen/Platform.hs')
-rw-r--r-- | compiler/codeGen/CodeGen/Platform.hs | 40 |
1 files changed, 39 insertions, 1 deletions
diff --git a/compiler/codeGen/CodeGen/Platform.hs b/compiler/codeGen/CodeGen/Platform.hs index 78fba978ec..ca3bafb8de 100644 --- a/compiler/codeGen/CodeGen/Platform.hs +++ b/compiler/codeGen/CodeGen/Platform.hs @@ -1,8 +1,12 @@ -module CodeGen.Platform (callerSaves, activeStgRegs, haveRegBase) where +module CodeGen.Platform + (callerSaves, activeStgRegs, haveRegBase, globalRegMaybe, freeReg) + where import CmmExpr +import FastBool import Platform +import Reg import qualified CodeGen.Platform.ARM as ARM import qualified CodeGen.Platform.PPC as PPC @@ -71,3 +75,37 @@ haveRegBase platform | 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 + arch + | arch `elem` [ArchPPC, ArchPPC_64] -> + case platformOS platform of + OSDarwin -> PPC_Darwin.globalRegMaybe + _ -> PPC.globalRegMaybe + + | otherwise -> NoRegs.globalRegMaybe + +freeReg :: Platform -> RegNo -> FastBool +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 + arch + | arch `elem` [ArchPPC, ArchPPC_64] -> + case platformOS platform of + OSDarwin -> PPC_Darwin.freeReg + _ -> PPC.freeReg + + | otherwise -> NoRegs.freeReg + |