| 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_COMPILER_INSTRUCTION_H_ | 5 #ifndef V8_COMPILER_INSTRUCTION_H_ |
| 6 #define V8_COMPILER_INSTRUCTION_H_ | 6 #define V8_COMPILER_INSTRUCTION_H_ |
| 7 | 7 |
| 8 #include <deque> | 8 #include <deque> |
| 9 #include <iosfwd> | 9 #include <iosfwd> |
| 10 #include <map> | 10 #include <map> |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 // ExplicitOperands do not participate in register allocation. They are | 57 // ExplicitOperands do not participate in register allocation. They are |
| 58 // created by the instruction selector for direct access to registers and | 58 // created by the instruction selector for direct access to registers and |
| 59 // stack slots, completely bypassing the register allocator. They are never | 59 // stack slots, completely bypassing the register allocator. They are never |
| 60 // associated with a virtual register | 60 // associated with a virtual register |
| 61 INSTRUCTION_OPERAND_PREDICATE(Explicit, EXPLICIT) | 61 INSTRUCTION_OPERAND_PREDICATE(Explicit, EXPLICIT) |
| 62 // AllocatedOperands are registers or stack slots that are assigned by the | 62 // AllocatedOperands are registers or stack slots that are assigned by the |
| 63 // register allocator and are always associated with a virtual register. | 63 // register allocator and are always associated with a virtual register. |
| 64 INSTRUCTION_OPERAND_PREDICATE(Allocated, ALLOCATED) | 64 INSTRUCTION_OPERAND_PREDICATE(Allocated, ALLOCATED) |
| 65 #undef INSTRUCTION_OPERAND_PREDICATE | 65 #undef INSTRUCTION_OPERAND_PREDICATE |
| 66 | 66 |
| 67 inline bool IsAnyRegister() const; |
| 67 inline bool IsRegister() const; | 68 inline bool IsRegister() const; |
| 68 inline bool IsDoubleRegister() const; | 69 inline bool IsDoubleRegister() const; |
| 69 inline bool IsStackSlot() const; | 70 inline bool IsStackSlot() const; |
| 70 inline bool IsDoubleStackSlot() const; | 71 inline bool IsDoubleStackSlot() const; |
| 71 | 72 |
| 72 template <typename SubKindOperand> | 73 template <typename SubKindOperand> |
| 73 static SubKindOperand* New(Zone* zone, const SubKindOperand& op) { | 74 static SubKindOperand* New(Zone* zone, const SubKindOperand& op) { |
| 74 void* buffer = zone->New(sizeof(op)); | 75 void* buffer = zone->New(sizeof(op)); |
| 75 return new (buffer) SubKindOperand(op); | 76 return new (buffer) SubKindOperand(op); |
| 76 } | 77 } |
| (...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 497 return InstructionOperand::New(zone, AllocatedOperand(kind, rep, index)); | 498 return InstructionOperand::New(zone, AllocatedOperand(kind, rep, index)); |
| 498 } | 499 } |
| 499 | 500 |
| 500 INSTRUCTION_OPERAND_CASTS(AllocatedOperand, ALLOCATED); | 501 INSTRUCTION_OPERAND_CASTS(AllocatedOperand, ALLOCATED); |
| 501 }; | 502 }; |
| 502 | 503 |
| 503 | 504 |
| 504 #undef INSTRUCTION_OPERAND_CASTS | 505 #undef INSTRUCTION_OPERAND_CASTS |
| 505 | 506 |
| 506 | 507 |
| 507 bool InstructionOperand::IsRegister() const { | 508 bool InstructionOperand::IsAnyRegister() const { |
| 508 return (IsAllocated() || IsExplicit()) && | 509 return (IsAllocated() || IsExplicit()) && |
| 509 LocationOperand::cast(this)->location_kind() == | 510 LocationOperand::cast(this)->location_kind() == |
| 510 LocationOperand::REGISTER && | 511 LocationOperand::REGISTER; |
| 512 } |
| 513 |
| 514 |
| 515 bool InstructionOperand::IsRegister() const { |
| 516 return IsAnyRegister() && |
| 511 !IsFloatingPoint(LocationOperand::cast(this)->representation()); | 517 !IsFloatingPoint(LocationOperand::cast(this)->representation()); |
| 512 } | 518 } |
| 513 | 519 |
| 514 bool InstructionOperand::IsDoubleRegister() const { | 520 bool InstructionOperand::IsDoubleRegister() const { |
| 515 return (IsAllocated() || IsExplicit()) && | 521 return IsAnyRegister() && |
| 516 LocationOperand::cast(this)->location_kind() == | |
| 517 LocationOperand::REGISTER && | |
| 518 IsFloatingPoint(LocationOperand::cast(this)->representation()); | 522 IsFloatingPoint(LocationOperand::cast(this)->representation()); |
| 519 } | 523 } |
| 520 | 524 |
| 521 bool InstructionOperand::IsStackSlot() const { | 525 bool InstructionOperand::IsStackSlot() const { |
| 522 return (IsAllocated() || IsExplicit()) && | 526 return (IsAllocated() || IsExplicit()) && |
| 523 LocationOperand::cast(this)->location_kind() == | 527 LocationOperand::cast(this)->location_kind() == |
| 524 LocationOperand::STACK_SLOT && | 528 LocationOperand::STACK_SLOT && |
| 525 !IsFloatingPoint(LocationOperand::cast(this)->representation()); | 529 !IsFloatingPoint(LocationOperand::cast(this)->representation()); |
| 526 } | 530 } |
| 527 | 531 |
| (...skipping 821 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1349 | 1353 |
| 1350 | 1354 |
| 1351 std::ostream& operator<<(std::ostream& os, | 1355 std::ostream& operator<<(std::ostream& os, |
| 1352 const PrintableInstructionSequence& code); | 1356 const PrintableInstructionSequence& code); |
| 1353 | 1357 |
| 1354 } // namespace compiler | 1358 } // namespace compiler |
| 1355 } // namespace internal | 1359 } // namespace internal |
| 1356 } // namespace v8 | 1360 } // namespace v8 |
| 1357 | 1361 |
| 1358 #endif // V8_COMPILER_INSTRUCTION_H_ | 1362 #endif // V8_COMPILER_INSTRUCTION_H_ |
| OLD | NEW |