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 687 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
698 IValueT Rt; | 698 IValueT Rt; |
699 if (decodeOperand(OpRt, Rt) != DecodedAsRegister) | 699 if (decodeOperand(OpRt, Rt) != DecodedAsRegister) |
700 return setNeedsTextFixup(); | 700 return setNeedsTextFixup(); |
701 IValueT Address; | 701 IValueT Address; |
702 if (decodeAddress(OpAddress, Address) != DecodedAsImmRegOffset) | 702 if (decodeAddress(OpAddress, Address) != DecodedAsImmRegOffset) |
703 return setNeedsTextFixup(); | 703 return setNeedsTextFixup(); |
704 // LDR (immediate) - ARM section A8.8.63, encoding A1: | 704 // LDR (immediate) - ARM section A8.8.63, encoding A1: |
705 // ldr<c> <Rt>, [<Rn>{, #+/-<imm12>}] ; p=1, w=0 | 705 // ldr<c> <Rt>, [<Rn>{, #+/-<imm12>}] ; p=1, w=0 |
706 // ldr<c> <Rt>, [<Rn>], #+/-<imm12> ; p=1, w=1 | 706 // ldr<c> <Rt>, [<Rn>], #+/-<imm12> ; p=1, w=1 |
707 // ldr<c> <Rt>, [<Rn>, #+/-<imm12>]! ; p=0, w=1 | 707 // ldr<c> <Rt>, [<Rn>, #+/-<imm12>]! ; p=0, w=1 |
| 708 // |
708 // LDRB (immediate) - ARM section A8.8.68, encoding A1: | 709 // LDRB (immediate) - ARM section A8.8.68, encoding A1: |
709 // ldrb<c> <Rt>, [<Rn>{, #+/-<imm12>}] ; p=1, w=0 | 710 // ldrb<c> <Rt>, [<Rn>{, #+/-<imm12>}] ; p=1, w=0 |
710 // ldrb<c> <Rt>, [<Rn>], #+/-<imm12> ; p=1, w=1 | 711 // ldrb<c> <Rt>, [<Rn>], #+/-<imm12> ; p=1, w=1 |
711 // ldrb<c> <Rt>, [<Rn>, #+/-<imm12>]! ; p=0, w=1 | 712 // ldrb<c> <Rt>, [<Rn>, #+/-<imm12>]! ; p=0, w=1 |
712 // | 713 // |
713 // cccc010pubw1nnnnttttiiiiiiiiiiii where cccc=Cond, tttt=Rt, nnnn=Rn, | 714 // cccc010pubw1nnnnttttiiiiiiiiiiii where cccc=Cond, tttt=Rt, nnnn=Rn, |
714 // iiiiiiiiiiii=imm12, b=1 if STRB, u=1 if +. | 715 // iiiiiiiiiiii=imm12, b=1 if STRB, u=1 if +. |
715 constexpr bool IsLoad = true; | 716 constexpr bool IsLoad = true; |
716 const Type Ty = OpRt->getType(); | 717 const Type Ty = OpRt->getType(); |
717 if (!(Ty == IceType_i32 || Ty == IceType_i8)) // TODO(kschimpf) Expand? | 718 if (!(Ty == IceType_i32 || Ty == IceType_i8)) // TODO(kschimpf) Expand? |
718 return setNeedsTextFixup(); | 719 return setNeedsTextFixup(); |
719 const bool IsByte = typeWidthInBytes(Ty) == 1; | 720 const bool IsByte = isByteSizedType(Ty); |
720 // Check conditions of rules violated. | 721 // Check conditions of rules violated. |
721 if (getGPRReg(kRnShift, Address) == RegARM32::Encoded_Reg_pc) | 722 if (getGPRReg(kRnShift, Address) == RegARM32::Encoded_Reg_pc) |
722 return setNeedsTextFixup(); | 723 return setNeedsTextFixup(); |
723 if (!isBitSet(P, Address) && isBitSet(W, Address)) | 724 if (!isBitSet(P, Address) && isBitSet(W, Address)) |
724 return setNeedsTextFixup(); | 725 return setNeedsTextFixup(); |
725 if (!IsByte && (getGPRReg(kRnShift, Address) == RegARM32::Encoded_Reg_sp) && | 726 if (!IsByte && (getGPRReg(kRnShift, Address) == RegARM32::Encoded_Reg_sp) && |
726 !isBitSet(P, Address) && isBitSet(U, Address) & !isBitSet(W, Address) && | 727 !isBitSet(P, Address) && isBitSet(U, Address) & !isBitSet(W, Address) && |
727 (mask(Address, kImm12Shift, kImmed12Bits) == 0x8 /* 000000000100 */)) | 728 (mask(Address, kImm12Shift, kImmed12Bits) == 0x8 /* 000000000100 */)) |
728 return setNeedsTextFixup(); | 729 return setNeedsTextFixup(); |
729 emitMemOp(Cond, kInstTypeMemImmediate, IsLoad, IsByte, Rt, Address); | 730 emitMemOp(Cond, kInstTypeMemImmediate, IsLoad, IsByte, Rt, Address); |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
866 // strb<c> <Rt>, [<Rn>{, #+/-<imm12>}] ; p=1, w=0 | 867 // strb<c> <Rt>, [<Rn>{, #+/-<imm12>}] ; p=1, w=0 |
867 // strb<c> <Rt>, [<Rn>], #+/-<imm12> ; p=1, w=1 | 868 // strb<c> <Rt>, [<Rn>], #+/-<imm12> ; p=1, w=1 |
868 // strb<c> <Rt>, [<Rn>, #+/-<imm12>]! ; p=0, w=1 | 869 // strb<c> <Rt>, [<Rn>, #+/-<imm12>]! ; p=0, w=1 |
869 // | 870 // |
870 // cccc010pubw0nnnnttttiiiiiiiiiiii where cccc=Cond, tttt=Rt, nnnn=Rn, | 871 // cccc010pubw0nnnnttttiiiiiiiiiiii where cccc=Cond, tttt=Rt, nnnn=Rn, |
871 // iiiiiiiiiiii=imm12, b=1 if STRB, u=1 if +. | 872 // iiiiiiiiiiii=imm12, b=1 if STRB, u=1 if +. |
872 constexpr bool IsLoad = false; | 873 constexpr bool IsLoad = false; |
873 const Type Ty = OpRt->getType(); | 874 const Type Ty = OpRt->getType(); |
874 if (!(Ty == IceType_i32 || Ty == IceType_i8)) // TODO(kschimpf) Expand? | 875 if (!(Ty == IceType_i32 || Ty == IceType_i8)) // TODO(kschimpf) Expand? |
875 return setNeedsTextFixup(); | 876 return setNeedsTextFixup(); |
876 const bool IsByte = typeWidthInBytes(Ty) == 1; | 877 const bool IsByte = isByteSizedType(Ty); |
877 // Check for rule violations. | 878 // Check for rule violations. |
878 if ((getGPRReg(kRnShift, Address) == RegARM32::Encoded_Reg_pc)) | 879 if ((getGPRReg(kRnShift, Address) == RegARM32::Encoded_Reg_pc)) |
879 return setNeedsTextFixup(); | 880 return setNeedsTextFixup(); |
880 if (!isBitSet(P, Address) && isBitSet(W, Address)) | 881 if (!isBitSet(P, Address) && isBitSet(W, Address)) |
881 return setNeedsTextFixup(); | 882 return setNeedsTextFixup(); |
882 if (!IsByte && (getGPRReg(kRnShift, Address) == RegARM32::Encoded_Reg_sp) && | 883 if (!IsByte && (getGPRReg(kRnShift, Address) == RegARM32::Encoded_Reg_sp) && |
883 isBitSet(P, Address) && !isBitSet(U, Address) && isBitSet(W, Address) && | 884 isBitSet(P, Address) && !isBitSet(U, Address) && isBitSet(W, Address) && |
884 (mask(Address, kImm12Shift, kImmed12Bits) == 0x8 /* 000000000100 */)) | 885 (mask(Address, kImm12Shift, kImmed12Bits) == 0x8 /* 000000000100 */)) |
885 return setNeedsTextFixup(); | 886 return setNeedsTextFixup(); |
886 emitMemOp(Cond, kInstTypeMemImmediate, IsLoad, IsByte, Rt, Address); | 887 emitMemOp(Cond, kInstTypeMemImmediate, IsLoad, IsByte, Rt, Address); |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1043 // tst<c> <Rn>, #<RotatedImm8> | 1044 // tst<c> <Rn>, #<RotatedImm8> |
1044 // | 1045 // |
1045 // cccc00110001nnnn0000iiiiiiiiiiii where cccc=Cond, nnnn=Rn, and | 1046 // cccc00110001nnnn0000iiiiiiiiiiii where cccc=Cond, nnnn=Rn, and |
1046 // iiiiiiiiiiii defines RotatedImm8. | 1047 // iiiiiiiiiiii defines RotatedImm8. |
1047 constexpr IValueT Opcode = B3; // ie. 1000 | 1048 constexpr IValueT Opcode = B3; // ie. 1000 |
1048 emitCompareOp(Opcode, OpRn, OpSrc1, Cond); | 1049 emitCompareOp(Opcode, OpRn, OpSrc1, Cond); |
1049 } | 1050 } |
1050 | 1051 |
1051 } // end of namespace ARM32 | 1052 } // end of namespace ARM32 |
1052 } // end of namespace Ice | 1053 } // end of namespace Ice |
OLD | NEW |