| OLD | NEW |
| 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 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 458 // add{s}<c> <Rd>, sp, #<RotatedImm8> | 458 // add{s}<c> <Rd>, sp, #<RotatedImm8> |
| 459 // | 459 // |
| 460 // cccc0010100snnnnddddiiiiiiiiiiii where cccc=Cond, dddd=Rd, nnnn=Rn, | 460 // cccc0010100snnnnddddiiiiiiiiiiii where cccc=Cond, dddd=Rd, nnnn=Rn, |
| 461 // s=SetFlags and iiiiiiiiiiii=Src1Value=RotatedImm8. | 461 // s=SetFlags and iiiiiiiiiiii=Src1Value=RotatedImm8. |
| 462 if ((Rd == RegARM32::Encoded_Reg_pc && SetFlags)) | 462 if ((Rd == RegARM32::Encoded_Reg_pc && SetFlags)) |
| 463 // Conditions of rule violated. | 463 // Conditions of rule violated. |
| 464 return setNeedsTextFixup(); | 464 return setNeedsTextFixup(); |
| 465 emitType01(Cond, kInstTypeDataImmediate, Add, SetFlags, Rn, Rd, Src1Value); | 465 emitType01(Cond, kInstTypeDataImmediate, Add, SetFlags, Rn, Rd, Src1Value); |
| 466 return; | 466 return; |
| 467 } | 467 } |
| 468 }; | 468 } |
| 469 } |
| 470 |
| 471 void AssemblerARM32::and_(const Operand *OpRd, const Operand *OpRn, |
| 472 const Operand *OpSrc1, bool SetFlags, |
| 473 CondARM32::Cond Cond) { |
| 474 IValueT Rd; |
| 475 if (decodeOperand(OpRd, Rd) != DecodedAsRegister) |
| 476 return setNeedsTextFixup(); |
| 477 IValueT Rn; |
| 478 if (decodeOperand(OpRn, Rn) != DecodedAsRegister) |
| 479 return setNeedsTextFixup(); |
| 480 constexpr IValueT And = 0; // 0000 |
| 481 IValueT Src1Value; |
| 482 // TODO(kschimpf) Other possible decodings of add. |
| 483 switch (decodeOperand(OpSrc1, Src1Value)) { |
| 484 default: |
| 485 return setNeedsTextFixup(); |
| 486 case DecodedAsRegister: { |
| 487 // AND (register) - ARM section A8.8.14, encoding A1: |
| 488 // and{s}<c> <Rd>, <Rn>{, <shift>} |
| 489 // |
| 490 // cccc0000000snnnnddddiiiiitt0mmmm where cccc=Cond, dddd=Rd, nnnn=Rn, |
| 491 // mmmm=Rm, iiiii=Shift, tt=ShiftKind, and s=SetFlags. |
| 492 constexpr IValueT Imm5 = 0; |
| 493 Src1Value = encodeShiftRotateImm5(Src1Value, OperandARM32::kNoShift, Imm5); |
| 494 if (((Rd == RegARM32::Encoded_Reg_pc) && SetFlags)) |
| 495 // Conditions of rule violated. |
| 496 return setNeedsTextFixup(); |
| 497 emitType01(Cond, kInstTypeDataRegister, And, SetFlags, Rn, Rd, Src1Value); |
| 498 return; |
| 499 } |
| 500 case DecodedAsRotatedImm8: { |
| 501 // AND (Immediate) - ARM section A8.8.13, encoding A1: |
| 502 // and{s}<c> <Rd>, <Rn>, #<RotatedImm8> |
| 503 // |
| 504 // cccc0010100snnnnddddiiiiiiiiiiii where cccc=Cond, dddd=Rd, nnnn=Rn, |
| 505 // s=SetFlags and iiiiiiiiiiii=Src1Value defining RotatedImm8. |
| 506 if ((Rd == RegARM32::Encoded_Reg_pc && SetFlags)) |
| 507 // Conditions of rule violated. |
| 508 return setNeedsTextFixup(); |
| 509 emitType01(Cond, kInstTypeDataImmediate, And, SetFlags, Rn, Rd, Src1Value); |
| 510 return; |
| 511 } |
| 512 } |
| 469 } | 513 } |
| 470 | 514 |
| 471 void AssemblerARM32::b(Label *L, CondARM32::Cond Cond) { | 515 void AssemblerARM32::b(Label *L, CondARM32::Cond Cond) { |
| 472 emitBranch(L, Cond, false); | 516 emitBranch(L, Cond, false); |
| 473 } | 517 } |
| 474 | 518 |
| 475 void AssemblerARM32::bkpt(uint16_t Imm16) { | 519 void AssemblerARM32::bkpt(uint16_t Imm16) { |
| 476 // BKPT - ARM section A*.8.24 - encoding A1: | 520 // BKPT - ARM section A*.8.24 - encoding A1: |
| 477 // bkpt #<Imm16> | 521 // bkpt #<Imm16> |
| 478 // | 522 // |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 734 // Conditions of rule violated. | 778 // Conditions of rule violated. |
| 735 return setNeedsTextFixup(); | 779 return setNeedsTextFixup(); |
| 736 emitType01(Cond, kInstTypeDataImmediate, Sub, SetFlags, Rn, Rd, Src1Value); | 780 emitType01(Cond, kInstTypeDataImmediate, Sub, SetFlags, Rn, Rd, Src1Value); |
| 737 return; | 781 return; |
| 738 } | 782 } |
| 739 } | 783 } |
| 740 } | 784 } |
| 741 | 785 |
| 742 } // end of namespace ARM32 | 786 } // end of namespace ARM32 |
| 743 } // end of namespace Ice | 787 } // end of namespace Ice |
| OLD | NEW |