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

Side by Side Diff: src/compiler/instruction-selector-impl.h

Issue 1075903002: [turbofan] support small immediates (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 8 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
« no previous file with comments | « src/compiler/instruction.cc ('k') | src/compiler/register-allocator-verifier.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #ifndef V8_COMPILER_INSTRUCTION_SELECTOR_IMPL_H_ 5 #ifndef V8_COMPILER_INSTRUCTION_SELECTOR_IMPL_H_
6 #define V8_COMPILER_INSTRUCTION_SELECTOR_IMPL_H_ 6 #define V8_COMPILER_INSTRUCTION_SELECTOR_IMPL_H_
7 7
8 #include "src/compiler/instruction.h" 8 #include "src/compiler/instruction.h"
9 #include "src/compiler/instruction-selector.h" 9 #include "src/compiler/instruction-selector.h"
10 #include "src/compiler/linkage.h" 10 #include "src/compiler/linkage.h"
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 } 112 }
113 113
114 InstructionOperand UseFixed(Node* node, DoubleRegister reg) { 114 InstructionOperand UseFixed(Node* node, DoubleRegister reg) {
115 return Use(node, 115 return Use(node,
116 UnallocatedOperand(UnallocatedOperand::FIXED_DOUBLE_REGISTER, 116 UnallocatedOperand(UnallocatedOperand::FIXED_DOUBLE_REGISTER,
117 DoubleRegister::ToAllocationIndex(reg), 117 DoubleRegister::ToAllocationIndex(reg),
118 GetVReg(node))); 118 GetVReg(node)));
119 } 119 }
120 120
121 InstructionOperand UseImmediate(Node* node) { 121 InstructionOperand UseImmediate(Node* node) {
122 int index = sequence()->AddImmediate(ToConstant(node)); 122 return sequence()->AddImmediate(ToConstant(node));
123 return ImmediateOperand(index);
124 } 123 }
125 124
126 InstructionOperand UseLocation(Node* node, LinkageLocation location, 125 InstructionOperand UseLocation(Node* node, LinkageLocation location,
127 MachineType type) { 126 MachineType type) {
128 return Use(node, ToUnallocatedOperand(location, type, GetVReg(node))); 127 return Use(node, ToUnallocatedOperand(location, type, GetVReg(node)));
129 } 128 }
130 129
131 InstructionOperand TempRegister() { 130 InstructionOperand TempRegister() {
132 return UnallocatedOperand(UnallocatedOperand::MUST_HAVE_REGISTER, 131 return UnallocatedOperand(UnallocatedOperand::MUST_HAVE_REGISTER,
133 UnallocatedOperand::USED_AT_START, 132 UnallocatedOperand::USED_AT_START,
134 sequence()->NextVirtualRegister()); 133 sequence()->NextVirtualRegister());
135 } 134 }
136 135
137 InstructionOperand TempDoubleRegister() { 136 InstructionOperand TempDoubleRegister() {
138 UnallocatedOperand op = UnallocatedOperand( 137 UnallocatedOperand op = UnallocatedOperand(
139 UnallocatedOperand::MUST_HAVE_REGISTER, 138 UnallocatedOperand::MUST_HAVE_REGISTER,
140 UnallocatedOperand::USED_AT_START, sequence()->NextVirtualRegister()); 139 UnallocatedOperand::USED_AT_START, sequence()->NextVirtualRegister());
141 sequence()->MarkAsDouble(op.virtual_register()); 140 sequence()->MarkAsDouble(op.virtual_register());
142 return op; 141 return op;
143 } 142 }
144 143
145 InstructionOperand TempRegister(Register reg) { 144 InstructionOperand TempRegister(Register reg) {
146 return UnallocatedOperand(UnallocatedOperand::FIXED_REGISTER, 145 return UnallocatedOperand(UnallocatedOperand::FIXED_REGISTER,
147 Register::ToAllocationIndex(reg), 146 Register::ToAllocationIndex(reg),
148 InstructionOperand::kInvalidVirtualRegister); 147 InstructionOperand::kInvalidVirtualRegister);
149 } 148 }
150 149
151 InstructionOperand TempImmediate(int32_t imm) { 150 InstructionOperand TempImmediate(int32_t imm) {
152 int index = sequence()->AddImmediate(Constant(imm)); 151 return sequence()->AddImmediate(Constant(imm));
153 return ImmediateOperand(index);
154 } 152 }
155 153
156 InstructionOperand TempLocation(LinkageLocation location, MachineType type) { 154 InstructionOperand TempLocation(LinkageLocation location, MachineType type) {
157 return ToUnallocatedOperand(location, type, 155 return ToUnallocatedOperand(location, type,
158 sequence()->NextVirtualRegister()); 156 sequence()->NextVirtualRegister());
159 } 157 }
160 158
161 InstructionOperand Label(BasicBlock* block) { 159 InstructionOperand Label(BasicBlock* block) {
162 int index = sequence()->AddImmediate( 160 return sequence()->AddImmediate(
163 Constant(RpoNumber::FromInt(block->rpo_number()))); 161 Constant(RpoNumber::FromInt(block->rpo_number())));
164 return ImmediateOperand(index);
165 } 162 }
166 163
167 protected: 164 protected:
168 InstructionSelector* selector() const { return selector_; } 165 InstructionSelector* selector() const { return selector_; }
169 InstructionSequence* sequence() const { return selector()->sequence(); } 166 InstructionSequence* sequence() const { return selector()->sequence(); }
170 Zone* zone() const { return selector()->instruction_zone(); } 167 Zone* zone() const { return selector()->instruction_zone(); }
171 168
172 private: 169 private:
173 int GetVReg(Node* node) const { return selector_->GetVirtualRegister(node); } 170 int GetVReg(Node* node) const { return selector_->GetVirtualRegister(node); }
174 171
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 : (frame_state_descriptor->GetTotalSize() + 377 : (frame_state_descriptor->GetTotalSize() +
381 1); // Include deopt id. 378 1); // Include deopt id.
382 } 379 }
383 }; 380 };
384 381
385 } // namespace compiler 382 } // namespace compiler
386 } // namespace internal 383 } // namespace internal
387 } // namespace v8 384 } // namespace v8
388 385
389 #endif // V8_COMPILER_INSTRUCTION_SELECTOR_IMPL_H_ 386 #endif // V8_COMPILER_INSTRUCTION_SELECTOR_IMPL_H_
OLDNEW
« no previous file with comments | « src/compiler/instruction.cc ('k') | src/compiler/register-allocator-verifier.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698