ghc-lib-parser-9.12.2.20250421: The GHC API, decoupled from GHC versions

Safe Haskell | Ignore
Language | GHC2021

GHC.Platform.Ways

Contents

- Host GHC ways

Description

Ways

The central concept of a "way" is that all objects in a given program must be compiled in the same "way". Certain options change parameters of the virtual machine, eg. profiling adds an extra word to the object header, so profiling objects cannot be linked with non-profiling objects.

After parsing the command-line options, we determine which "way" we are building - this might be a combination way, eg. profiling+threaded.

There are two kinds of ways: - RTS only: only affect the runtime system (RTS) and don't affect code generation (e.g. threaded, debug) - Full ways: affect code generation and the RTS (e.g. profiling, dynamic linking)

We then find the "build-tag" associated with this way, and this becomes the suffix used to find .hi files and libraries used in this compilation.

Synopsis

- data Way
  - = WayCustom String
  - | WayThreaded
  - | WayDebug
  - | WayProf
  - | WayDyn
- type Ways = Set Way
- hasWay :: Ways -> Way -> Bool
- hasNotWay :: Ways -> Way -> Bool
- addWay :: Way -> Ways -> Ways
- removeWay :: Way -> Ways -> Ways
- allowed_combination :: Ways -> Bool
- wayGeneralFlags :: Platform -> Way -> [GeneralFlag]
- wayUnsetGeneralFlags :: Platform -> Way -> [GeneralFlag]
- wayOptc :: Platform -> Way -> [String]
- wayOptcxx :: Platform -> Way -> [String]
- wayOptl :: Platform -> Way -> [String]
- wayOptP :: Platform -> Way -> [String]
- wayDesc :: Way -> String
- wayRTSOnly :: Way -> Bool
- wayTag :: Way -> String
- waysTag :: Ways -> String
- waysBuildTag :: Ways -> String
- fullWays :: Ways -> Ways
- rtsWays :: Ways -> Ways
- hostWays :: Ways
- hostFullWays :: Ways
- hostIsProfiled :: Bool
- hostIsDynamic :: Bool
- hostIsThreaded :: Bool
- hostIsDebugged :: Bool
- hostIsTracing :: Bool

# Documentation

data Way Source #

A way

Don't change the constructor order as it is used by `waysTag` to create a unique tag (e.g. thr_debug_p) which is expected by other tools (e.g. Cabal).

Constructors

WayCustom String | for GHC API clients building custom variants
WayThreaded | (RTS only) Multithreaded runtime system
WayDebug | Debugging, enable trace messages and extra checks
WayProf | Profiling, enable cost-centre stacks and profiling reports
WayDyn | Dynamic linking

#### Instances

Instances details

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

type Ways = Set Way Source #

hasWay :: Ways -> Way -> Bool Source #

Test if a way is enabled

hasNotWay :: Ways -> Way -> Bool Source #

Test if a way is not enabled

addWay :: Way -> Ways -> Ways Source #

Add a way

removeWay :: Way -> Ways -> Ways Source #

Remove a way

allowed_combination :: Ways -> Bool Source #

Check if a combination of ways is allowed

wayGeneralFlags :: Platform -> Way -> [GeneralFlag] Source #

Turn these flags on when enabling this way

wayUnsetGeneralFlags :: Platform -> Way -> [GeneralFlag] Source #

Turn these flags off when enabling this way

wayOptc :: Platform -> Way -> [String] Source #

Pass these options to the C compiler when enabling this way

wayOptcxx :: Platform -> Way -> [String] Source #

wayOptl :: Platform -> Way -> [String] Source #

Pass these options to linker when enabling this way

wayOptP :: Platform -> Way -> [String] Source #

Pass these options to the preprocessor when enabling this way

wayDesc :: Way -> String Source #

wayRTSOnly :: Way -> Bool Source #

Return true for ways that only impact the RTS, not the generated code

wayTag :: Way -> String Source #

Unique build-tag associated to a way

waysTag :: Ways -> String Source #

Unique tag associated to a list of ways

waysBuildTag :: Ways -> String Source #

Unique build-tag associated to a list of ways

RTS only ways are filtered out because they have no impact on the build.

fullWays :: Ways -> Ways Source #

Filter ways that have an impact on compilation

rtsWays :: Ways -> Ways Source #

Filter RTS-only ways (ways that don't have an impact on compilation)

# Host GHC ways

hostWays :: Ways Source #

Host ways.

hostFullWays :: Ways Source #

Host "full" ways (i.e. ways that have an impact on the compilation, not RTS only ways).

These ways must be used when compiling codes targeting the internal interpreter.

hostIsProfiled :: Bool Source #

Consult the RTS to find whether it has been built with profiling enabled.

hostIsDynamic :: Bool Source #

Consult the RTS to find whether GHC itself has been built with dynamic linking. This can't be statically known at compile-time, because we build both the static and dynamic versions together with -dynamic-too.

hostIsThreaded :: Bool Source #

Consult the RTS to find whether it is threaded.

hostIsDebugged :: Bool Source #

Consult the RTS to find whether it is debugged.

hostIsTracing :: Bool Source #

Consult the RTS to find whether it is tracing.