Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(94)

Unified Diff: src/compiler/instruction.cc

Issue 1389373002: [turbofan] Create ExplicitOperands to specify operands without virtual registers (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Review feedback Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/compiler/instruction.h ('k') | src/compiler/instruction-selector-impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/instruction.cc
diff --git a/src/compiler/instruction.cc b/src/compiler/instruction.cc
index 774843ced3038740356b0f5a78f4a0dfc3d3bd7e..1f9543a63531434c279e84cfe01e9be90a3c961b 100644
--- a/src/compiler/instruction.cc
+++ b/src/compiler/instruction.cc
@@ -105,24 +105,22 @@ std::ostream& operator<<(std::ostream& os,
return os << "[immediate:" << imm.indexed_value() << "]";
}
}
+ case InstructionOperand::EXPLICIT:
case InstructionOperand::ALLOCATED: {
- auto allocated = AllocatedOperand::cast(op);
- switch (allocated.allocated_kind()) {
- case AllocatedOperand::STACK_SLOT:
- os << "[stack:" << StackSlotOperand::cast(op).index();
- break;
- case AllocatedOperand::DOUBLE_STACK_SLOT:
- os << "[double_stack:" << DoubleStackSlotOperand::cast(op).index();
- break;
- case AllocatedOperand::REGISTER:
- os << "[" << RegisterOperand::cast(op).GetRegister().ToString()
- << "|R";
- break;
- case AllocatedOperand::DOUBLE_REGISTER:
- os << "["
- << DoubleRegisterOperand::cast(op).GetDoubleRegister().ToString()
- << "|R";
- break;
+ auto allocated = LocationOperand::cast(op);
+ if (op.IsStackSlot()) {
+ os << "[stack:" << LocationOperand::cast(op).index();
+ } else if (op.IsDoubleStackSlot()) {
+ os << "[double_stack:" << LocationOperand::cast(op).index();
+ } else if (op.IsRegister()) {
+ os << "[" << LocationOperand::cast(op).GetRegister().ToString() << "|R";
+ } else {
+ DCHECK(op.IsDoubleRegister());
+ os << "[" << LocationOperand::cast(op).GetDoubleRegister().ToString()
+ << "|R";
+ }
+ if (allocated.IsExplicit()) {
+ os << "|E";
}
switch (allocated.machine_type()) {
case kRepWord32:
@@ -181,11 +179,11 @@ MoveOperands* ParallelMove::PrepareInsertAfter(MoveOperands* move) const {
MoveOperands* to_eliminate = nullptr;
for (auto curr : *this) {
if (curr->IsEliminated()) continue;
- if (curr->destination().EqualsModuloType(move->source())) {
+ if (curr->destination().EqualsCanonicalized(move->source())) {
DCHECK(!replacement);
replacement = curr;
if (to_eliminate != nullptr) break;
- } else if (curr->destination().EqualsModuloType(move->destination())) {
+ } else if (curr->destination().EqualsCanonicalized(move->destination())) {
DCHECK(!to_eliminate);
to_eliminate = curr;
if (replacement != nullptr) break;
@@ -197,6 +195,16 @@ MoveOperands* ParallelMove::PrepareInsertAfter(MoveOperands* move) const {
}
+ExplicitOperand::ExplicitOperand(LocationKind kind, MachineType machine_type,
+ int index)
+ : LocationOperand(EXPLICIT, kind, machine_type, index) {
+ DCHECK_IMPLIES(kind == REGISTER && !IsFloatingPoint(machine_type),
+ Register::from_code(index).IsAllocatable());
+ DCHECK_IMPLIES(kind == REGISTER && IsFloatingPoint(machine_type),
+ DoubleRegister::from_code(index).IsAllocatable());
+}
+
+
Instruction::Instruction(InstructionCode opcode)
: opcode_(opcode),
bit_field_(OutputCountField::encode(0) | InputCountField::encode(0) |
@@ -263,7 +271,7 @@ std::ostream& operator<<(std::ostream& os,
void ReferenceMap::RecordReference(const AllocatedOperand& op) {
// Do not record arguments as pointers.
- if (op.IsStackSlot() && StackSlotOperand::cast(op).index() < 0) return;
+ if (op.IsStackSlot() && LocationOperand::cast(op).index() < 0) return;
DCHECK(!op.IsDoubleRegister() && !op.IsDoubleStackSlot());
reference_operands_.push_back(op);
}
« no previous file with comments | « src/compiler/instruction.h ('k') | src/compiler/instruction-selector-impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698