[project @ 1996-01-08 20:28:12 by partain]
[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 #ifndef DPH
43         mAX_Float_REG,
44         mAX_Double_REG,
45 #else
46         mAX_Data_REG,
47 #endif {- Data Parallel Haskell -}
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
71         -- and to make the interface self-sufficient...
72         RegRelative
73     ) where
74
75 -- This magical #include brings in all the everybody-knows-these magic
76 -- constants unfortunately, we need to be *explicit* about which one
77 -- we want; if we just hope a -I... will get the right one, we could
78 -- be in trouble.
79
80 #ifndef DPH
81 #include "../../includes/GhcConstants.h"
82 #else
83 #include "../dphsystem/imports/DphConstants.h"
84 #endif {- Data Parallel Haskell -}
85
86 import AbsCSyn
87 import Util
88 \end{code}
89
90 All pretty arbitrary:
91 \begin{code}
92 uNFOLDING_USE_THRESHOLD       = ( 3 :: Int)
93 uNFOLDING_CREATION_THRESHOLD  = (30 :: Int)
94 uNFOLDING_OVERRIDE_THRESHOLD  = ( 8 :: Int)
95 uNFOLDING_CHEAP_OP_COST       = ( 1 :: Int)
96 uNFOLDING_DEAR_OP_COST        = ( 4 :: Int)
97 uNFOLDING_NOREP_LIT_COST      = ( 4 :: Int)
98 uNFOLDING_CON_DISCOUNT_WEIGHT = ( 1 :: Int)
99 \end{code}
100
101 \begin{code}
102 mAX_SPEC_ALL_PTRS       = (MAX_SPEC_ALL_PTRS :: Int)
103 mAX_SPEC_ALL_NONPTRS    = (MAX_SPEC_ALL_NONPTRS :: Int)
104 mAX_SPEC_MIXED_FIELDS   = (MAX_SPEC_OTHER_SIZE :: Int)
105 mAX_SPEC_SELECTEE_SIZE  = (MAX_SPEC_SELECTEE_SIZE :: Int)
106
107 -- closure sizes: these do NOT include the header
108 mIN_UPD_SIZE                    = (MIN_UPD_SIZE::Int)
109 mIN_SIZE_NonUpdHeapObject       = (MIN_NONUPD_SIZE::Int)
110 mIN_SIZE_NonUpdStaticHeapObject = (0::Int)
111 \end{code}
112
113 A completely random number:
114 \begin{code}
115 mIN_BIG_TUPLE_SIZE = (16::Int)
116 \end{code}
117
118 Sizes of gmp objects:
119 \begin{code}
120 mIN_MP_INT_SIZE = (MIN_MP_INT_SIZE :: Int)
121 mP_STRUCT_SIZE = (MP_STRUCT_SIZE :: Int)
122 \end{code}
123
124 Constants for semi-tagging; the tags associated with the data
125 constructors will start at 0 and go up.
126 \begin{code}
127 oTHER_TAG = (INFO_OTHER_TAG :: Integer) -- (-1) unevaluated, probably
128 iND_TAG   = (INFO_IND_TAG   :: Integer) -- (-1) NOT USED, REALLY
129 \end{code}
130
131 Stuff for liveness masks:
132 \begin{code}
133 lIVENESS_R1     = (LIVENESS_R1 :: Int)
134 lIVENESS_R2     = (LIVENESS_R2 :: Int)
135 lIVENESS_R3     = (LIVENESS_R3 :: Int)
136 lIVENESS_R4     = (LIVENESS_R4 :: Int)
137 lIVENESS_R5     = (LIVENESS_R5 :: Int)
138 lIVENESS_R6     = (LIVENESS_R6 :: Int)
139 lIVENESS_R7     = (LIVENESS_R7 :: Int)
140 lIVENESS_R8     = (LIVENESS_R8 :: Int)
141 \end{code}
142
143 \begin{code}
144 mIN_INTLIKE, mAX_INTLIKE :: Integer     -- Only used to compare with (MachInt Integer)
145 mIN_INTLIKE = MIN_INTLIKE
146 mAX_INTLIKE = MAX_INTLIKE
147 \end{code}
148
149 \begin{code}
150 -- THESE ARE DIRECTION SENSITIVE!
151 spARelToInt (SpARel spA off) = spA - off -- equiv to: AREL(spA - off)
152 spBRelToInt (SpBRel spB off) = off - spB -- equiv to: BREL(spB - off)
153 \end{code}
154
155 A section of code-generator-related MAGIC CONSTANTS.
156 \begin{code}
157 mAX_FAMILY_SIZE_FOR_VEC_RETURNS = (MAX_VECTORED_RTN::Int)  -- pretty arbitrary
158 -- If you change this, you may need to change runtimes/standard/Update.lhc
159
160 -- The update frame sizes
161 sTD_UF_SIZE     = (NOSCC_STD_UF_SIZE::Int)
162 cON_UF_SIZE     = (NOSCC_CON_UF_SIZE::Int)
163
164 -- Same again, with profiling
165 sCC_STD_UF_SIZE = (SCC_STD_UF_SIZE::Int)
166 sCC_CON_UF_SIZE = (SCC_CON_UF_SIZE::Int)
167
168 -- Offsets in an update frame.  They don't change with profiling!
169 uF_RET = (UF_RET::Int)
170 uF_SUB = (UF_SUB::Int)
171 uF_SUA = (UF_SUA::Int)
172 uF_UPDATEE = (UF_UPDATEE::Int)
173 uF_COST_CENTRE = (UF_COST_CENTRE::Int)
174 \end{code}
175
176 \begin{code}
177 #ifndef DPH
178 mAX_Vanilla_REG = (MAX_VANILLA_REG :: Int)
179 mAX_Float_REG   = (MAX_FLOAT_REG :: Int)
180 mAX_Double_REG  = (MAX_DOUBLE_REG :: Int)
181 #else
182 -- The DAP has only got 14 registers :-( After various heap and stack 
183 -- pointers we dont have that many left over..
184 mAX_Vanilla_REG = (4 :: Int)    -- Ptr, Int, Char, Float        
185 mAX_Data_REG    = (4 :: Int)    --      Int, Char, Float, Double
186 mAX_Float_REG   = error "mAX_Float_REG : not used in DPH"
187 mAX_Double_REG  = error "mAX_Double_REG: not used in DPH"
188 #endif {- Data Parallel Haskell -}
189 \end{code}