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

Side by Side Diff: src/DartARM32/assembler_arm.cc

Issue 1486263002: More coverage of load/stores in ARM integrated assembler. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Fix remaining issue in patch set 2. Created 5 years 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/DartARM32/assembler_arm.h ('k') | src/IceAssemblerARM32.h » ('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 (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 // 4 //
5 // This is forked from Dart revision df52deea9f25690eb8b66c5995da92b70f7ac1fe 5 // This is forked from Dart revision df52deea9f25690eb8b66c5995da92b70f7ac1fe
6 // Please update the (git) revision if we merge changes from Dart. 6 // Please update the (git) revision if we merge changes from Dart.
7 // https://code.google.com/p/dart/wiki/GettingTheSource 7 // https://code.google.com/p/dart/wiki/GettingTheSource
8 8
9 #include "vm/globals.h" // NOLINT 9 #include "vm/globals.h" // NOLINT
10 #if defined(TARGET_ARCH_ARM) 10 #if defined(TARGET_ARCH_ARM)
(...skipping 10 matching lines...) Expand all
21 #if !defined(USING_SIMULATOR) && !defined(__linux__) && !defined(ANDROID) 21 #if !defined(USING_SIMULATOR) && !defined(__linux__) && !defined(ANDROID)
22 #error ARM cross-compile only supported on Linux 22 #error ARM cross-compile only supported on Linux
23 #endif 23 #endif
24 24
25 namespace dart { 25 namespace dart {
26 26
27 DECLARE_FLAG(bool, allow_absolute_addresses); 27 DECLARE_FLAG(bool, allow_absolute_addresses);
28 DEFINE_FLAG(bool, print_stop_message, true, "Print stop message."); 28 DEFINE_FLAG(bool, print_stop_message, true, "Print stop message.");
29 DECLARE_FLAG(bool, inline_alloc); 29 DECLARE_FLAG(bool, inline_alloc);
30 30
31 #if 0
32 // Moved to encodeImmRegOffsetEnc3 in IceAssemblerARM32.cpp
31 uint32_t Address::encoding3() const { 33 uint32_t Address::encoding3() const {
32 if (kind_ == Immediate) { 34 if (kind_ == Immediate) {
33 uint32_t offset = encoding_ & kOffset12Mask; 35 uint32_t offset = encoding_ & kOffset12Mask;
34 ASSERT(offset < 256); 36 ASSERT(offset < 256);
35 return (encoding_ & ~kOffset12Mask) | B22 | 37 return (encoding_ & ~kOffset12Mask) | B22 |
36 ((offset & 0xf0) << 4) | (offset & 0xf); 38 ((offset & 0xf0) << 4) | (offset & 0xf);
37 } 39 }
38 ASSERT(kind_ == IndexRegister); 40 ASSERT(kind_ == IndexRegister);
39 return encoding_; 41 return encoding_;
40 } 42 }
41 43 #endif
42 44
43 uint32_t Address::vencoding() const { 45 uint32_t Address::vencoding() const {
44 ASSERT(kind_ == Immediate); 46 ASSERT(kind_ == Immediate);
45 uint32_t offset = encoding_ & kOffset12Mask; 47 uint32_t offset = encoding_ & kOffset12Mask;
46 ASSERT(offset < (1 << 10)); // In the range 0 to +1020. 48 ASSERT(offset < (1 << 10)); // In the range 0 to +1020.
47 ASSERT(Utils::IsAligned(offset, 4)); // Multiple of 4. 49 ASSERT(Utils::IsAligned(offset, 4)); // Multiple of 4.
48 int mode = encoding_ & ((8|4|1) << 21); 50 int mode = encoding_ & ((8|4|1) << 21);
49 ASSERT((mode == Offset) || (mode == NegOffset)); 51 ASSERT((mode == Offset) || (mode == NegOffset));
50 uint32_t vencoding = (encoding_ & (0xf << kRnShift)) | (offset >> 2); 52 uint32_t vencoding = (encoding_ & (0xf << kRnShift)) | (offset >> 2);
51 if (mode == Offset) { 53 if (mode == Offset) {
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 ASSERT(rd != kNoRegister); 112 ASSERT(rd != kNoRegister);
111 ASSERT(cond != kNoCondition); 113 ASSERT(cond != kNoCondition);
112 int32_t encoding = (static_cast<int32_t>(cond) << kConditionShift) | 114 int32_t encoding = (static_cast<int32_t>(cond) << kConditionShift) |
113 B26 | (ad.kind() == Address::Immediate ? 0 : B25) | 115 B26 | (ad.kind() == Address::Immediate ? 0 : B25) |
114 (load ? L : 0) | 116 (load ? L : 0) |
115 (byte ? B : 0) | 117 (byte ? B : 0) |
116 (static_cast<int32_t>(rd) << kRdShift) | 118 (static_cast<int32_t>(rd) << kRdShift) |
117 ad.encoding(); 119 ad.encoding();
118 Emit(encoding); 120 Emit(encoding);
119 } 121 }
120 #endif
121 122
123 // Moved to AssemblerARM32::emitMemOpEnc3();
122 void Assembler::EmitMemOpAddressMode3(Condition cond, 124 void Assembler::EmitMemOpAddressMode3(Condition cond,
123 int32_t mode, 125 int32_t mode,
124 Register rd, 126 Register rd,
125 Address ad) { 127 Address ad) {
126 ASSERT(rd != kNoRegister); 128 ASSERT(rd != kNoRegister);
127 ASSERT(cond != kNoCondition); 129 ASSERT(cond != kNoCondition);
128 int32_t encoding = (static_cast<int32_t>(cond) << kConditionShift) | 130 int32_t encoding = (static_cast<int32_t>(cond) << kConditionShift) |
129 mode | 131 mode |
130 (static_cast<int32_t>(rd) << kRdShift) | 132 (static_cast<int32_t>(rd) << kRdShift) |
131 ad.encoding3(); 133 ad.encoding3();
132 Emit(encoding); 134 Emit(encoding);
133 } 135 }
134 136
135 #if 0
136 // Moved to ARM32::AssemblerARM32::emitMuliMemOp() 137 // Moved to ARM32::AssemblerARM32::emitMuliMemOp()
137 void Assembler::EmitMultiMemOp(Condition cond, 138 void Assembler::EmitMultiMemOp(Condition cond,
138 BlockAddressMode am, 139 BlockAddressMode am,
139 bool load, 140 bool load,
140 Register base, 141 Register base,
141 RegList regs) { 142 RegList regs) {
142 ASSERT(base != kNoRegister); 143 ASSERT(base != kNoRegister);
143 ASSERT(cond != kNoCondition); 144 ASSERT(cond != kNoCondition);
144 int32_t encoding = (static_cast<int32_t>(cond) << kConditionShift) | 145 int32_t encoding = (static_cast<int32_t>(cond) << kConditionShift) |
145 B27 | 146 B27 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 static_cast<int32_t>(rm); 185 static_cast<int32_t>(rm);
185 Emit(encoding); 186 Emit(encoding);
186 } 187 }
187 188
188 189
189 #if 0 190 #if 0
190 // Moved to ARM32::AssemblerARM32::and_() 191 // Moved to ARM32::AssemblerARM32::and_()
191 void Assembler::and_(Register rd, Register rn, Operand o, Condition cond) { 192 void Assembler::and_(Register rd, Register rn, Operand o, Condition cond) {
192 EmitType01(cond, o.type(), AND, 0, rn, rd, o); 193 EmitType01(cond, o.type(), AND, 0, rn, rd, o);
193 } 194 }
194 #endif
195 195
196 #if 0
197 // Moved to ARM32::AssemberARM32::eor() 196 // Moved to ARM32::AssemberARM32::eor()
198 void Assembler::eor(Register rd, Register rn, Operand o, Condition cond) { 197 void Assembler::eor(Register rd, Register rn, Operand o, Condition cond) {
199 EmitType01(cond, o.type(), EOR, 0, rn, rd, o); 198 EmitType01(cond, o.type(), EOR, 0, rn, rd, o);
200 } 199 }
201 200
202 // Moved to ARM32::AssemberARM32::sub() 201 // Moved to ARM32::AssemberARM32::sub()
203 void Assembler::sub(Register rd, Register rn, Operand o, Condition cond) { 202 void Assembler::sub(Register rd, Register rn, Operand o, Condition cond) {
204 EmitType01(cond, o.type(), SUB, 0, rn, rd, o); 203 EmitType01(cond, o.type(), SUB, 0, rn, rd, o);
205 } 204 }
206 #endif 205 #endif
207 206
208 void Assembler::rsb(Register rd, Register rn, Operand o, Condition cond) { 207 void Assembler::rsb(Register rd, Register rn, Operand o, Condition cond) {
209 EmitType01(cond, o.type(), RSB, 0, rn, rd, o); 208 EmitType01(cond, o.type(), RSB, 0, rn, rd, o);
210 } 209 }
211 210
212 void Assembler::rsbs(Register rd, Register rn, Operand o, Condition cond) { 211 void Assembler::rsbs(Register rd, Register rn, Operand o, Condition cond) {
213 EmitType01(cond, o.type(), RSB, 1, rn, rd, o); 212 EmitType01(cond, o.type(), RSB, 1, rn, rd, o);
214 } 213 }
215 214
216
217 #if 0 215 #if 0
218 // Moved to ARM32::AssemberARM32::add() 216 // Moved to ARM32::AssemberARM32::add()
219 void Assembler::add(Register rd, Register rn, Operand o, Condition cond) { 217 void Assembler::add(Register rd, Register rn, Operand o, Condition cond) {
220 EmitType01(cond, o.type(), ADD, 0, rn, rd, o); 218 EmitType01(cond, o.type(), ADD, 0, rn, rd, o);
221 } 219 }
222 220
223 // Moved to ARM32::AssemberARM32::add() 221 // Moved to ARM32::AssemberARM32::add()
224 void Assembler::adds(Register rd, Register rn, Operand o, Condition cond) { 222 void Assembler::adds(Register rd, Register rn, Operand o, Condition cond) {
225 EmitType01(cond, o.type(), ADD, 1, rn, rd, o); 223 EmitType01(cond, o.type(), ADD, 1, rn, rd, o);
226 } 224 }
227 225
228 // Moved to ARM32::AssemberARM32::sub() 226 // Moved to ARM32::AssemberARM32::sub()
229 void Assembler::subs(Register rd, Register rn, Operand o, Condition cond) { 227 void Assembler::subs(Register rd, Register rn, Operand o, Condition cond) {
230 EmitType01(cond, o.type(), SUB, 1, rn, rd, o); 228 EmitType01(cond, o.type(), SUB, 1, rn, rd, o);
231 } 229 }
232 230
233 // Moved to ARM32::AssemberARM32::adc() 231 // Moved to ARM32::AssemberARM32::adc()
234 void Assembler::adc(Register rd, Register rn, Operand o, Condition cond) { 232 void Assembler::adc(Register rd, Register rn, Operand o, Condition cond) {
235 EmitType01(cond, o.type(), ADC, 0, rn, rd, o); 233 EmitType01(cond, o.type(), ADC, 0, rn, rd, o);
236 } 234 }
237 235
238 // Moved to ARM32::AssemberARM32::adc() 236 // Moved to ARM32::AssemberARM32::adc()
239 void Assembler::adcs(Register rd, Register rn, Operand o, Condition cond) { 237 void Assembler::adcs(Register rd, Register rn, Operand o, Condition cond) {
240 EmitType01(cond, o.type(), ADC, 1, rn, rd, o); 238 EmitType01(cond, o.type(), ADC, 1, rn, rd, o);
241 } 239 }
242 #endif 240 #endif
243 241
244
245 void Assembler::sbc(Register rd, Register rn, Operand o, Condition cond) { 242 void Assembler::sbc(Register rd, Register rn, Operand o, Condition cond) {
246 EmitType01(cond, o.type(), SBC, 0, rn, rd, o); 243 EmitType01(cond, o.type(), SBC, 0, rn, rd, o);
247 } 244 }
248 245
249 246
250 void Assembler::sbcs(Register rd, Register rn, Operand o, Condition cond) { 247 void Assembler::sbcs(Register rd, Register rn, Operand o, Condition cond) {
251 EmitType01(cond, o.type(), SBC, 1, rn, rd, o); 248 EmitType01(cond, o.type(), SBC, 1, rn, rd, o);
252 } 249 }
253 250
254 251
255 void Assembler::rsc(Register rd, Register rn, Operand o, Condition cond) { 252 void Assembler::rsc(Register rd, Register rn, Operand o, Condition cond) {
256 EmitType01(cond, o.type(), RSC, 0, rn, rd, o); 253 EmitType01(cond, o.type(), RSC, 0, rn, rd, o);
257 } 254 }
258 255
259 #if 0 256 #if 0
260 // Moved to ARM32::AssemblerARM32::tst() 257 // Moved to ARM32::AssemblerARM32::tst()
261 void Assembler::tst(Register rn, Operand o, Condition cond) { 258 void Assembler::tst(Register rn, Operand o, Condition cond) {
262 EmitType01(cond, o.type(), TST, 1, rn, R0, o); 259 EmitType01(cond, o.type(), TST, 1, rn, R0, o);
263 } 260 }
264 #endif 261 #endif
265 262
266 void Assembler::teq(Register rn, Operand o, Condition cond) { 263 void Assembler::teq(Register rn, Operand o, Condition cond) {
267 EmitType01(cond, o.type(), TEQ, 1, rn, R0, o); 264 EmitType01(cond, o.type(), TEQ, 1, rn, R0, o);
268 } 265 }
269 266
270
271 #if 0 267 #if 0
272 // Moved to ARM32::AssemblerARM32::cmp() 268 // Moved to ARM32::AssemblerARM32::cmp()
273 void Assembler::cmp(Register rn, Operand o, Condition cond) { 269 void Assembler::cmp(Register rn, Operand o, Condition cond) {
274 EmitType01(cond, o.type(), CMP, 1, rn, R0, o); 270 EmitType01(cond, o.type(), CMP, 1, rn, R0, o);
275 } 271 }
276 #endif 272 #endif
277 273
278 274
279 void Assembler::cmn(Register rn, Operand o, Condition cond) { 275 void Assembler::cmn(Register rn, Operand o, Condition cond) {
280 EmitType01(cond, o.type(), CMN, 1, rn, R0, o); 276 EmitType01(cond, o.type(), CMN, 1, rn, R0, o);
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 ASSERT(rd != PC); 328 ASSERT(rd != PC);
333 ASSERT(rm != PC); 329 ASSERT(rm != PC);
334 int32_t encoding = (static_cast<int32_t>(cond) << kConditionShift) | 330 int32_t encoding = (static_cast<int32_t>(cond) << kConditionShift) |
335 B24 | B22 | B21 | (0xf << 16) | 331 B24 | B22 | B21 | (0xf << 16) |
336 (static_cast<int32_t>(rd) << kRdShift) | 332 (static_cast<int32_t>(rd) << kRdShift) |
337 (0xf << 8) | B4 | static_cast<int32_t>(rm); 333 (0xf << 8) | B4 | static_cast<int32_t>(rm);
338 Emit(encoding); 334 Emit(encoding);
339 } 335 }
340 336
341 337
342 #if 338 #if 0
343 // Moved to ARM32::AssemblerARM32::movw() 339 // Moved to ARM32::AssemblerARM32::movw()
344 void Assembler::movw(Register rd, uint16_t imm16, Condition cond) { 340 void Assembler::movw(Register rd, uint16_t imm16, Condition cond) {
345 ASSERT(cond != kNoCondition); 341 ASSERT(cond != kNoCondition);
346 int32_t encoding = static_cast<int32_t>(cond) << kConditionShift | 342 int32_t encoding = static_cast<int32_t>(cond) << kConditionShift |
347 B25 | B24 | ((imm16 >> 12) << 16) | 343 B25 | B24 | ((imm16 >> 12) << 16) |
348 static_cast<int32_t>(rd) << kRdShift | (imm16 & 0xfff); 344 static_cast<int32_t>(rd) << kRdShift | (imm16 & 0xfff);
349 Emit(encoding); 345 Emit(encoding);
350 } 346 }
351 347
352 348
353 // Moved to ARM32::AssemblerARM32::movt() 349 // Moved to ARM32::AssemblerARM32::movt()
354 void Assembler::movt(Register rd, uint16_t imm16, Condition cond) { 350 void Assembler::movt(Register rd, uint16_t imm16, Condition cond) {
355 ASSERT(cond != kNoCondition); 351 ASSERT(cond != kNoCondition);
356 int32_t encoding = static_cast<int32_t>(cond) << kConditionShift | 352 int32_t encoding = static_cast<int32_t>(cond) << kConditionShift |
357 B25 | B24 | B22 | ((imm16 >> 12) << 16) | 353 B25 | B24 | B22 | ((imm16 >> 12) << 16) |
358 static_cast<int32_t>(rd) << kRdShift | (imm16 & 0xfff); 354 static_cast<int32_t>(rd) << kRdShift | (imm16 & 0xfff);
359 Emit(encoding); 355 Emit(encoding);
360 } 356 }
361 #endif
362 357
363 #if 0
364 // Moved to ARM32::AssemblerARM32::emitMulOp() 358 // Moved to ARM32::AssemblerARM32::emitMulOp()
365 void Assembler::EmitMulOp(Condition cond, int32_t opcode, 359 void Assembler::EmitMulOp(Condition cond, int32_t opcode,
366 Register rd, Register rn, 360 Register rd, Register rn,
367 Register rm, Register rs) { 361 Register rm, Register rs) {
368 ASSERT(rd != kNoRegister); 362 ASSERT(rd != kNoRegister);
369 ASSERT(rn != kNoRegister); 363 ASSERT(rn != kNoRegister);
370 ASSERT(rm != kNoRegister); 364 ASSERT(rm != kNoRegister);
371 ASSERT(rs != kNoRegister); 365 ASSERT(rs != kNoRegister);
372 ASSERT(cond != kNoCondition); 366 ASSERT(cond != kNoCondition);
373 int32_t encoding = opcode | 367 int32_t encoding = opcode |
(...skipping 2230 matching lines...) Expand 10 before | Expand all | Expand 10 after
2604 ASSERT(shift_imm.encoding() != 0); // Do not use Lsl if no shift is wanted. 2598 ASSERT(shift_imm.encoding() != 0); // Do not use Lsl if no shift is wanted.
2605 mov(rd, Operand(rm, LSL, shift_imm.encoding()), cond); 2599 mov(rd, Operand(rm, LSL, shift_imm.encoding()), cond);
2606 } 2600 }
2607 2601
2608 // Moved to ARM32::AssemblerARM32::lsl() 2602 // Moved to ARM32::AssemblerARM32::lsl()
2609 void Assembler::Lsl(Register rd, Register rm, Register rs, Condition cond) { 2603 void Assembler::Lsl(Register rd, Register rm, Register rs, Condition cond) {
2610 mov(rd, Operand(rm, LSL, rs), cond); 2604 mov(rd, Operand(rm, LSL, rs), cond);
2611 } 2605 }
2612 #endif 2606 #endif
2613 2607
2614
2615 void Assembler::Lsr(Register rd, Register rm, const Operand& shift_imm, 2608 void Assembler::Lsr(Register rd, Register rm, const Operand& shift_imm,
2616 Condition cond) { 2609 Condition cond) {
2617 ASSERT(shift_imm.type() == 1); 2610 ASSERT(shift_imm.type() == 1);
2618 uint32_t shift = shift_imm.encoding(); 2611 uint32_t shift = shift_imm.encoding();
2619 ASSERT(shift != 0); // Do not use Lsr if no shift is wanted. 2612 ASSERT(shift != 0); // Do not use Lsr if no shift is wanted.
2620 if (shift == 32) { 2613 if (shift == 32) {
2621 shift = 0; // Comply to UAL syntax. 2614 shift = 0; // Comply to UAL syntax.
2622 } 2615 }
2623 mov(rd, Operand(rm, LSR, shift), cond); 2616 mov(rd, Operand(rm, LSR, shift), cond);
2624 } 2617 }
(...skipping 1068 matching lines...) Expand 10 before | Expand all | Expand 10 after
3693 3686
3694 3687
3695 const char* Assembler::FpuRegisterName(FpuRegister reg) { 3688 const char* Assembler::FpuRegisterName(FpuRegister reg) {
3696 ASSERT((0 <= reg) && (reg < kNumberOfFpuRegisters)); 3689 ASSERT((0 <= reg) && (reg < kNumberOfFpuRegisters));
3697 return fpu_reg_names[reg]; 3690 return fpu_reg_names[reg];
3698 } 3691 }
3699 3692
3700 } // namespace dart 3693 } // namespace dart
3701 3694
3702 #endif // defined TARGET_ARCH_ARM 3695 #endif // defined TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/DartARM32/assembler_arm.h ('k') | src/IceAssemblerARM32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698