{-# LANGUAGE CPP #-}
module GHC.CmmToAsm.Reg.Target (
targetVirtualRegSqueeze,
targetRealRegSqueeze,
targetClassOfRealReg,
targetMkVirtualReg,
targetRegDotColor,
targetClassOfReg
)
where
#include "GhclibHsVersions.h"
import GHC.Prelude
import GHC.Platform.Reg
import GHC.Platform.Reg.Class
import GHC.CmmToAsm.Format
import GHC.Utils.Outputable
import GHC.Utils.Panic
import GHC.Types.Unique
import GHC.Platform
import qualified GHC.CmmToAsm.X86.Regs as X86
import qualified GHC.CmmToAsm.X86.RegInfo as X86
import qualified GHC.CmmToAsm.PPC.Regs as PPC
import qualified GHC.CmmToAsm.SPARC.Regs as SPARC
targetVirtualRegSqueeze :: Platform -> RegClass -> VirtualReg -> Int
targetVirtualRegSqueeze :: Platform -> RegClass -> VirtualReg -> Int
targetVirtualRegSqueeze Platform
platform
= case Platform -> Arch
platformArch Platform
platform of
Arch
ArchX86 -> RegClass -> VirtualReg -> Int
X86.virtualRegSqueeze
Arch
ArchX86_64 -> RegClass -> VirtualReg -> Int
X86.virtualRegSqueeze
Arch
ArchPPC -> RegClass -> VirtualReg -> Int
PPC.virtualRegSqueeze
Arch
ArchS390X -> String -> RegClass -> VirtualReg -> Int
forall a. String -> a
panic String
"targetVirtualRegSqueeze ArchS390X"
Arch
ArchSPARC -> RegClass -> VirtualReg -> Int
SPARC.virtualRegSqueeze
Arch
ArchSPARC64 -> String -> RegClass -> VirtualReg -> Int
forall a. String -> a
panic String
"targetVirtualRegSqueeze ArchSPARC64"
ArchPPC_64 PPC_64ABI
_ -> RegClass -> VirtualReg -> Int
PPC.virtualRegSqueeze
ArchARM ArmISA
_ [ArmISAExt]
_ ArmABI
_ -> String -> RegClass -> VirtualReg -> Int
forall a. String -> a
panic String
"targetVirtualRegSqueeze ArchARM"
Arch
ArchAArch64 -> String -> RegClass -> VirtualReg -> Int
forall a. String -> a
panic String
"targetVirtualRegSqueeze ArchAArch64"
Arch
ArchAlpha -> String -> RegClass -> VirtualReg -> Int
forall a. String -> a
panic String
"targetVirtualRegSqueeze ArchAlpha"
Arch
ArchMipseb -> String -> RegClass -> VirtualReg -> Int
forall a. String -> a
panic String
"targetVirtualRegSqueeze ArchMipseb"
Arch
ArchMipsel -> String -> RegClass -> VirtualReg -> Int
forall a. String -> a
panic String
"targetVirtualRegSqueeze ArchMipsel"
Arch
ArchJavaScript-> String -> RegClass -> VirtualReg -> Int
forall a. String -> a
panic String
"targetVirtualRegSqueeze ArchJavaScript"
Arch
ArchUnknown -> String -> RegClass -> VirtualReg -> Int
forall a. String -> a
panic String
"targetVirtualRegSqueeze ArchUnknown"
targetRealRegSqueeze :: Platform -> RegClass -> RealReg -> Int
targetRealRegSqueeze :: Platform -> RegClass -> RealReg -> Int
targetRealRegSqueeze Platform
platform
= case Platform -> Arch
platformArch Platform
platform of
Arch
ArchX86 -> RegClass -> RealReg -> Int
X86.realRegSqueeze
Arch
ArchX86_64 -> RegClass -> RealReg -> Int
X86.realRegSqueeze
Arch
ArchPPC -> RegClass -> RealReg -> Int
PPC.realRegSqueeze
Arch
ArchS390X -> String -> RegClass -> RealReg -> Int
forall a. String -> a
panic String
"targetRealRegSqueeze ArchS390X"
Arch
ArchSPARC -> RegClass -> RealReg -> Int
SPARC.realRegSqueeze
Arch
ArchSPARC64 -> String -> RegClass -> RealReg -> Int
forall a. String -> a
panic String
"targetRealRegSqueeze ArchSPARC64"
ArchPPC_64 PPC_64ABI
_ -> RegClass -> RealReg -> Int
PPC.realRegSqueeze
ArchARM ArmISA
_ [ArmISAExt]
_ ArmABI
_ -> String -> RegClass -> RealReg -> Int
forall a. String -> a
panic String
"targetRealRegSqueeze ArchARM"
Arch
ArchAArch64 -> String -> RegClass -> RealReg -> Int
forall a. String -> a
panic String
"targetRealRegSqueeze ArchAArch64"
Arch
ArchAlpha -> String -> RegClass -> RealReg -> Int
forall a. String -> a
panic String
"targetRealRegSqueeze ArchAlpha"
Arch
ArchMipseb -> String -> RegClass -> RealReg -> Int
forall a. String -> a
panic String
"targetRealRegSqueeze ArchMipseb"
Arch
ArchMipsel -> String -> RegClass -> RealReg -> Int
forall a. String -> a
panic String
"targetRealRegSqueeze ArchMipsel"
Arch
ArchJavaScript-> String -> RegClass -> RealReg -> Int
forall a. String -> a
panic String
"targetRealRegSqueeze ArchJavaScript"
Arch
ArchUnknown -> String -> RegClass -> RealReg -> Int
forall a. String -> a
panic String
"targetRealRegSqueeze ArchUnknown"
targetClassOfRealReg :: Platform -> RealReg -> RegClass
targetClassOfRealReg :: Platform -> RealReg -> RegClass
targetClassOfRealReg Platform
platform
= case Platform -> Arch
platformArch Platform
platform of
Arch
ArchX86 -> Platform -> RealReg -> RegClass
X86.classOfRealReg Platform
platform
Arch
ArchX86_64 -> Platform -> RealReg -> RegClass
X86.classOfRealReg Platform
platform
Arch
ArchPPC -> RealReg -> RegClass
PPC.classOfRealReg
Arch
ArchS390X -> String -> RealReg -> RegClass
forall a. String -> a
panic String
"targetClassOfRealReg ArchS390X"
Arch
ArchSPARC -> RealReg -> RegClass
SPARC.classOfRealReg
Arch
ArchSPARC64 -> String -> RealReg -> RegClass
forall a. String -> a
panic String
"targetClassOfRealReg ArchSPARC64"
ArchPPC_64 PPC_64ABI
_ -> RealReg -> RegClass
PPC.classOfRealReg
ArchARM ArmISA
_ [ArmISAExt]
_ ArmABI
_ -> String -> RealReg -> RegClass
forall a. String -> a
panic String
"targetClassOfRealReg ArchARM"
Arch
ArchAArch64 -> String -> RealReg -> RegClass
forall a. String -> a
panic String
"targetClassOfRealReg ArchAArch64"
Arch
ArchAlpha -> String -> RealReg -> RegClass
forall a. String -> a
panic String
"targetClassOfRealReg ArchAlpha"
Arch
ArchMipseb -> String -> RealReg -> RegClass
forall a. String -> a
panic String
"targetClassOfRealReg ArchMipseb"
Arch
ArchMipsel -> String -> RealReg -> RegClass
forall a. String -> a
panic String
"targetClassOfRealReg ArchMipsel"
Arch
ArchJavaScript-> String -> RealReg -> RegClass
forall a. String -> a
panic String
"targetClassOfRealReg ArchJavaScript"
Arch
ArchUnknown -> String -> RealReg -> RegClass
forall a. String -> a
panic String
"targetClassOfRealReg ArchUnknown"
targetMkVirtualReg :: Platform -> Unique -> Format -> VirtualReg
targetMkVirtualReg :: Platform -> Unique -> Format -> VirtualReg
targetMkVirtualReg Platform
platform
= case Platform -> Arch
platformArch Platform
platform of
Arch
ArchX86 -> Unique -> Format -> VirtualReg
X86.mkVirtualReg
Arch
ArchX86_64 -> Unique -> Format -> VirtualReg
X86.mkVirtualReg
Arch
ArchPPC -> Unique -> Format -> VirtualReg
PPC.mkVirtualReg
Arch
ArchS390X -> String -> Unique -> Format -> VirtualReg
forall a. String -> a
panic String
"targetMkVirtualReg ArchS390X"
Arch
ArchSPARC -> Unique -> Format -> VirtualReg
SPARC.mkVirtualReg
Arch
ArchSPARC64 -> String -> Unique -> Format -> VirtualReg
forall a. String -> a
panic String
"targetMkVirtualReg ArchSPARC64"
ArchPPC_64 PPC_64ABI
_ -> Unique -> Format -> VirtualReg
PPC.mkVirtualReg
ArchARM ArmISA
_ [ArmISAExt]
_ ArmABI
_ -> String -> Unique -> Format -> VirtualReg
forall a. String -> a
panic String
"targetMkVirtualReg ArchARM"
Arch
ArchAArch64 -> String -> Unique -> Format -> VirtualReg
forall a. String -> a
panic String
"targetMkVirtualReg ArchAArch64"
Arch
ArchAlpha -> String -> Unique -> Format -> VirtualReg
forall a. String -> a
panic String
"targetMkVirtualReg ArchAlpha"
Arch
ArchMipseb -> String -> Unique -> Format -> VirtualReg
forall a. String -> a
panic String
"targetMkVirtualReg ArchMipseb"
Arch
ArchMipsel -> String -> Unique -> Format -> VirtualReg
forall a. String -> a
panic String
"targetMkVirtualReg ArchMipsel"
Arch
ArchJavaScript-> String -> Unique -> Format -> VirtualReg
forall a. String -> a
panic String
"targetMkVirtualReg ArchJavaScript"
Arch
ArchUnknown -> String -> Unique -> Format -> VirtualReg
forall a. String -> a
panic String
"targetMkVirtualReg ArchUnknown"
targetRegDotColor :: Platform -> RealReg -> SDoc
targetRegDotColor :: Platform -> RealReg -> SDoc
targetRegDotColor Platform
platform
= case Platform -> Arch
platformArch Platform
platform of
Arch
ArchX86 -> Platform -> RealReg -> SDoc
X86.regDotColor Platform
platform
Arch
ArchX86_64 -> Platform -> RealReg -> SDoc
X86.regDotColor Platform
platform
Arch
ArchPPC -> RealReg -> SDoc
PPC.regDotColor
Arch
ArchS390X -> String -> RealReg -> SDoc
forall a. String -> a
panic String
"targetRegDotColor ArchS390X"
Arch
ArchSPARC -> RealReg -> SDoc
SPARC.regDotColor
Arch
ArchSPARC64 -> String -> RealReg -> SDoc
forall a. String -> a
panic String
"targetRegDotColor ArchSPARC64"
ArchPPC_64 PPC_64ABI
_ -> RealReg -> SDoc
PPC.regDotColor
ArchARM ArmISA
_ [ArmISAExt]
_ ArmABI
_ -> String -> RealReg -> SDoc
forall a. String -> a
panic String
"targetRegDotColor ArchARM"
Arch
ArchAArch64 -> String -> RealReg -> SDoc
forall a. String -> a
panic String
"targetRegDotColor ArchAArch64"
Arch
ArchAlpha -> String -> RealReg -> SDoc
forall a. String -> a
panic String
"targetRegDotColor ArchAlpha"
Arch
ArchMipseb -> String -> RealReg -> SDoc
forall a. String -> a
panic String
"targetRegDotColor ArchMipseb"
Arch
ArchMipsel -> String -> RealReg -> SDoc
forall a. String -> a
panic String
"targetRegDotColor ArchMipsel"
Arch
ArchJavaScript-> String -> RealReg -> SDoc
forall a. String -> a
panic String
"targetRegDotColor ArchJavaScript"
Arch
ArchUnknown -> String -> RealReg -> SDoc
forall a. String -> a
panic String
"targetRegDotColor ArchUnknown"
targetClassOfReg :: Platform -> Reg -> RegClass
targetClassOfReg :: Platform -> Reg -> RegClass
targetClassOfReg Platform
platform Reg
reg
= case Reg
reg of
RegVirtual VirtualReg
vr -> VirtualReg -> RegClass
classOfVirtualReg VirtualReg
vr
RegReal RealReg
rr -> Platform -> RealReg -> RegClass
targetClassOfRealReg Platform
platform RealReg
rr