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 1855 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1866 // sub{s}<c> sp, <Rn>, #<RotatedImm8> | 1866 // sub{s}<c> sp, <Rn>, #<RotatedImm8> |
1867 // | 1867 // |
1868 // cccc0010010snnnnddddiiiiiiiiiiii where cccc=Cond, dddd=Rd, nnnn=Rn, | 1868 // cccc0010010snnnnddddiiiiiiiiiiii where cccc=Cond, dddd=Rd, nnnn=Rn, |
1869 // s=SetFlags and iiiiiiiiiiii=Src1Value defining RotatedImm8 | 1869 // s=SetFlags and iiiiiiiiiiii=Src1Value defining RotatedImm8 |
1870 constexpr const char *SubName = "sub"; | 1870 constexpr const char *SubName = "sub"; |
1871 constexpr IValueT SubOpcode = B1; // 0010 | 1871 constexpr IValueT SubOpcode = B1; // 0010 |
1872 emitType01(Cond, SubOpcode, OpRd, OpRn, OpSrc1, SetFlags, RdIsPcAndSetFlags, | 1872 emitType01(Cond, SubOpcode, OpRd, OpRn, OpSrc1, SetFlags, RdIsPcAndSetFlags, |
1873 SubName); | 1873 SubName); |
1874 } | 1874 } |
1875 | 1875 |
| 1876 namespace { |
| 1877 |
| 1878 // Use a particular UDF encoding -- TRAPNaCl in LLVM: 0xE7FEDEF0 |
| 1879 // http://llvm.org/viewvc/llvm-project?view=revision&revision=173943 |
| 1880 const uint8_t TrapBytesRaw[] = {0xE7, 0xFE, 0xDE, 0xF0}; |
| 1881 |
| 1882 const auto TrapBytes = |
| 1883 llvm::ArrayRef<uint8_t>(TrapBytesRaw, llvm::array_lengthof(TrapBytesRaw)); |
| 1884 |
| 1885 } // end of anonymous namespace |
| 1886 |
| 1887 llvm::ArrayRef<uint8_t> AssemblerARM32::getNonExecBundlePadding() const { |
| 1888 return TrapBytes; |
| 1889 } |
| 1890 |
| 1891 void AssemblerARM32::trap() { |
| 1892 AssemblerBuffer::EnsureCapacity ensured(&Buffer); |
| 1893 for (const uint8_t &Byte : reverse_range(TrapBytes)) |
| 1894 Buffer.emit<uint8_t>(Byte); |
| 1895 } |
| 1896 |
1876 void AssemblerARM32::tst(const Operand *OpRn, const Operand *OpSrc1, | 1897 void AssemblerARM32::tst(const Operand *OpRn, const Operand *OpSrc1, |
1877 CondARM32::Cond Cond) { | 1898 CondARM32::Cond Cond) { |
1878 // TST (register) - ARM section A8.8.241, encoding A1: | 1899 // TST (register) - ARM section A8.8.241, encoding A1: |
1879 // tst<c> <Rn>, <Rm>(, <shift>} | 1900 // tst<c> <Rn>, <Rm>(, <shift>} |
1880 // | 1901 // |
1881 // cccc00010001nnnn0000iiiiitt0mmmm where cccc=Cond, nnnn=Rn, mmmm=Rm, | 1902 // cccc00010001nnnn0000iiiiitt0mmmm where cccc=Cond, nnnn=Rn, mmmm=Rm, |
1882 // iiiii=Shift, and tt=ShiftKind. | 1903 // iiiii=Shift, and tt=ShiftKind. |
1883 // | 1904 // |
1884 // TST (immediate) - ARM section A8.8.240, encoding A1: | 1905 // TST (immediate) - ARM section A8.8.240, encoding A1: |
1885 // tst<c> <Rn>, #<RotatedImm8> | 1906 // tst<c> <Rn>, #<RotatedImm8> |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1935 | 1956 |
1936 void AssemblerARM32::uxt(const Operand *OpRd, const Operand *OpSrc0, | 1957 void AssemblerARM32::uxt(const Operand *OpRd, const Operand *OpSrc0, |
1937 CondARM32::Cond Cond) { | 1958 CondARM32::Cond Cond) { |
1938 constexpr const char *UxtName = "uxt"; | 1959 constexpr const char *UxtName = "uxt"; |
1939 constexpr IValueT UxtOpcode = B26 | B25 | B23 | B22 | B21; | 1960 constexpr IValueT UxtOpcode = B26 | B25 | B23 | B22 | B21; |
1940 emitSignExtend(Cond, UxtOpcode, OpRd, OpSrc0, UxtName); | 1961 emitSignExtend(Cond, UxtOpcode, OpRd, OpSrc0, UxtName); |
1941 } | 1962 } |
1942 | 1963 |
1943 } // end of namespace ARM32 | 1964 } // end of namespace ARM32 |
1944 } // end of namespace Ice | 1965 } // end of namespace Ice |
OLD | NEW |