Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(439)

Side by Side Diff: runtime/vm/flow_graph_allocator.h

Issue 10806099: Some cleanups. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | runtime/vm/flow_graph_allocator.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #ifndef VM_FLOW_GRAPH_ALLOCATOR_H_ 5 #ifndef VM_FLOW_GRAPH_ALLOCATOR_H_
6 #define VM_FLOW_GRAPH_ALLOCATOR_H_ 6 #define VM_FLOW_GRAPH_ALLOCATOR_H_
7 7
8 #include "vm/growable_array.h" 8 #include "vm/growable_array.h"
9 #include "vm/intermediate_language.h" 9 #include "vm/intermediate_language.h"
10 10
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 bool blocked_cpu_regs_[kNumberOfCpuRegisters]; 194 bool blocked_cpu_regs_[kNumberOfCpuRegisters];
195 195
196 DISALLOW_COPY_AND_ASSIGN(FlowGraphAllocator); 196 DISALLOW_COPY_AND_ASSIGN(FlowGraphAllocator);
197 }; 197 };
198 198
199 199
200 // UsePosition represents a single use of an SSA value by some instruction. 200 // UsePosition represents a single use of an SSA value by some instruction.
201 // It points to a location slot which either tells register allocator 201 // It points to a location slot which either tells register allocator
202 // where instruction expects the value (if slot contains a fixed location) or 202 // where instruction expects the value (if slot contains a fixed location) or
203 // asks register allocator to allocate storage (register or spill slot) for 203 // asks register allocator to allocate storage (register or spill slot) for
204 // this use with certain properties (if slot contain an unallocated location). 204 // this use with certain properties (if slot contains an unallocated location).
205 class UsePosition : public ZoneAllocated { 205 class UsePosition : public ZoneAllocated {
206 public: 206 public:
207 UsePosition(intptr_t pos, 207 UsePosition(intptr_t pos, UsePosition* next, Location* location_slot)
208 UsePosition* next, 208 : pos_(pos), location_slot_(location_slot), next_(next) { }
209 Location* location_slot)
210 : pos_(pos),
211 location_slot_(location_slot),
212 next_(next) {
213 }
214 209
215 Location* location_slot() const { return location_slot_; } 210 Location* location_slot() const { return location_slot_; }
216 void set_location_slot(Location* location_slot) { 211 void set_location_slot(Location* location_slot) {
217 location_slot_ = location_slot; 212 location_slot_ = location_slot;
218 } 213 }
219 214
220 void set_next(UsePosition* next) { next_ = next; } 215 void set_next(UsePosition* next) { next_ = next; }
221 UsePosition* next() const { return next_; } 216 UsePosition* next() const { return next_; }
222 217
223 intptr_t pos() const { return pos_; } 218 intptr_t pos() const { return pos_; }
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 272
278 DISALLOW_COPY_AND_ASSIGN(UseInterval); 273 DISALLOW_COPY_AND_ASSIGN(UseInterval);
279 }; 274 };
280 275
281 276
282 // AllocationFinger is used to keep track of currently active position 277 // AllocationFinger is used to keep track of currently active position
283 // for the register allocator and cache lookup results. 278 // for the register allocator and cache lookup results.
284 class AllocationFinger : public ValueObject { 279 class AllocationFinger : public ValueObject {
285 public: 280 public:
286 AllocationFinger() 281 AllocationFinger()
287 : first_pending_use_interval_(NULL), 282 : first_pending_use_interval_(NULL),
288 first_register_use_(NULL), 283 first_register_use_(NULL),
289 first_register_beneficial_use_(NULL), 284 first_register_beneficial_use_(NULL),
290 first_hinted_use_(NULL) { 285 first_hinted_use_(NULL) {
291 } 286 }
292 287
293 void Initialize(LiveRange* range); 288 void Initialize(LiveRange* range);
294 bool Advance(intptr_t start); 289 bool Advance(intptr_t start);
295 290
296 UseInterval* first_pending_use_interval() const { 291 UseInterval* first_pending_use_interval() const {
297 return first_pending_use_interval_; 292 return first_pending_use_interval_;
298 } 293 }
299 294
300 Location FirstHint(); 295 Location FirstHint();
301 UsePosition* FirstRegisterUse(intptr_t after_pos); 296 UsePosition* FirstRegisterUse(intptr_t after_pos);
302 UsePosition* FirstRegisterBeneficialUse(intptr_t after_pos); 297 UsePosition* FirstRegisterBeneficialUse(intptr_t after_pos);
303 298
304 private: 299 private:
305 UseInterval* first_pending_use_interval_; 300 UseInterval* first_pending_use_interval_;
306 UsePosition* first_register_use_; 301 UsePosition* first_register_use_;
307 UsePosition* first_register_beneficial_use_; 302 UsePosition* first_register_beneficial_use_;
308 UsePosition* first_hinted_use_; 303 UsePosition* first_hinted_use_;
309 304
310 DISALLOW_COPY_AND_ASSIGN(AllocationFinger); 305 DISALLOW_COPY_AND_ASSIGN(AllocationFinger);
311 }; 306 };
312 307
313 308
314 // LiveRange represents a sequence of UseIntervals for a given SSA value. 309 // LiveRange represents a sequence of UseIntervals for a given SSA value.
315 class LiveRange : public ZoneAllocated { 310 class LiveRange : public ZoneAllocated {
316 public: 311 public:
317 explicit LiveRange(intptr_t vreg) 312 explicit LiveRange(intptr_t vreg)
318 : vreg_(vreg), 313 : vreg_(vreg),
314 assigned_location_(),
319 uses_(NULL), 315 uses_(NULL),
320 first_use_interval_(NULL), 316 first_use_interval_(NULL),
321 last_use_interval_(NULL), 317 last_use_interval_(NULL),
322 next_sibling_(NULL), 318 next_sibling_(NULL),
323 finger_() { 319 finger_() {}
hausner 2012/07/24 23:53:47 I actually like the old formatting better, but it'
srdjan 2012/07/24 23:57:16 Changed it to old formatting.
324 }
325 320
326 static LiveRange* MakeTemp(intptr_t pos, Location* location_slot); 321 static LiveRange* MakeTemp(intptr_t pos, Location* location_slot);
327 322
328 intptr_t vreg() const { return vreg_; } 323 intptr_t vreg() const { return vreg_; }
329 LiveRange* next_sibling() const { return next_sibling_; } 324 LiveRange* next_sibling() const { return next_sibling_; }
330 UsePosition* first_use() const { return uses_; } 325 UsePosition* first_use() const { return uses_; }
331 void set_first_use(UsePosition* use) { uses_ = use; } 326 void set_first_use(UsePosition* use) { uses_ = use; }
332 UseInterval* first_use_interval() const { return first_use_interval_; } 327 UseInterval* first_use_interval() const { return first_use_interval_; }
333 UseInterval* last_use_interval() const { return last_use_interval_; } 328 UseInterval* last_use_interval() const { return last_use_interval_; }
334 Location assigned_location() const { return assigned_location_; } 329 Location assigned_location() const { return assigned_location_; }
(...skipping 21 matching lines...) Expand all
356 return (Start() <= pos) && (pos < End()); 351 return (Start() <= pos) && (pos < End());
357 } 352 }
358 353
359 private: 354 private:
360 LiveRange(intptr_t vreg, 355 LiveRange(intptr_t vreg,
361 UsePosition* uses, 356 UsePosition* uses,
362 UseInterval* first_use_interval, 357 UseInterval* first_use_interval,
363 UseInterval* last_use_interval, 358 UseInterval* last_use_interval,
364 LiveRange* next_sibling) 359 LiveRange* next_sibling)
365 : vreg_(vreg), 360 : vreg_(vreg),
361 assigned_location_(),
366 uses_(uses), 362 uses_(uses),
367 first_use_interval_(first_use_interval), 363 first_use_interval_(first_use_interval),
368 last_use_interval_(last_use_interval), 364 last_use_interval_(last_use_interval),
369 next_sibling_(next_sibling), 365 next_sibling_(next_sibling),
370 finger_() { 366 finger_() {
371 } 367 }
372 368
373 const intptr_t vreg_; 369 const intptr_t vreg_;
374 Location assigned_location_; 370 Location assigned_location_;
375 371
376 UsePosition* uses_; 372 UsePosition* uses_;
377 UseInterval* first_use_interval_; 373 UseInterval* first_use_interval_;
378 UseInterval* last_use_interval_; 374 UseInterval* last_use_interval_;
379 375
380 LiveRange* next_sibling_; 376 LiveRange* next_sibling_;
381 377
382 AllocationFinger finger_; 378 AllocationFinger finger_;
383 379
384 DISALLOW_COPY_AND_ASSIGN(LiveRange); 380 DISALLOW_COPY_AND_ASSIGN(LiveRange);
385 }; 381 };
386 382
387 383
388 } // namespace dart 384 } // namespace dart
389 385
390 #endif // VM_FLOW_GRAPH_ALLOCATOR_H_ 386 #endif // VM_FLOW_GRAPH_ALLOCATOR_H_
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/flow_graph_allocator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698