| OLD | NEW |
| 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 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 312 int spill_start_index_; | 312 int spill_start_index_; |
| 313 | 313 |
| 314 friend class RegisterAllocator; // Assigns to kind_. | 314 friend class RegisterAllocator; // Assigns to kind_. |
| 315 | 315 |
| 316 DISALLOW_COPY_AND_ASSIGN(LiveRange); | 316 DISALLOW_COPY_AND_ASSIGN(LiveRange); |
| 317 }; | 317 }; |
| 318 | 318 |
| 319 | 319 |
| 320 class RegisterAllocator FINAL { | 320 class RegisterAllocator FINAL { |
| 321 public: | 321 public: |
| 322 class Config { | 322 explicit RegisterAllocator(const RegisterConfiguration* config, |
| 323 public: | 323 Zone* local_zone, Frame* frame, |
| 324 int num_general_registers_; | 324 InstructionSequence* code, |
| 325 int num_double_registers_; | |
| 326 int num_aliased_double_registers_; | |
| 327 const char* (*GeneralRegisterName)(int allocation_index); | |
| 328 const char* (*DoubleRegisterName)(int allocation_index); | |
| 329 }; | |
| 330 | |
| 331 static Config PlatformConfig(); | |
| 332 | |
| 333 explicit RegisterAllocator(const Config& config, Zone* local_zone, | |
| 334 Frame* frame, InstructionSequence* code, | |
| 335 const char* debug_name = nullptr); | 325 const char* debug_name = nullptr); |
| 336 | 326 |
| 337 bool Allocate(PipelineStatistics* stats = NULL); | 327 bool Allocate(PipelineStatistics* stats = NULL); |
| 338 bool AllocationOk() { return allocation_ok_; } | 328 bool AllocationOk() { return allocation_ok_; } |
| 339 BitVector* assigned_registers() { return assigned_registers_; } | 329 BitVector* assigned_registers() { return assigned_registers_; } |
| 340 BitVector* assigned_double_registers() { return assigned_double_registers_; } | 330 BitVector* assigned_double_registers() { return assigned_double_registers_; } |
| 341 | 331 |
| 342 const ZoneList<LiveRange*>& live_ranges() const { return live_ranges_; } | 332 const ZoneList<LiveRange*>& live_ranges() const { return live_ranges_; } |
| 343 const ZoneVector<LiveRange*>& fixed_live_ranges() const { | 333 const ZoneVector<LiveRange*>& fixed_live_ranges() const { |
| 344 return fixed_live_ranges_; | 334 return fixed_live_ranges_; |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 495 LiveRange* FixedDoubleLiveRangeFor(int index); | 485 LiveRange* FixedDoubleLiveRangeFor(int index); |
| 496 LiveRange* LiveRangeFor(int index); | 486 LiveRange* LiveRangeFor(int index); |
| 497 GapInstruction* GetLastGap(const InstructionBlock* block); | 487 GapInstruction* GetLastGap(const InstructionBlock* block); |
| 498 | 488 |
| 499 const char* RegisterName(int allocation_index); | 489 const char* RegisterName(int allocation_index); |
| 500 | 490 |
| 501 Instruction* InstructionAt(int index) { return code()->InstructionAt(index); } | 491 Instruction* InstructionAt(int index) { return code()->InstructionAt(index); } |
| 502 | 492 |
| 503 Frame* frame() const { return frame_; } | 493 Frame* frame() const { return frame_; } |
| 504 const char* debug_name() const { return debug_name_; } | 494 const char* debug_name() const { return debug_name_; } |
| 505 const Config& config() const { return config_; } | 495 const RegisterConfiguration* config() const { return config_; } |
| 506 | 496 |
| 507 Zone* const zone_; | 497 Zone* const zone_; |
| 508 Frame* const frame_; | 498 Frame* const frame_; |
| 509 InstructionSequence* const code_; | 499 InstructionSequence* const code_; |
| 510 const char* const debug_name_; | 500 const char* const debug_name_; |
| 511 | 501 |
| 512 const Config config_; | 502 const RegisterConfiguration* config_; |
| 513 | 503 |
| 514 // During liveness analysis keep a mapping from block id to live_in sets | 504 // During liveness analysis keep a mapping from block id to live_in sets |
| 515 // for blocks already analyzed. | 505 // for blocks already analyzed. |
| 516 ZoneList<BitVector*> live_in_sets_; | 506 ZoneList<BitVector*> live_in_sets_; |
| 517 | 507 |
| 518 // Liveness analysis results. | 508 // Liveness analysis results. |
| 519 ZoneList<LiveRange*> live_ranges_; | 509 ZoneList<LiveRange*> live_ranges_; |
| 520 | 510 |
| 521 // Lists of live ranges | 511 // Lists of live ranges |
| 522 ZoneVector<LiveRange*> fixed_live_ranges_; | 512 ZoneVector<LiveRange*> fixed_live_ranges_; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 540 #endif | 530 #endif |
| 541 | 531 |
| 542 DISALLOW_COPY_AND_ASSIGN(RegisterAllocator); | 532 DISALLOW_COPY_AND_ASSIGN(RegisterAllocator); |
| 543 }; | 533 }; |
| 544 | 534 |
| 545 } | 535 } |
| 546 } | 536 } |
| 547 } // namespace v8::internal::compiler | 537 } // namespace v8::internal::compiler |
| 548 | 538 |
| 549 #endif // V8_REGISTER_ALLOCATOR_H_ | 539 #endif // V8_REGISTER_ALLOCATOR_H_ |
| OLD | NEW |