536ebb5706eeda5dca3d99362350dbdeaad15b77
[ghc-hetmet.git] / ghc / compiler / main / Constants.lhs
1 %
2 % (c) The GRASP/AQUA Project, Glasgow University, 1992-1994
3 %
4 \section[Constants]{Info about this compilation}
5
6 !!!!! THIS CODE MUST AGREE WITH SMinterface.h !!!!!!
7
8 *** This SHOULD BE the only module that is CPP'd with "stgdefs.h" stuff.
9
10 \begin{code}
11 #include "HsVersions.h"
12
13 module Constants (
14         uNFOLDING_USE_THRESHOLD,
15         uNFOLDING_CREATION_THRESHOLD,
16 --      uNFOLDING_OVERRIDE_THRESHOLD,
17         iNTERFACE_UNFOLD_THRESHOLD,
18         lIBERATE_CASE_THRESHOLD,
19         uNFOLDING_CHEAP_OP_COST,
20         uNFOLDING_DEAR_OP_COST,
21         uNFOLDING_NOREP_LIT_COST,
22         uNFOLDING_CON_DISCOUNT_WEIGHT,
23
24         mAX_SPEC_ALL_PTRS,
25         mAX_SPEC_ALL_NONPTRS,
26         mAX_SPEC_MIXED_FIELDS,
27         mAX_SPEC_SELECTEE_SIZE,
28
29         tARGET_MIN_INT, tARGET_MAX_INT,
30
31         mIN_UPD_SIZE,
32         mIN_SIZE_NonUpdHeapObject,
33         mIN_SIZE_NonUpdStaticHeapObject,
34
35         mAX_FAMILY_SIZE_FOR_VEC_RETURNS,
36
37         sTD_UF_SIZE,     cON_UF_SIZE,
38         sCC_STD_UF_SIZE, sCC_CON_UF_SIZE,
39         uF_RET,
40         uF_SUB,
41         uF_SUA,
42         uF_UPDATEE,
43         uF_COST_CENTRE,
44
45         mAX_Vanilla_REG,
46         mAX_Float_REG,
47         mAX_Double_REG,
48
49         mIN_BIG_TUPLE_SIZE,
50
51         mIN_MP_INT_SIZE,
52         mP_STRUCT_SIZE,
53
54         oTHER_TAG, iND_TAG,     -- semi-tagging stuff
55
56         lIVENESS_R1,
57         lIVENESS_R2,
58         lIVENESS_R3,
59         lIVENESS_R4,
60         lIVENESS_R5,
61         lIVENESS_R6,
62         lIVENESS_R7,
63         lIVENESS_R8,
64
65         mAX_INTLIKE, mIN_INTLIKE,
66
67
68         spARelToInt,
69         spBRelToInt
70     ) where
71
72 -- This magical #include brings in all the everybody-knows-these magic
73 -- constants unfortunately, we need to be *explicit* about which one
74 -- we want; if we just hope a -I... will get the right one, we could
75 -- be in trouble.
76
77 #include "../../includes/GhcConstants.h"
78
79 CHK_Ubiq() -- debugging consistency check
80
81 import Util
82 \end{code}
83
84 All pretty arbitrary:
85 \begin{code}
86 uNFOLDING_USE_THRESHOLD       = ( 8 :: Int)
87 uNFOLDING_CREATION_THRESHOLD  = (30 :: Int)
88 iNTERFACE_UNFOLD_THRESHOLD    = (30 :: Int)
89 lIBERATE_CASE_THRESHOLD       = (10 :: Int)
90 -- uNFOLDING_OVERRIDE_THRESHOLD  = ( 8 :: Int)
91
92 uNFOLDING_CHEAP_OP_COST       = ( 1 :: Int)
93 uNFOLDING_DEAR_OP_COST        = ( 4 :: Int)
94 uNFOLDING_NOREP_LIT_COST      = ( 20 :: Int)    -- Strings can be pretty big
95 uNFOLDING_CON_DISCOUNT_WEIGHT = ( 1 :: Int)
96 \end{code}
97
98 \begin{code}
99 mAX_SPEC_ALL_PTRS       = (MAX_SPEC_ALL_PTRS :: Int)
100 mAX_SPEC_ALL_NONPTRS    = (MAX_SPEC_ALL_NONPTRS :: Int)
101 mAX_SPEC_MIXED_FIELDS   = (MAX_SPEC_OTHER_SIZE :: Int)
102 mAX_SPEC_SELECTEE_SIZE  = (MAX_SPEC_SELECTEE_SIZE :: Int)
103
104 -- closure sizes: these do NOT include the header
105 mIN_UPD_SIZE                    = (MIN_UPD_SIZE::Int)
106 mIN_SIZE_NonUpdHeapObject       = (MIN_NONUPD_SIZE::Int)
107 mIN_SIZE_NonUpdStaticHeapObject = (0::Int)
108 \end{code}
109
110 A completely random number:
111 \begin{code}
112 mIN_BIG_TUPLE_SIZE = (16::Int)
113 \end{code}
114
115 Sizes of gmp objects:
116 \begin{code}
117 mIN_MP_INT_SIZE = (MIN_MP_INT_SIZE :: Int)
118 mP_STRUCT_SIZE = (MP_STRUCT_SIZE :: Int)
119 \end{code}
120
121 \begin{code}
122 tARGET_MIN_INT, tARGET_MAX_INT :: Integer
123 tARGET_MIN_INT = -536870912
124 tARGET_MAX_INT =  536870912
125 \end{code}
126  
127 Constants for semi-tagging; the tags associated with the data
128 constructors will start at 0 and go up.
129 \begin{code}
130 oTHER_TAG = (INFO_OTHER_TAG :: Integer) -- (-1) unevaluated, probably
131 iND_TAG   = (INFO_IND_TAG   :: Integer) -- (-2) NOT USED, REALLY
132 \end{code}
133
134 Stuff for liveness masks:
135 \begin{code}
136 lIVENESS_R1     = (LIVENESS_R1 :: Int)
137 lIVENESS_R2     = (LIVENESS_R2 :: Int)
138 lIVENESS_R3     = (LIVENESS_R3 :: Int)
139 lIVENESS_R4     = (LIVENESS_R4 :: Int)
140 lIVENESS_R5     = (LIVENESS_R5 :: Int)
141 lIVENESS_R6     = (LIVENESS_R6 :: Int)
142 lIVENESS_R7     = (LIVENESS_R7 :: Int)
143 lIVENESS_R8     = (LIVENESS_R8 :: Int)
144 \end{code}
145
146 \begin{code}
147 mIN_INTLIKE, mAX_INTLIKE :: Integer     -- Only used to compare with (MachInt Integer)
148 mIN_INTLIKE = MIN_INTLIKE
149 mAX_INTLIKE = MAX_INTLIKE
150 \end{code}
151
152 \begin{code}
153 -- THESE ARE DIRECTION SENSITIVE!
154 spARelToInt :: Int{-VirtualSpAOffset-} -> Int{-VirtualSpAOffset-} -> Int
155 spBRelToInt :: Int{-VirtualSpBOffset-} -> Int{-VirtualSpBOffset-} -> Int
156
157 spARelToInt spA off = spA - off -- equiv to: AREL(spA - off)
158 spBRelToInt spB off = off - spB -- equiv to: BREL(spB - off)
159 \end{code}
160
161 A section of code-generator-related MAGIC CONSTANTS.
162 \begin{code}
163 mAX_FAMILY_SIZE_FOR_VEC_RETURNS = (MAX_VECTORED_RTN::Int)  -- pretty arbitrary
164 -- If you change this, you may need to change runtimes/standard/Update.lhc
165
166 -- The update frame sizes
167 sTD_UF_SIZE     = (NOSCC_STD_UF_SIZE::Int)
168 cON_UF_SIZE     = (NOSCC_CON_UF_SIZE::Int)
169
170 -- Same again, with profiling
171 sCC_STD_UF_SIZE = (SCC_STD_UF_SIZE::Int)
172 sCC_CON_UF_SIZE = (SCC_CON_UF_SIZE::Int)
173
174 -- Offsets in an update frame.  They don't change with profiling!
175 uF_RET = (UF_RET::Int)
176 uF_SUB = (UF_SUB::Int)
177 uF_SUA = (UF_SUA::Int)
178 uF_UPDATEE = (UF_UPDATEE::Int)
179 uF_COST_CENTRE = (UF_COST_CENTRE::Int)
180 \end{code}
181
182 \begin{code}
183 mAX_Vanilla_REG = (MAX_VANILLA_REG :: Int)
184 mAX_Float_REG   = (MAX_FLOAT_REG :: Int)
185 mAX_Double_REG  = (MAX_DOUBLE_REG :: Int)
186 \end{code}