GHC.Platform

ghc-boot-9.0.0.20200925: Shared functionality between GHC and its boot libraries

Safe Haskell | Safe-Inferred
Language | Haskell2010

GHC.Platform

Description

A description of the platform we're compiling for.

Synopsis

- data PlatformMini = PlatformMini {
  - platformMini_arch :: Arch
  - platformMini_os :: OS
  }
- data PlatformWordSize
  - = PW4
  - | PW8
- data Platform = Platform {
  - platformMini :: !PlatformMini
  - platformWordSize :: !PlatformWordSize
  - platformByteOrder :: !ByteOrder
  - platformUnregisterised :: !Bool
  - platformHasGnuNonexecStack :: !Bool
  - platformHasIdentDirective :: !Bool
  - platformHasSubsectionsViaSymbols :: !Bool
  - platformIsCrossCompiling :: !Bool
  - platformLeadingUnderscore :: !Bool
  - platformTablesNextToCode :: !Bool
  }
- platformArch :: Platform -> Arch
- platformOS :: Platform -> OS
- data Arch
  - = ArchUnknown
  - | ArchX86
  - | ArchX86_64
  - | ArchPPC
  - | ArchPPC_64 {
    - ppc_64ABI :: PPC_64ABI
    }
  - | ArchS390X
  - | ArchSPARC
  - | ArchSPARC64
  - | ArchARM {
    - armISA :: ArmISA
    - armISAExt :: [ArmISAExt]
    - armABI :: ArmABI
    }
  - | ArchARM64
  - | ArchAlpha
  - | ArchMipseb
  - | ArchMipsel
  - | ArchJavaScript
- data OS
  - = OSUnknown
  - | OSLinux
  - | OSDarwin
  - | OSSolaris2
  - | OSMinGW32
  - | OSFreeBSD
  - | OSDragonFly
  - | OSOpenBSD
  - | OSNetBSD
  - | OSKFreeBSD
  - | OSHaiku
  - | OSQNXNTO
  - | OSAIX
  - | OSHurd
- data ArmISA
  - = ARMv5
  - | ARMv6
  - | ARMv7
- data ArmISAExt
  - = VFPv2
  - | VFPv3
  - | VFPv3D16
  - | NEON
  - | IWMMX2
- data ArmABI
  - = SOFT
  - | SOFTFP
  - | HARD
- data PPC_64ABI
  - = ELF_V1
  - | ELF_V2
- data ByteOrder
  - = BigEndian
  - | LittleEndian
- target32Bit :: Platform -> Bool
- isARM :: Arch -> Bool
- osElfTarget :: OS -> Bool
- osMachOTarget :: OS -> Bool
- osSubsectionsViaSymbols :: OS -> Bool
- platformUsesFrameworks :: Platform -> Bool
- platformWordSizeInBytes :: Platform -> Int
- platformWordSizeInBits :: Platform -> Int
- platformMinInt :: Platform -> Integer
- platformMaxInt :: Platform -> Integer
- platformMaxWord :: Platform -> Integer
- platformInIntRange :: Platform -> Integer -> Bool
- platformInWordRange :: Platform -> Integer -> Bool
- data PlatformMisc = PlatformMisc {
  - platformMisc_targetPlatformString :: String
  - platformMisc_ghcWithInterpreter :: Bool
  - platformMisc_ghcWithSMP :: Bool
  - platformMisc_ghcRTSWays :: String
  - platformMisc_libFFI :: Bool
  - platformMisc_ghcThreaded :: Bool
  - platformMisc_ghcDebugged :: Bool
  - platformMisc_ghcRtsWithLibdw :: Bool
  - platformMisc_llvmTarget :: String
  }
- stringEncodeArch :: Arch -> String
- stringEncodeOS :: OS -> String
- data SseVersion
  - = SSE1
  - | SSE2
  - | SSE3
  - | SSE4
  - | SSE42
- data BmiVersion
  - = BMI1
  - | BMI2

# Documentation

data PlatformMini Source #

Contains the bare-bones arch and os information. This isn't enough for code gen, but useful for tasks where we can fall back upon the host platform, as this is all we know about the host platform.

Constructors

PlatformMini |
Fields platformMini_arch :: Arch platformMini_os :: OS

#### Instances

Instances details

Eq PlatformMini # |
Instance details Defined in GHC.Platform Methods (==) :: PlatformMini -> PlatformMini -> Bool # (/=) :: PlatformMini -> PlatformMini -> Bool #
Read PlatformMini # |
Instance details Defined in GHC.Platform Methods readsPrec :: Int -> ReadS PlatformMini Source # readList :: ReadS [PlatformMini] Source # readPrec :: ReadPrec PlatformMini Source # readListPrec :: ReadPrec [PlatformMini] Source #
Show PlatformMini # |
Instance details Defined in GHC.Platform Methods showsPrec :: Int -> PlatformMini -> ShowS Source # show :: PlatformMini -> String Source # showList :: [PlatformMini] -> ShowS Source #

data PlatformWordSize Source #

Constructors

PW4 | A 32-bit platform
PW8 | A 64-bit platform

#### Instances

Instances details

Eq PlatformWordSize # |
Instance details Defined in GHC.Platform Methods (==) :: PlatformWordSize -> PlatformWordSize -> Bool # (/=) :: PlatformWordSize -> PlatformWordSize -> Bool #
Read PlatformWordSize # |
Instance details Defined in GHC.Platform Methods readsPrec :: Int -> ReadS PlatformWordSize Source # readList :: ReadS [PlatformWordSize] Source # readPrec :: ReadPrec PlatformWordSize Source # readListPrec :: ReadPrec [PlatformWordSize] Source #
Show PlatformWordSize # |
Instance details Defined in GHC.Platform Methods showsPrec :: Int -> PlatformWordSize -> ShowS Source # show :: PlatformWordSize -> String Source # showList :: [PlatformWordSize] -> ShowS Source #

data Platform Source #

Contains enough information for the native code generator to emit code for this platform.

Constructors

Platform |
Fields platformMini :: !PlatformMini platformWordSize :: !PlatformWordSize Word size platformByteOrder :: !ByteOrder Byte order (endianness) platformUnregisterised :: !Bool platformHasGnuNonexecStack :: !Bool platformHasIdentDirective :: !Bool platformHasSubsectionsViaSymbols :: !Bool platformIsCrossCompiling :: !Bool platformLeadingUnderscore :: !Bool Symbols need underscore prefix platformTablesNextToCode :: !Bool Determines whether we will be compiling info tables that reside just before the entry code, or with an indirection to the entry code. See TABLES_NEXT_TO_CODE in includesrtsstorage/InfoTables.h.

#### Instances

Instances details

Eq Platform # |
Instance details Defined in GHC.Platform Methods (==) :: Platform -> Platform -> Bool # (/=) :: Platform -> Platform -> Bool #
Read Platform # |
Instance details Defined in GHC.Platform Methods readsPrec :: Int -> ReadS Platform Source # readList :: ReadS [Platform] Source # readPrec :: ReadPrec Platform Source # readListPrec :: ReadPrec [Platform] Source #
Show Platform # |
Instance details Defined in GHC.Platform Methods showsPrec :: Int -> Platform -> ShowS Source # show :: Platform -> String Source # showList :: [Platform] -> ShowS Source #

platformArch :: Platform -> Arch Source #

Legacy accessor

platformOS :: Platform -> OS Source #

Legacy accessor

data Arch Source #

Architectures that the native code generator knows about. TODO: It might be nice to extend these constructors with information about what instruction set extensions an architecture might support.

Constructors

ArchUnknown |
ArchX86 |
ArchX86_64 |
ArchPPC |
ArchPPC_64 |
Fields ppc_64ABI :: PPC_64ABI
ArchS390X |
ArchSPARC |
ArchSPARC64 |
ArchARM |
Fields armISA :: ArmISA armISAExt :: [ArmISAExt] armABI :: ArmABI
ArchARM64 |
ArchAlpha |
ArchMipseb |
ArchMipsel |
ArchJavaScript |

#### Instances

Instances details

Eq Arch # |
Instance details Defined in GHC.Platform Methods (==) :: Arch -> Arch -> Bool # (/=) :: Arch -> Arch -> Bool #
Read Arch # |
Instance details Defined in GHC.Platform Methods readsPrec :: Int -> ReadS Arch Source # readList :: ReadS [Arch] Source # readPrec :: ReadPrec Arch Source # readListPrec :: ReadPrec [Arch] Source #
Show Arch # |
Instance details Defined in GHC.Platform Methods showsPrec :: Int -> Arch -> ShowS Source # show :: Arch -> String Source # showList :: [Arch] -> ShowS Source #

data OS Source #

Operating systems that the native code generator knows about. Having OSUnknown should produce a sensible default, but no promises.

Constructors

OSUnknown |
OSLinux |
OSDarwin |
OSSolaris2 |
OSMinGW32 |
OSFreeBSD |
OSDragonFly |
OSOpenBSD |
OSNetBSD |
OSKFreeBSD |
OSHaiku |
OSQNXNTO |
OSAIX |
OSHurd |

#### Instances

Instances details

Eq OS # |
Instance details Defined in GHC.Platform Methods (==) :: OS -> OS -> Bool # (/=) :: OS -> OS -> Bool #
Read OS # |
Instance details Defined in GHC.Platform Methods readsPrec :: Int -> ReadS OS Source # readList :: ReadS [OS] Source # readPrec :: ReadPrec OS Source # readListPrec :: ReadPrec [OS] Source #
Show OS # |
Instance details Defined in GHC.Platform Methods showsPrec :: Int -> OS -> ShowS Source # show :: OS -> String Source # showList :: [OS] -> ShowS Source #

data ArmISA Source #

ARM Instruction Set Architecture, Extensions and ABI

Constructors

ARMv5 |
ARMv6 |
ARMv7 |

#### Instances

Instances details

Eq ArmISA # |
Instance details Defined in GHC.Platform Methods (==) :: ArmISA -> ArmISA -> Bool # (/=) :: ArmISA -> ArmISA -> Bool #
Read ArmISA # |
Instance details Defined in GHC.Platform Methods readsPrec :: Int -> ReadS ArmISA Source # readList :: ReadS [ArmISA] Source # readPrec :: ReadPrec ArmISA Source # readListPrec :: ReadPrec [ArmISA] Source #
Show ArmISA # |
Instance details Defined in GHC.Platform Methods showsPrec :: Int -> ArmISA -> ShowS Source # show :: ArmISA -> String Source # showList :: [ArmISA] -> ShowS Source #

data ArmISAExt Source #

Constructors

VFPv2 |
VFPv3 |
VFPv3D16 |
NEON |
IWMMX2 |

#### Instances

Instances details

Eq ArmISAExt # |
Instance details Defined in GHC.Platform Methods (==) :: ArmISAExt -> ArmISAExt -> Bool # (/=) :: ArmISAExt -> ArmISAExt -> Bool #
Read ArmISAExt # |
Instance details Defined in GHC.Platform Methods readsPrec :: Int -> ReadS ArmISAExt Source # readList :: ReadS [ArmISAExt] Source # readPrec :: ReadPrec ArmISAExt Source # readListPrec :: ReadPrec [ArmISAExt] Source #
Show ArmISAExt # |
Instance details Defined in GHC.Platform Methods showsPrec :: Int -> ArmISAExt -> ShowS Source # show :: ArmISAExt -> String Source # showList :: [ArmISAExt] -> ShowS Source #

data ArmABI Source #

Constructors

SOFT |
SOFTFP |
HARD |

#### Instances

Instances details

Eq ArmABI # |
Instance details Defined in GHC.Platform Methods (==) :: ArmABI -> ArmABI -> Bool # (/=) :: ArmABI -> ArmABI -> Bool #
Read ArmABI # |
Instance details Defined in GHC.Platform Methods readsPrec :: Int -> ReadS ArmABI Source # readList :: ReadS [ArmABI] Source # readPrec :: ReadPrec ArmABI Source # readListPrec :: ReadPrec [ArmABI] Source #
Show ArmABI # |
Instance details Defined in GHC.Platform Methods showsPrec :: Int -> ArmABI -> ShowS Source # show :: ArmABI -> String Source # showList :: [ArmABI] -> ShowS Source #

data PPC_64ABI Source #

PowerPC 64-bit ABI

Constructors

ELF_V1 |
ELF_V2 |

#### Instances

Instances details

Eq PPC_64ABI # |
Instance details Defined in GHC.Platform Methods (==) :: PPC_64ABI -> PPC_64ABI -> Bool # (/=) :: PPC_64ABI -> PPC_64ABI -> Bool #
Read PPC_64ABI # |
Instance details Defined in GHC.Platform Methods readsPrec :: Int -> ReadS PPC_64ABI Source # readList :: ReadS [PPC_64ABI] Source # readPrec :: ReadPrec PPC_64ABI Source # readListPrec :: ReadPrec [PPC_64ABI] Source #
Show PPC_64ABI # |
Instance details Defined in GHC.Platform Methods showsPrec :: Int -> PPC_64ABI -> ShowS Source # show :: PPC_64ABI -> String Source # showList :: [PPC_64ABI] -> ShowS Source #

data ByteOrder Source #

Byte ordering.

Constructors

BigEndian | most-significant-byte occurs in lowest address.
LittleEndian | least-significant-byte occurs in lowest address.

#### Instances

Instances details

Bounded ByteOrder | Since: base-4.11.0.0
Instance details Defined in GHC.ByteOrder Methods minBound :: ByteOrder Source # maxBound :: ByteOrder Source #
Enum ByteOrder | Since: base-4.11.0.0
Instance details Defined in GHC.ByteOrder Methods succ :: ByteOrder -> ByteOrder Source # pred :: ByteOrder -> ByteOrder Source # toEnum :: Int -> ByteOrder Source # fromEnum :: ByteOrder -> Int Source # enumFrom :: ByteOrder -> [ByteOrder] Source # enumFromThen :: ByteOrder -> ByteOrder -> [ByteOrder] Source # enumFromTo :: ByteOrder -> ByteOrder -> [ByteOrder] Source # enumFromThenTo :: ByteOrder -> ByteOrder -> ByteOrder -> [ByteOrder] Source #
Eq ByteOrder | Since: base-4.11.0.0
Instance details Defined in GHC.ByteOrder Methods (==) :: ByteOrder -> ByteOrder -> Bool # (/=) :: ByteOrder -> ByteOrder -> Bool #
Ord ByteOrder | Since: base-4.11.0.0
Instance details Defined in GHC.ByteOrder Methods compare :: ByteOrder -> ByteOrder -> Ordering # (<) :: ByteOrder -> ByteOrder -> Bool # (<=) :: ByteOrder -> ByteOrder -> Bool # (>) :: ByteOrder -> ByteOrder -> Bool # (>=) :: ByteOrder -> ByteOrder -> Bool # max :: ByteOrder -> ByteOrder -> ByteOrder # min :: ByteOrder -> ByteOrder -> ByteOrder #
Read ByteOrder | Since: base-4.11.0.0
Instance details Defined in GHC.ByteOrder Methods readsPrec :: Int -> ReadS ByteOrder Source # readList :: ReadS [ByteOrder] Source # readPrec :: ReadPrec ByteOrder Source # readListPrec :: ReadPrec [ByteOrder] Source #
Show ByteOrder | Since: base-4.11.0.0
Instance details Defined in GHC.ByteOrder Methods showsPrec :: Int -> ByteOrder -> ShowS Source # show :: ByteOrder -> String Source # showList :: [ByteOrder] -> ShowS Source #
Generic ByteOrder |
Instance details Defined in GHC.ByteOrder Associated Types type Rep ByteOrder :: Type -> Type Source # Methods from :: ByteOrder -> Rep ByteOrder x Source # to :: Rep ByteOrder x -> ByteOrder Source #
type Rep ByteOrder | Since: base-4.15.0.0
Instance details Defined in GHC.ByteOrder type Rep ByteOrder = D1 ('MetaData "ByteOrder" "GHC.ByteOrder" "base" 'False) (C1 ('MetaCons "BigEndian" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "LittleEndian" 'PrefixI 'False) (U1 :: Type -> Type))

target32Bit :: Platform -> Bool Source #

This predicate tells us whether the platform is 32-bit.

isARM :: Arch -> Bool Source #

osElfTarget :: OS -> Bool Source #

This predicate tells us whether the OS supports ELF-like shared libraries.

osMachOTarget :: OS -> Bool Source #

This predicate tells us whether the OS support Mach-O shared libraries.

osSubsectionsViaSymbols :: OS -> Bool Source #

platformUsesFrameworks :: Platform -> Bool Source #

platformWordSizeInBytes :: Platform -> Int Source #

platformWordSizeInBits :: Platform -> Int Source #

platformMinInt :: Platform -> Integer Source #

Minimum representable Int value for the given platform

platformMaxInt :: Platform -> Integer Source #

Maximum representable Int value for the given platform

platformMaxWord :: Platform -> Integer Source #

Maximum representable Word value for the given platform

platformInIntRange :: Platform -> Integer -> Bool Source #

Test if the given Integer is representable with a platform Int

platformInWordRange :: Platform -> Integer -> Bool Source #

Test if the given Integer is representable with a platform Word

data PlatformMisc Source #

Platform-specific settings formerly hard-coded in Config.hs.

These should probably be all be triaged whether they can be computed from other settings or belong in another another place (like `Platform` above).

Constructors

PlatformMisc |
Fields platformMisc_targetPlatformString :: String platformMisc_ghcWithInterpreter :: Bool platformMisc_ghcWithSMP :: Bool platformMisc_ghcRTSWays :: String platformMisc_libFFI :: Bool platformMisc_ghcThreaded :: Bool platformMisc_ghcDebugged :: Bool platformMisc_ghcRtsWithLibdw :: Bool platformMisc_llvmTarget :: String

stringEncodeArch :: Arch -> String Source #

See Note [Platform Syntax].

stringEncodeOS :: OS -> String Source #

See Note [Platform Syntax].

data SseVersion Source #

x86 SSE instructions

Constructors

SSE1 |
SSE2 |
SSE3 |
SSE4 |
SSE42 |

#### Instances

Instances details

Eq SseVersion # |
Instance details Defined in GHC.Platform Methods (==) :: SseVersion -> SseVersion -> Bool # (/=) :: SseVersion -> SseVersion -> Bool #
Ord SseVersion # |
Instance details Defined in GHC.Platform Methods compare :: SseVersion -> SseVersion -> Ordering # (<) :: SseVersion -> SseVersion -> Bool # (<=) :: SseVersion -> SseVersion -> Bool # (>) :: SseVersion -> SseVersion -> Bool # (>=) :: SseVersion -> SseVersion -> Bool # max :: SseVersion -> SseVersion -> SseVersion # min :: SseVersion -> SseVersion -> SseVersion #

data BmiVersion Source #

x86 BMI (bit manipulation) instructions

Constructors

BMI1 |
BMI2 |

#### Instances

Instances details

Eq BmiVersion # |
Instance details Defined in GHC.Platform Methods (==) :: BmiVersion -> BmiVersion -> Bool # (/=) :: BmiVersion -> BmiVersion -> Bool #
Ord BmiVersion # |
Instance details Defined in GHC.Platform Methods compare :: BmiVersion -> BmiVersion -> Ordering # (<) :: BmiVersion -> BmiVersion -> Bool # (<=) :: BmiVersion -> BmiVersion -> Bool # (>) :: BmiVersion -> BmiVersion -> Bool # (>=) :: BmiVersion -> BmiVersion -> Bool # max :: BmiVersion -> BmiVersion -> BmiVersion # min :: BmiVersion -> BmiVersion -> BmiVersion #