OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 // Declares a Simulator for MIPS instructions if we are not generating a native | 5 // Declares a Simulator for MIPS instructions if we are not generating a native |
6 // MIPS binary. This Simulator allows us to run and debug MIPS code generation | 6 // MIPS binary. This Simulator allows us to run and debug MIPS code generation |
7 // on regular desktop machines. | 7 // on regular desktop machines. |
8 // Dart calls into generated code by "calling" the InvokeDartCode stub, | 8 // Dart calls into generated code by "calling" the InvokeDartCode stub, |
9 // which will start execution in the Simulator or forwards to the real entry | 9 // which will start execution in the Simulator or forwards to the real entry |
10 // on a MIPS HW platform. | 10 // on a MIPS HW platform. |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 void set_fregister(FRegister freg, int32_t value); | 43 void set_fregister(FRegister freg, int32_t value); |
44 void set_fregister_float(FRegister freg, float value); | 44 void set_fregister_float(FRegister freg, float value); |
45 void set_fregister_double(FRegister freg, double value); | 45 void set_fregister_double(FRegister freg, double value); |
46 void set_fregister_long(FRegister freg, int64_t value); | 46 void set_fregister_long(FRegister freg, int64_t value); |
47 | 47 |
48 int32_t get_fregister(FRegister freg) const; | 48 int32_t get_fregister(FRegister freg) const; |
49 float get_fregister_float(FRegister freg) const; | 49 float get_fregister_float(FRegister freg) const; |
50 double get_fregister_double(FRegister freg) const; | 50 double get_fregister_double(FRegister freg) const; |
51 int64_t get_fregister_long(FRegister freg) const; | 51 int64_t get_fregister_long(FRegister freg) const; |
52 | 52 |
| 53 void set_dregister_bits(DRegister freg, int64_t value); |
| 54 void set_dregister(DRegister freg, double value); |
| 55 |
| 56 int64_t get_dregister_bits(DRegister freg) const; |
| 57 double get_dregister(DRegister freg) const; |
53 | 58 |
54 // Accessor for the pc. | 59 // Accessor for the pc. |
55 void set_pc(int32_t value) { pc_ = value; } | 60 void set_pc(int32_t value) { pc_ = value; } |
56 int32_t get_pc() const { return pc_; } | 61 int32_t get_pc() const { return pc_; } |
57 | 62 |
58 // Accessors for hi, lo registers. | 63 // Accessors for hi, lo registers. |
59 void set_hi_register(int32_t value) { hi_reg_ = value; } | 64 void set_hi_register(int32_t value) { hi_reg_ = value; } |
60 void set_lo_register(int32_t value) { lo_reg_ = value; } | 65 void set_lo_register(int32_t value) { lo_reg_ = value; } |
61 int32_t get_hi_register() const { return hi_reg_; } | 66 int32_t get_hi_register() const { return hi_reg_; } |
62 int32_t get_lo_register() const { return lo_reg_; } | 67 int32_t get_lo_register() const { return lo_reg_; } |
(...skipping 25 matching lines...) Expand all Loading... |
88 // stack. The simulator's top_exit_frame_info refers to a C++ frame in the | 93 // stack. The simulator's top_exit_frame_info refers to a C++ frame in the |
89 // native stack. | 94 // native stack. |
90 uword top_exit_frame_info() const { return top_exit_frame_info_; } | 95 uword top_exit_frame_info() const { return top_exit_frame_info_; } |
91 void set_top_exit_frame_info(uword value) { top_exit_frame_info_ = value; } | 96 void set_top_exit_frame_info(uword value) { top_exit_frame_info_ = value; } |
92 | 97 |
93 // Call on program start. | 98 // Call on program start. |
94 static void InitOnce(); | 99 static void InitOnce(); |
95 | 100 |
96 // Dart generally calls into generated code with 5 parameters. This is a | 101 // Dart generally calls into generated code with 5 parameters. This is a |
97 // convenience function, which sets up the simulator state and grabs the | 102 // convenience function, which sets up the simulator state and grabs the |
98 // result on return. | 103 // result on return. When fp_return is true the return value is the D0 |
| 104 // floating point register. Otherwise, the return value is V1:V0. |
99 int64_t Call(int32_t entry, | 105 int64_t Call(int32_t entry, |
100 int32_t parameter0, | 106 int32_t parameter0, |
101 int32_t parameter1, | 107 int32_t parameter1, |
102 int32_t parameter2, | 108 int32_t parameter2, |
103 int32_t parameter3); | 109 int32_t parameter3, |
| 110 bool fp_return = false); |
104 | 111 |
105 // Runtime and native call support. | 112 // Runtime and native call support. |
106 enum CallKind { | 113 enum CallKind { |
107 kRuntimeCall, | 114 kRuntimeCall, |
108 kLeafRuntimeCall, | 115 kLeafRuntimeCall, |
109 kLeafFloatRuntimeCall, | 116 kLeafFloatRuntimeCall, |
110 kNativeCall | 117 kNativeCall |
111 }; | 118 }; |
112 static uword RedirectExternalReference(uword function, | 119 static uword RedirectExternalReference(uword function, |
113 CallKind call_kind, | 120 CallKind call_kind, |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 } | 208 } |
202 | 209 |
203 friend class SimulatorDebugger; | 210 friend class SimulatorDebugger; |
204 friend class SimulatorSetjmpBuffer; | 211 friend class SimulatorSetjmpBuffer; |
205 DISALLOW_COPY_AND_ASSIGN(Simulator); | 212 DISALLOW_COPY_AND_ASSIGN(Simulator); |
206 }; | 213 }; |
207 | 214 |
208 } // namespace dart | 215 } // namespace dart |
209 | 216 |
210 #endif // VM_SIMULATOR_MIPS_H_ | 217 #endif // VM_SIMULATOR_MIPS_H_ |
OLD | NEW |