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