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_LOCATIONS_H_ | 5 #ifndef VM_LOCATIONS_H_ |
6 #define VM_LOCATIONS_H_ | 6 #define VM_LOCATIONS_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/bitfield.h" | 10 #include "vm/bitfield.h" |
11 | 11 |
12 namespace dart { | 12 namespace dart { |
13 | 13 |
14 class BufferFormatter; | 14 class BufferFormatter; |
| 15 class Value; |
15 | 16 |
16 // Location objects are used to connect register allocator and code generator. | 17 // Location objects are used to connect register allocator and code generator. |
17 // Instruction templates used by code generator have a corresponding | 18 // Instruction templates used by code generator have a corresponding |
18 // LocationSummary object which specifies expected location for every input | 19 // LocationSummary object which specifies expected location for every input |
19 // and output. | 20 // and output. |
20 // Each location is encoded as a single word: for non-constant locations | 21 // Each location is encoded as a single word: for non-constant locations |
21 // low 3 bits denote location kind, rest is kind specific location payload | 22 // low 3 bits denote location kind, rest is kind specific location payload |
22 // e.g. for REGISTER kind payload is register code (value of the Register | 23 // e.g. for REGISTER kind payload is register code (value of the Register |
23 // enumeration), constant locations contain a tagged (low 2 bits are set to 01) | 24 // enumeration), constant locations contain a tagged (low 2 bits are set to 01) |
24 // Object handle | 25 // Object handle |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 return kind() == kDoubleStackSlot; | 223 return kind() == kDoubleStackSlot; |
223 } | 224 } |
224 | 225 |
225 | 226 |
226 intptr_t stack_index() const { | 227 intptr_t stack_index() const { |
227 ASSERT(IsStackSlot() || IsDoubleStackSlot()); | 228 ASSERT(IsStackSlot() || IsDoubleStackSlot()); |
228 // Decode stack index manually to preserve sign. | 229 // Decode stack index manually to preserve sign. |
229 return payload() - kStackIndexBias; | 230 return payload() - kStackIndexBias; |
230 } | 231 } |
231 | 232 |
| 233 // Constants. |
| 234 static Location RegisterOrConstant(Value* value); |
| 235 static Location FixedRegisterOrConstant(Value* value, Register reg); |
| 236 |
232 const char* Name() const; | 237 const char* Name() const; |
233 void PrintTo(BufferFormatter* f) const; | 238 void PrintTo(BufferFormatter* f) const; |
234 void Print() const; | 239 void Print() const; |
235 | 240 |
236 // Compare two locations. | 241 // Compare two locations. |
237 bool Equals(Location other) const { | 242 bool Equals(Location other) const { |
238 return value_ == other.value_; | 243 return value_ == other.value_; |
239 } | 244 } |
240 | 245 |
241 private: | 246 private: |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
405 BitmapBuilder* stack_bitmap_; | 410 BitmapBuilder* stack_bitmap_; |
406 | 411 |
407 const ContainsCall contains_call_; | 412 const ContainsCall contains_call_; |
408 RegisterSet live_registers_; | 413 RegisterSet live_registers_; |
409 }; | 414 }; |
410 | 415 |
411 | 416 |
412 } // namespace dart | 417 } // namespace dart |
413 | 418 |
414 #endif // VM_LOCATIONS_H_ | 419 #endif // VM_LOCATIONS_H_ |
OLD | NEW |