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

Side by Side Diff: src/compiler/x64/code-generator-x64.cc

Issue 605693002: [turbofan] add new x64 addressing modes (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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/code-generator.h" 5 #include "src/compiler/code-generator.h"
6 6
7 #include "src/compiler/code-generator-impl.h" 7 #include "src/compiler/code-generator-impl.h"
8 #include "src/compiler/gap-resolver.h" 8 #include "src/compiler/gap-resolver.h"
9 #include "src/compiler/node-matchers.h" 9 #include "src/compiler/node-matchers.h"
10 #include "src/compiler/node-properties-inl.h" 10 #include "src/compiler/node-properties-inl.h"
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 DCHECK(op->IsStackSlot() || op->IsDoubleStackSlot()); 132 DCHECK(op->IsStackSlot() || op->IsDoubleStackSlot());
133 133
134 result.type = kOperand; 134 result.type = kOperand;
135 // The linkage computes where all spill slots are located. 135 // The linkage computes where all spill slots are located.
136 FrameOffset offset = linkage()->GetFrameOffset(op->index(), frame(), extra); 136 FrameOffset offset = linkage()->GetFrameOffset(op->index(), frame(), extra);
137 result.operand = 137 result.operand =
138 Operand(offset.from_stack_pointer() ? rsp : rbp, offset.offset()); 138 Operand(offset.from_stack_pointer() ? rsp : rbp, offset.offset());
139 return result; 139 return result;
140 } 140 }
141 141
142 Operand MemoryOperand(int* first_input) { 142 static inline int NextOffset(int* offset) {
143 const int offset = *first_input; 143 int i = *offset;
144 switch (AddressingModeField::decode(instr_->opcode())) { 144 (*offset)++;
145 case kMode_MR1I: { 145 return i;
146 *first_input += 2; 146 }
147 Register index = InputRegister(offset + 1); 147
148 return Operand(InputRegister(offset + 0), index, times_1, 148 static inline ScaleFactor ScaleFor(AddressingMode one, AddressingMode mode) {
149 0); // TODO(dcarney): K != 0 149 STATIC_ASSERT(0 == static_cast<int>(times_1));
150 STATIC_ASSERT(1 == static_cast<int>(times_2));
151 STATIC_ASSERT(2 == static_cast<int>(times_4));
152 STATIC_ASSERT(3 == static_cast<int>(times_8));
153 int scale = static_cast<int>(mode - one);
154 DCHECK(scale >= 0 && scale < 4);
155 return static_cast<ScaleFactor>(scale);
156 }
157
158 Operand MemoryOperand(int* offset) {
159 AddressingMode mode = AddressingModeField::decode(instr_->opcode());
160 switch (mode) {
161 case kMode_MR: {
162 Register base = InputRegister(NextOffset(offset));
163 int32_t disp = 0;
164 return Operand(base, disp);
150 } 165 }
151 case kMode_MRI: 166 case kMode_MRI: {
152 *first_input += 2; 167 Register base = InputRegister(NextOffset(offset));
153 return Operand(InputRegister(offset + 0), InputInt32(offset + 1)); 168 int32_t disp = InputInt32(NextOffset(offset));
154 default: 169 return Operand(base, disp);
170 }
171 case kMode_MR1:
172 case kMode_MR2:
173 case kMode_MR4:
174 case kMode_MR8: {
175 Register base = InputRegister(NextOffset(offset));
176 Register index = InputRegister(NextOffset(offset));
177 ScaleFactor scale = ScaleFor(kMode_MR1, mode);
178 int32_t disp = 0;
179 return Operand(base, index, scale, disp);
180 }
181 case kMode_MR1I:
182 case kMode_MR2I:
183 case kMode_MR4I:
184 case kMode_MR8I: {
185 Register base = InputRegister(NextOffset(offset));
186 Register index = InputRegister(NextOffset(offset));
187 ScaleFactor scale = ScaleFor(kMode_MR1I, mode);
188 int32_t disp = InputInt32(NextOffset(offset));
189 return Operand(base, index, scale, disp);
190 }
191 case kMode_M1:
192 case kMode_M2:
193 case kMode_M4:
194 case kMode_M8: {
195 Register index = InputRegister(NextOffset(offset));
196 ScaleFactor scale = ScaleFor(kMode_M1, mode);
197 int32_t disp = 0;
198 return Operand(index, scale, disp);
199 }
200 case kMode_M1I:
201 case kMode_M2I:
202 case kMode_M4I:
203 case kMode_M8I: {
204 Register index = InputRegister(NextOffset(offset));
205 ScaleFactor scale = ScaleFor(kMode_M1I, mode);
206 int32_t disp = InputInt32(NextOffset(offset));
207 return Operand(index, scale, disp);
208 }
209 case kMode_None:
155 UNREACHABLE(); 210 UNREACHABLE();
156 return Operand(no_reg, 0); 211 return Operand(no_reg, 0);
157 } 212 }
158 } 213 }
159 214
160 Operand MemoryOperand() { 215 Operand MemoryOperand() {
161 int first_input = 0; 216 int first_input = 0;
162 return MemoryOperand(&first_input); 217 return MemoryOperand(&first_input);
163 } 218 }
164 }; 219 };
(...skipping 852 matching lines...) Expand 10 before | Expand all | Expand 10 after
1017 } 1072 }
1018 } 1073 }
1019 MarkLazyDeoptSite(); 1074 MarkLazyDeoptSite();
1020 } 1075 }
1021 1076
1022 #undef __ 1077 #undef __
1023 1078
1024 } // namespace internal 1079 } // namespace internal
1025 } // namespace compiler 1080 } // namespace compiler
1026 } // namespace v8 1081 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698