@@ -135,72 +135,54 @@ type fn_ty_param = {desc: ValueRef, dicts: option<[ValueRef]>};
135
135
136
136
// Function context. Every LLVM function we create will have one of
137
137
// these.
138
- type fn_ctxt =
138
+ type fn_ctxt = {
139
139
// The ValueRef returned from a call to llvm::LLVMAddFunction; the
140
140
// address of the first instruction in the sequence of
141
141
// instructions for this function that will go in the .text
142
142
// section of the executable we're generating.
143
+ llfn : ValueRef ,
143
144
144
- // The three implicit arguments that arrive in the function we're
145
- // creating. For instance, foo(int, int) is really foo(ret*,
146
- // task*, env*, int, int). These are also available via
147
- // llvm::LLVMGetParam(llfn, uint) where uint = 1, 2, 0
148
- // respectively, but we unpack them into these fields for
149
- // convenience.
145
+ // The two implicit arguments that arrive in the function we're creating.
146
+ // For instance, foo(int, int) is really foo(ret*, env*, int, int).
147
+ llenv : ValueRef ,
148
+ llretptr : ValueRef ,
150
149
151
- // Points to the current task.
152
-
153
- // Points to the current environment (bindings of variables to
154
- // values), if this is a regular function
155
-
156
- // Points to where the return value of this function should end
157
- // up.
158
-
159
- // The next three elements: "hoisted basic blocks" containing
150
+ // These elements: "hoisted basic blocks" containing
160
151
// administrative activities that have to happen in only one place in
161
152
// the function, due to LLVM's quirks.
162
-
163
153
// A block for all the function's static allocas, so that LLVM
164
154
// will coalesce them into a single alloca call.
165
-
155
+ mutable llstaticallocas : BasicBlockRef ,
166
156
// A block containing code that copies incoming arguments to space
167
157
// already allocated by code in one of the llallocas blocks.
168
158
// (LLVM requires that arguments be copied to local allocas before
169
159
// allowing most any operation to be performed on them.)
170
-
171
- // The first block containing derived tydescs received from the
172
- // runtime. See description of derived_tydescs, below.
173
-
174
- // The last block of the llderivedtydescs group.
175
-
160
+ mutable llloadenv: BasicBlockRef ,
161
+ // The first and last block containing derived tydescs received from the
162
+ // runtime. See description of derived_tydescs, below.
163
+ mutable llderivedtydescs_first: BasicBlockRef ,
164
+ mutable llderivedtydescs: BasicBlockRef ,
176
165
// A block for all of the dynamically sized allocas. This must be
177
166
// after llderivedtydescs, because these sometimes depend on
178
167
// information computed from derived tydescs.
179
-
168
+ mutable lldynamicallocas: BasicBlockRef ,
169
+ mutable llreturn: BasicBlockRef ,
180
170
// The token used to clear the dynamic allocas at the end of this frame.
181
-
171
+ mutable llobstacktoken : option < ValueRef > ,
182
172
// The 'self' value currently in use in this function, if there
183
173
// is one.
184
-
185
- // If this function is actually a iter, a block containing the
186
- // code called whenever the iter calls 'put'.
187
-
188
- // The next four items: hash tables mapping from AST def_ids to
189
- // LLVM-stuff-in-the-frame.
174
+ mutable llself: option< val_self_pair > ,
190
175
191
176
// Maps arguments to allocas created for them in llallocas.
192
-
177
+ llargs : hashmap < ast :: node_id , local_val > ,
193
178
// Maps the def_ids for local variables to the allocas created for
194
179
// them in llallocas.
180
+ lllocals : hashmap < ast:: node_id , local_val > ,
181
+ // Same as above, but for closure upvars
182
+ llupvars : hashmap < ast:: node_id , ValueRef > ,
195
183
196
- // The same as above, but for variables accessed via the frame
197
- // pointer we pass into an iter, for access to the static
198
- // environment of the iter-calling frame.
199
-
200
- // For convenience, a vector of the incoming tydescs for each of
201
- // this functions type parameters, fetched via llvm::LLVMGetParam.
202
- // For example, for a function foo::<A, B, C>(), lltydescs contains
203
- // the ValueRefs for the tydescs for A, B, and C.
184
+ // A vector of incoming type descriptors and their associated iface dicts.
185
+ mutable lltyparams: [ fn_ty_param ] ,
204
186
205
187
// Derived tydescs are tydescs created at runtime, for types that
206
188
// involve type parameters inside type constructors. For example,
@@ -211,35 +193,24 @@ type fn_ctxt =
211
193
// when information about both "[T]" and "T" are available. When
212
194
// such a tydesc is created, we cache it in the derived_tydescs
213
195
// table for the next time that such a tydesc is needed.
196
+ derived_tydescs : hashmap < ty:: t , derived_tydesc_info > ,
214
197
215
198
// The node_id of the function, or -1 if it doesn't correspond to
216
199
// a user-defined function.
200
+ id : ast:: node_id ,
201
+
202
+ // If this function is being monomorphized, this contains the type
203
+ // substitutions used.
204
+ param_substs : option < [ ty:: t ] > ,
205
+
206
+ // The source span and nesting context where this function comes from, for
207
+ // error reporting and symbol generation.
208
+ span : option < span > ,
209
+ path: path,
217
210
218
- // The source span where this function comes from, for error
219
- // reporting.
220
-
221
- // This function's enclosing local context.
222
- { llfn : ValueRef ,
223
- llenv : ValueRef ,
224
- llretptr : ValueRef ,
225
- mutable llstaticallocas: BasicBlockRef ,
226
- mutable llloadenv: BasicBlockRef ,
227
- mutable llderivedtydescs_first: BasicBlockRef ,
228
- mutable llderivedtydescs: BasicBlockRef ,
229
- mutable lldynamicallocas: BasicBlockRef ,
230
- mutable llreturn: BasicBlockRef ,
231
- mutable llobstacktoken: option < ValueRef > ,
232
- mutable llself: option < val_self_pair > ,
233
- llargs : hashmap < ast:: node_id , local_val > ,
234
- lllocals : hashmap < ast:: node_id , local_val > ,
235
- llupvars : hashmap < ast:: node_id , ValueRef > ,
236
- mutable lltyparams: [ fn_ty_param ] ,
237
- derived_tydescs : hashmap < ty:: t , derived_tydesc_info > ,
238
- id : ast:: node_id ,
239
- param_substs : option < [ ty:: t ] > ,
240
- span : option < span > ,
241
- path: path,
242
- ccx : @crate_ctxt } ;
211
+ // This function's enclosing crate context.
212
+ ccx : @crate_ctxt
213
+ } ;
243
214
244
215
fn warn_not_to_commit ( ccx : @crate_ctxt , msg : str ) {
245
216
if !ccx. do_not_commit_warning_issued {
0 commit comments