OLD | NEW |
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_COMPILER_H_ | 5 #ifndef VM_FLOW_GRAPH_COMPILER_H_ |
6 #define VM_FLOW_GRAPH_COMPILER_H_ | 6 #define VM_FLOW_GRAPH_COMPILER_H_ |
7 | 7 |
8 #include "vm/allocation.h" | 8 #include "vm/allocation.h" |
9 #include "vm/assembler.h" | 9 #include "vm/assembler.h" |
10 #include "vm/code_descriptors.h" | 10 #include "vm/code_descriptors.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 | 24 |
25 | 25 |
26 class ParallelMoveResolver : public ValueObject { | 26 class ParallelMoveResolver : public ValueObject { |
27 public: | 27 public: |
28 explicit ParallelMoveResolver(FlowGraphCompiler* compiler); | 28 explicit ParallelMoveResolver(FlowGraphCompiler* compiler); |
29 | 29 |
30 // Resolve a set of parallel moves, emitting assembler instructions. | 30 // Resolve a set of parallel moves, emitting assembler instructions. |
31 void EmitNativeCode(ParallelMoveInstr* parallel_move); | 31 void EmitNativeCode(ParallelMoveInstr* parallel_move); |
32 | 32 |
33 private: | 33 private: |
| 34 class ScratchFpuRegisterScope : public ValueObject { |
| 35 public: |
| 36 ScratchFpuRegisterScope(ParallelMoveResolver* resolver, |
| 37 FpuRegister blocked); |
| 38 ~ScratchFpuRegisterScope(); |
| 39 |
| 40 FpuRegister reg() const { return reg_; } |
| 41 |
| 42 private: |
| 43 ParallelMoveResolver* resolver_; |
| 44 FpuRegister reg_; |
| 45 bool spilled_; |
| 46 }; |
| 47 |
| 48 class ScratchRegisterScope : public ValueObject { |
| 49 public: |
| 50 ScratchRegisterScope(ParallelMoveResolver* resolver, Register blocked); |
| 51 ~ScratchRegisterScope(); |
| 52 |
| 53 Register reg() const { return reg_; } |
| 54 |
| 55 private: |
| 56 ParallelMoveResolver* resolver_; |
| 57 Register reg_; |
| 58 bool spilled_; |
| 59 }; |
| 60 |
| 61 |
| 62 bool IsScratchLocation(Location loc); |
| 63 intptr_t AllocateScratchRegister(Location::Kind kind, |
| 64 intptr_t blocked, |
| 65 intptr_t register_count, |
| 66 bool* spilled); |
| 67 |
| 68 void SpillScratch(Register reg); |
| 69 void RestoreScratch(Register reg); |
| 70 void SpillFpuScratch(FpuRegister reg); |
| 71 void RestoreFpuScratch(FpuRegister reg); |
| 72 |
| 73 // friend class ScratchXmmRegisterScope; |
| 74 |
34 // Build the initial list of moves. | 75 // Build the initial list of moves. |
35 void BuildInitialMoveList(ParallelMoveInstr* parallel_move); | 76 void BuildInitialMoveList(ParallelMoveInstr* parallel_move); |
36 | 77 |
37 // Perform the move at the moves_ index in question (possibly requiring | 78 // Perform the move at the moves_ index in question (possibly requiring |
38 // other moves to satisfy dependencies). | 79 // other moves to satisfy dependencies). |
39 void PerformMove(int index); | 80 void PerformMove(int index); |
40 | 81 |
41 // Emit a move and remove it from the move graph. | 82 // Emit a move and remove it from the move graph. |
42 void EmitMove(int index); | 83 void EmitMove(int index); |
43 | 84 |
(...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
547 // that should be used when deoptimizing we store it in this variable. | 588 // that should be used when deoptimizing we store it in this variable. |
548 // In future AddDeoptStub should be moved out of the instruction template. | 589 // In future AddDeoptStub should be moved out of the instruction template. |
549 Environment* pending_deoptimization_env_; | 590 Environment* pending_deoptimization_env_; |
550 | 591 |
551 DISALLOW_COPY_AND_ASSIGN(FlowGraphCompiler); | 592 DISALLOW_COPY_AND_ASSIGN(FlowGraphCompiler); |
552 }; | 593 }; |
553 | 594 |
554 } // namespace dart | 595 } // namespace dart |
555 | 596 |
556 #endif // VM_FLOW_GRAPH_COMPILER_H_ | 597 #endif // VM_FLOW_GRAPH_COMPILER_H_ |
OLD | NEW |