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

Side by Side Diff: src/compiler/register-allocator.h

Issue 738853002: [turbofan]: delay ssa deconstruction in register allocator (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 6 years, 1 month 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
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef V8_REGISTER_ALLOCATOR_H_ 5 #ifndef V8_REGISTER_ALLOCATOR_H_
6 #define V8_REGISTER_ALLOCATOR_H_ 6 #define V8_REGISTER_ALLOCATOR_H_
7 7
8 #include "src/compiler/instruction.h" 8 #include "src/compiler/instruction.h"
9 #include "src/zone-containers.h" 9 #include "src/zone-containers.h"
10 10
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 const ZoneVector<LiveRange*>& fixed_double_live_ranges() const { 334 const ZoneVector<LiveRange*>& fixed_double_live_ranges() const {
335 return fixed_double_live_ranges_; 335 return fixed_double_live_ranges_;
336 } 336 }
337 InstructionSequence* code() const { return code_; } 337 InstructionSequence* code() const { return code_; }
338 // This zone is for datastructures only needed during register allocation. 338 // This zone is for datastructures only needed during register allocation.
339 Zone* local_zone() const { return local_zone_; } 339 Zone* local_zone() const { return local_zone_; }
340 340
341 // Phase 1 : insert moves to account for fixed register operands. 341 // Phase 1 : insert moves to account for fixed register operands.
342 void MeetRegisterConstraints(); 342 void MeetRegisterConstraints();
343 343
344 // Phase 2: deconstruct SSA by inserting moves in successors and the headers 344 // Phase 2: compute liveness of all virtual register.
345 // of blocks containing phis.
346 void ResolvePhis();
347
348 // Phase 3: compute liveness of all virtual register.
349 void BuildLiveRanges(); 345 void BuildLiveRanges();
350 bool ExistsUseWithoutDefinition(); 346 bool ExistsUseWithoutDefinition();
351 347
352 // Phase 4: compute register assignments. 348 // Phase 3: compute register assignments.
353 void AllocateGeneralRegisters(); 349 void AllocateGeneralRegisters();
354 void AllocateDoubleRegisters(); 350 void AllocateDoubleRegisters();
355 351
356 // Phase 5: compute values for pointer maps. 352 // Phase 4: compute values for pointer maps.
357 void PopulatePointerMaps(); // TODO(titzer): rename to PopulateReferenceMaps. 353 void PopulatePointerMaps(); // TODO(titzer): rename to PopulateReferenceMaps.
358 354
359 // Phase 6: reconnect split ranges with moves. 355 // Phase 5: reconnect split ranges with moves.
360 void ConnectRanges(); 356 void ConnectRanges();
361 357
362 // Phase 7: insert moves to connect ranges across basic blocks. 358 // Phase 6: insert moves to connect ranges across basic blocks.
363 void ResolveControlFlow(); 359 void ResolveControlFlow();
364 360
365 private: 361 private:
366 int GetVirtualRegister() { 362 int GetVirtualRegister() {
367 int vreg = code()->NextVirtualRegister(); 363 int vreg = code()->NextVirtualRegister();
368 if (vreg >= UnallocatedOperand::kMaxVirtualRegisters) { 364 if (vreg >= UnallocatedOperand::kMaxVirtualRegisters) {
369 allocation_ok_ = false; 365 allocation_ok_ = false;
370 // Maintain the invariant that we return something below the maximum. 366 // Maintain the invariant that we return something below the maximum.
371 return 0; 367 return 0;
372 } 368 }
(...skipping 27 matching lines...) Expand all
400 BitVector* ComputeLiveOut(const InstructionBlock* block); 396 BitVector* ComputeLiveOut(const InstructionBlock* block);
401 void AddInitialIntervals(const InstructionBlock* block, BitVector* live_out); 397 void AddInitialIntervals(const InstructionBlock* block, BitVector* live_out);
402 bool IsOutputRegisterOf(Instruction* instr, int index); 398 bool IsOutputRegisterOf(Instruction* instr, int index);
403 bool IsOutputDoubleRegisterOf(Instruction* instr, int index); 399 bool IsOutputDoubleRegisterOf(Instruction* instr, int index);
404 void ProcessInstructions(const InstructionBlock* block, BitVector* live); 400 void ProcessInstructions(const InstructionBlock* block, BitVector* live);
405 void MeetRegisterConstraints(const InstructionBlock* block); 401 void MeetRegisterConstraints(const InstructionBlock* block);
406 void MeetConstraintsBetween(Instruction* first, Instruction* second, 402 void MeetConstraintsBetween(Instruction* first, Instruction* second,
407 int gap_index); 403 int gap_index);
408 void MeetRegisterConstraintsForLastInstructionInBlock( 404 void MeetRegisterConstraintsForLastInstructionInBlock(
409 const InstructionBlock* block); 405 const InstructionBlock* block);
410 void ResolvePhis(const InstructionBlock* block); 406 void ProcessPhis(const InstructionBlock* block);
411 407
412 // Helper methods for building intervals. 408 // Helper methods for building intervals.
413 InstructionOperand* AllocateFixed(UnallocatedOperand* operand, int pos, 409 InstructionOperand* AllocateFixed(UnallocatedOperand* operand, int pos,
414 bool is_tagged); 410 bool is_tagged);
415 LiveRange* LiveRangeFor(InstructionOperand* operand); 411 LiveRange* LiveRangeFor(InstructionOperand* operand);
416 void Define(LifetimePosition position, InstructionOperand* operand, 412 void Define(LifetimePosition position, InstructionOperand* operand,
417 InstructionOperand* hint); 413 InstructionOperand* hint);
418 void Use(LifetimePosition block_start, LifetimePosition position, 414 void Use(LifetimePosition block_start, LifetimePosition position,
419 InstructionOperand* operand, InstructionOperand* hint); 415 InstructionOperand* operand, InstructionOperand* hint);
420 void AddConstraintsGapMove(int index, InstructionOperand* from, 416 void AddConstraintsGapMove(int index, InstructionOperand* from,
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
548 #endif 544 #endif
549 545
550 DISALLOW_COPY_AND_ASSIGN(RegisterAllocator); 546 DISALLOW_COPY_AND_ASSIGN(RegisterAllocator);
551 }; 547 };
552 548
553 } 549 }
554 } 550 }
555 } // namespace v8::internal::compiler 551 } // namespace v8::internal::compiler
556 552
557 #endif // V8_REGISTER_ALLOCATOR_H_ 553 #endif // V8_REGISTER_ALLOCATOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698