summaryrefslogtreecommitdiff
path: root/compiler/GHC/Platform/Profile.hs
blob: d484a1ebc4c7da2c4828d763e1fa9861b1ef45ba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
-- | Platform profiles
module GHC.Platform.Profile
   ( Profile (..)
   , profileBuildTag
   )
where

import GHC.Prelude

import GHC.Platform
import GHC.Platform.Ways

import Data.Set

-- | A platform profile fully describes the kind of objects that are generated
-- for a platform.
--
-- 'Platform' doesn't fully describe the ABI of an object. Compiler ways
-- (profiling, debug, dynamic) also modify the ABI.
--
data Profile = Profile
   { profilePlatform :: !Platform  -- ^ Platform
   , profileWays     :: !(Set Way) -- ^ Ways
   }

-- | Unique build tag for the profile
profileBuildTag :: Profile -> String
profileBuildTag profile
    -- profiles using unregisterised convention are not binary compatible with
    -- those that don't. Make sure to make it apparent in the tag so that our
    -- interface files can't be mismatched by mistake.
  | platformUnregisterised platform = 'u':wayTag
  | otherwise                       =     wayTag
  where
   platform = profilePlatform profile
   wayTag   = waysBuildTag (profileWays profile)