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

Side by Side Diff: src/IceAssemblerARM32.cpp

Issue 1426513004: Fix ARM emit() methods to count instructions generated. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Created 5 years, 1 month 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 //===- subzero/src/IceAssemblerARM32.cpp - Assembler for ARM32 --*- C++ -*-===// 1 //===- subzero/src/IceAssemblerARM32.cpp - Assembler for ARM32 --*- C++ -*-===//
2 // 2 //
3 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 3 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
4 // for details. All rights reserved. Use of this source code is governed by a 4 // for details. All rights reserved. Use of this source code is governed by a
5 // BSD-style license that can be found in the LICENSE file. 5 // BSD-style license that can be found in the LICENSE file.
6 // 6 //
7 // Modified by the Subzero authors. 7 // Modified by the Subzero authors.
8 // 8 //
9 //===----------------------------------------------------------------------===// 9 //===----------------------------------------------------------------------===//
10 // 10 //
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 IOffsetT Position = L->getLinkPosition(); 353 IOffsetT Position = L->getLinkPosition();
354 IOffsetT Dest = BoundPc - Position; 354 IOffsetT Dest = BoundPc - Position;
355 IValueT Inst = Buffer.load<IValueT>(Position); 355 IValueT Inst = Buffer.load<IValueT>(Position);
356 Buffer.store<IValueT>(Position, encodeBranchOffset(Dest, Inst)); 356 Buffer.store<IValueT>(Position, encodeBranchOffset(Dest, Inst));
357 L->setPosition(decodeBranchOffset(Inst)); 357 L->setPosition(decodeBranchOffset(Inst));
358 } 358 }
359 L->bindTo(BoundPc); 359 L->bindTo(BoundPc);
360 } 360 }
361 361
362 void AssemblerARM32::emitTextInst(const std::string &Text, SizeT InstSize) { 362 void AssemblerARM32::emitTextInst(const std::string &Text, SizeT InstSize) {
363 AssemblerBuffer::EnsureCapacity ensured(&Buffer);
364 AssemblerFixup *F = createTextFixup(Text, InstSize); 363 AssemblerFixup *F = createTextFixup(Text, InstSize);
365 emitFixup(F); 364 emitFixup(F);
366 for (SizeT I = 0; I < InstSize; ++I) 365 if (InstSize) {
Jim Stichnoth 2015/11/04 23:45:26 Remove this? It's redundant with the loop conditi
Karl 2015/11/05 16:18:40 Done.
367 Buffer.emit<char>(0); 366 for (SizeT I = 0; I < InstSize; ++I) {
367 AssemblerBuffer::EnsureCapacity ensured(&Buffer);
368 Buffer.emit<char>(0);
369 }
370 }
368 } 371 }
369 372
370 void AssemblerARM32::emitType01(CondARM32::Cond Cond, IValueT Type, 373 void AssemblerARM32::emitType01(CondARM32::Cond Cond, IValueT Type,
371 IValueT Opcode, bool SetCc, IValueT Rn, 374 IValueT Opcode, bool SetCc, IValueT Rn,
372 IValueT Rd, IValueT Imm12) { 375 IValueT Rd, IValueT Imm12) {
373 if (!isGPRRegisterDefined(Rd) || !isConditionDefined(Cond)) 376 if (!isGPRRegisterDefined(Rd) || !isConditionDefined(Cond))
374 return setNeedsTextFixup(); 377 return setNeedsTextFixup();
375 AssemblerBuffer::EnsureCapacity ensured(&Buffer); 378 AssemblerBuffer::EnsureCapacity ensured(&Buffer);
376 const IValueT Encoding = (encodeCondition(Cond) << kConditionShift) | 379 const IValueT Encoding = (encodeCondition(Cond) << kConditionShift) |
377 (Type << kTypeShift) | (Opcode << kOpcodeShift) | 380 (Type << kTypeShift) | (Opcode << kOpcodeShift) |
(...skipping 604 matching lines...) Expand 10 before | Expand all | Expand 10 after
982 // sub{s}<c> sp, <Rn>, #<RotatedImm8> 985 // sub{s}<c> sp, <Rn>, #<RotatedImm8>
983 // 986 //
984 // cccc0010010snnnnddddiiiiiiiiiiii where cccc=Cond, dddd=Rd, nnnn=Rn, 987 // cccc0010010snnnnddddiiiiiiiiiiii where cccc=Cond, dddd=Rd, nnnn=Rn,
985 // s=SetFlags and iiiiiiiiiiii=Src1Value defining RotatedImm8 988 // s=SetFlags and iiiiiiiiiiii=Src1Value defining RotatedImm8
986 constexpr IValueT Sub = B1; // 0010 989 constexpr IValueT Sub = B1; // 0010
987 emitType01(Sub, OpRd, OpRn, OpSrc1, SetFlags, Cond); 990 emitType01(Sub, OpRd, OpRn, OpSrc1, SetFlags, Cond);
988 } 991 }
989 992
990 } // end of namespace ARM32 993 } // end of namespace ARM32
991 } // end of namespace Ice 994 } // end of namespace Ice
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698