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

Side by Side Diff: src/compiler/instruction.cc

Issue 1287383003: Re-reland: Remove register index/code indirection (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Updated to ToT Created 5 years, 3 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 unified diff | Download patch
OLDNEW
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 #include "src/compiler/common-operator.h" 5 #include "src/compiler/common-operator.h"
6 #include "src/compiler/graph.h" 6 #include "src/compiler/graph.h"
7 #include "src/compiler/instruction.h" 7 #include "src/compiler/instruction.h"
8 #include "src/compiler/schedule.h" 8 #include "src/compiler/schedule.h"
9 9
10 namespace v8 { 10 namespace v8 {
11 namespace internal { 11 namespace internal {
12 namespace compiler { 12 namespace compiler {
13 13
14 std::ostream& operator<<(std::ostream& os, 14 std::ostream& operator<<(std::ostream& os,
15 const PrintableInstructionOperand& printable) { 15 const PrintableInstructionOperand& printable) {
16 const InstructionOperand& op = printable.op_; 16 const InstructionOperand& op = printable.op_;
17 const RegisterConfiguration* conf = printable.register_configuration_; 17 const RegisterConfiguration* conf = printable.register_configuration_;
18 switch (op.kind()) { 18 switch (op.kind()) {
19 case InstructionOperand::UNALLOCATED: { 19 case InstructionOperand::UNALLOCATED: {
20 const UnallocatedOperand* unalloc = UnallocatedOperand::cast(&op); 20 const UnallocatedOperand* unalloc = UnallocatedOperand::cast(&op);
21 os << "v" << unalloc->virtual_register(); 21 os << "v" << unalloc->virtual_register();
22 if (unalloc->basic_policy() == UnallocatedOperand::FIXED_SLOT) { 22 if (unalloc->basic_policy() == UnallocatedOperand::FIXED_SLOT) {
23 return os << "(=" << unalloc->fixed_slot_index() << "S)"; 23 return os << "(=" << unalloc->fixed_slot_index() << "S)";
24 } 24 }
25 switch (unalloc->extended_policy()) { 25 switch (unalloc->extended_policy()) {
26 case UnallocatedOperand::NONE: 26 case UnallocatedOperand::NONE:
27 return os; 27 return os;
28 case UnallocatedOperand::FIXED_REGISTER: 28 case UnallocatedOperand::FIXED_REGISTER:
29 return os << "(=" << conf->general_register_name( 29 return os << "(="
30 unalloc->fixed_register_index()) << ")"; 30 << conf->GetGeneralRegisterName(
31 unalloc->fixed_register_index())
32 << ")";
31 case UnallocatedOperand::FIXED_DOUBLE_REGISTER: 33 case UnallocatedOperand::FIXED_DOUBLE_REGISTER:
32 return os << "(=" << conf->double_register_name( 34 return os << "(="
33 unalloc->fixed_register_index()) << ")"; 35 << conf->GetDoubleRegisterName(
36 unalloc->fixed_register_index())
37 << ")";
34 case UnallocatedOperand::MUST_HAVE_REGISTER: 38 case UnallocatedOperand::MUST_HAVE_REGISTER:
35 return os << "(R)"; 39 return os << "(R)";
36 case UnallocatedOperand::MUST_HAVE_SLOT: 40 case UnallocatedOperand::MUST_HAVE_SLOT:
37 return os << "(S)"; 41 return os << "(S)";
38 case UnallocatedOperand::SAME_AS_FIRST_INPUT: 42 case UnallocatedOperand::SAME_AS_FIRST_INPUT:
39 return os << "(1)"; 43 return os << "(1)";
40 case UnallocatedOperand::ANY: 44 case UnallocatedOperand::ANY:
41 return os << "(-)"; 45 return os << "(-)";
42 } 46 }
43 } 47 }
(...skipping 12 matching lines...) Expand all
56 case InstructionOperand::ALLOCATED: { 60 case InstructionOperand::ALLOCATED: {
57 auto allocated = AllocatedOperand::cast(op); 61 auto allocated = AllocatedOperand::cast(op);
58 switch (allocated.allocated_kind()) { 62 switch (allocated.allocated_kind()) {
59 case AllocatedOperand::STACK_SLOT: 63 case AllocatedOperand::STACK_SLOT:
60 os << "[stack:" << StackSlotOperand::cast(op).index(); 64 os << "[stack:" << StackSlotOperand::cast(op).index();
61 break; 65 break;
62 case AllocatedOperand::DOUBLE_STACK_SLOT: 66 case AllocatedOperand::DOUBLE_STACK_SLOT:
63 os << "[double_stack:" << DoubleStackSlotOperand::cast(op).index(); 67 os << "[double_stack:" << DoubleStackSlotOperand::cast(op).index();
64 break; 68 break;
65 case AllocatedOperand::REGISTER: 69 case AllocatedOperand::REGISTER:
66 os << "[" 70 os << "[" << RegisterOperand::cast(op).GetRegister().ToString()
67 << conf->general_register_name(RegisterOperand::cast(op).index())
68 << "|R"; 71 << "|R";
69 break; 72 break;
70 case AllocatedOperand::DOUBLE_REGISTER: 73 case AllocatedOperand::DOUBLE_REGISTER:
71 os << "[" 74 os << "[" << DoubleRegisterOperand::cast(op).GetRegister().ToString()
72 << conf->double_register_name( 75 << "|R";
73 DoubleRegisterOperand::cast(op).index()) << "|R";
74 break; 76 break;
75 } 77 }
76 switch (allocated.machine_type()) { 78 switch (allocated.machine_type()) {
77 case kRepWord32: 79 case kRepWord32:
78 os << "|w32"; 80 os << "|w32";
79 break; 81 break;
80 case kRepWord64: 82 case kRepWord64:
81 os << "|w64"; 83 os << "|w64";
82 break; 84 break;
83 case kRepFloat32: 85 case kRepFloat32:
(...skipping 725 matching lines...) Expand 10 before | Expand all | Expand 10 after
809 os << " B" << succ.ToInt(); 811 os << " B" << succ.ToInt();
810 } 812 }
811 os << "\n"; 813 os << "\n";
812 } 814 }
813 return os; 815 return os;
814 } 816 }
815 817
816 } // namespace compiler 818 } // namespace compiler
817 } // namespace internal 819 } // namespace internal
818 } // namespace v8 820 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698