OLD | NEW |
1 //===- subzero/src/IceAssemblerARM32.h - Assembler for ARM32 ----*- C++ -*-===// | 1 //===- subzero/src/IceAssemblerARM32.h - 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 public: | 52 public: |
53 MoveRelocatableFixup() = default; | 53 MoveRelocatableFixup() = default; |
54 size_t emit(GlobalContext *Ctx, const Assembler &Asm) const override; | 54 size_t emit(GlobalContext *Ctx, const Assembler &Asm) const override; |
55 }; | 55 }; |
56 | 56 |
57 class AssemblerARM32 : public Assembler { | 57 class AssemblerARM32 : public Assembler { |
58 AssemblerARM32(const AssemblerARM32 &) = delete; | 58 AssemblerARM32(const AssemblerARM32 &) = delete; |
59 AssemblerARM32 &operator=(const AssemblerARM32 &) = delete; | 59 AssemblerARM32 &operator=(const AssemblerARM32 &) = delete; |
60 | 60 |
61 public: | 61 public: |
| 62 // Rotation values. |
| 63 enum RotationValue { |
| 64 kRotateNone, // Omitted |
| 65 kRotate8, // ror #8 |
| 66 kRotate16, // ror #16 |
| 67 kRotate24 // ror #24 |
| 68 }; |
| 69 |
62 class TargetInfo { | 70 class TargetInfo { |
63 TargetInfo(const TargetInfo &) = delete; | 71 TargetInfo(const TargetInfo &) = delete; |
64 TargetInfo &operator=(const TargetInfo &) = delete; | 72 TargetInfo &operator=(const TargetInfo &) = delete; |
65 | 73 |
66 public: | 74 public: |
67 TargetInfo(bool HasFramePointer, SizeT FrameOrStackReg, | 75 TargetInfo(bool HasFramePointer, SizeT FrameOrStackReg, |
68 int32_t StackAdjustment) | 76 int32_t StackAdjustment) |
69 : HasFramePointer(HasFramePointer), FrameOrStackReg(FrameOrStackReg), | 77 : HasFramePointer(HasFramePointer), FrameOrStackReg(FrameOrStackReg), |
70 StackAdjustment(StackAdjustment) {} | 78 StackAdjustment(StackAdjustment) {} |
71 explicit TargetInfo(const TargetLowering *Target) | 79 explicit TargetInfo(const TargetLowering *Target) |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 bool SetFlags, CondARM32::Cond Cond); | 251 bool SetFlags, CondARM32::Cond Cond); |
244 | 252 |
245 void tst(const Operand *OpRn, const Operand *OpSrc1, CondARM32::Cond Cond); | 253 void tst(const Operand *OpRn, const Operand *OpSrc1, CondARM32::Cond Cond); |
246 | 254 |
247 void udiv(const Operand *OpRd, const Operand *OpRn, const Operand *OpSrc1, | 255 void udiv(const Operand *OpRd, const Operand *OpRn, const Operand *OpSrc1, |
248 CondARM32::Cond Cond); | 256 CondARM32::Cond Cond); |
249 | 257 |
250 void umull(const Operand *OpRdLo, const Operand *OpRdHi, const Operand *OpRn, | 258 void umull(const Operand *OpRdLo, const Operand *OpRdHi, const Operand *OpRn, |
251 const Operand *OpRm, CondARM32::Cond Cond); | 259 const Operand *OpRm, CondARM32::Cond Cond); |
252 | 260 |
| 261 // Implements uxtb/uxth depending on type of OpSrc0. |
| 262 void uxt(const Operand *OpRd, const Operand *OpSrc0, CondARM32::Cond Cond); |
| 263 |
253 static bool classof(const Assembler *Asm) { | 264 static bool classof(const Assembler *Asm) { |
254 return Asm->getKind() == Asm_ARM32; | 265 return Asm->getKind() == Asm_ARM32; |
255 } | 266 } |
256 | 267 |
257 void emitTextInst(const std::string &Text, SizeT InstSize); | 268 void emitTextInst(const std::string &Text, SizeT InstSize); |
258 | 269 |
259 private: | 270 private: |
260 // A vector of pool-allocated x86 labels for CFG nodes. | 271 // A vector of pool-allocated x86 labels for CFG nodes. |
261 using LabelVector = std::vector<Label *>; | 272 using LabelVector = std::vector<Label *>; |
262 LabelVector CfgNodeLabels; | 273 LabelVector CfgNodeLabels; |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
326 // Pattern cccc011100x1dddd1111mmmm0001nnn where cccc=Cond, | 337 // Pattern cccc011100x1dddd1111mmmm0001nnn where cccc=Cond, |
327 // x=Opcode, dddd=Rd, nnnn=Rn, mmmm=Rm. | 338 // x=Opcode, dddd=Rd, nnnn=Rn, mmmm=Rm. |
328 void emitDivOp(CondARM32::Cond Cond, IValueT Opcode, IValueT Rd, IValueT Rn, | 339 void emitDivOp(CondARM32::Cond Cond, IValueT Opcode, IValueT Rd, IValueT Rn, |
329 IValueT Rm); | 340 IValueT Rm); |
330 | 341 |
331 // Pattern ccccxxxxxxxfnnnnddddssss1001mmmm where cccc=Cond, dddd=Rd, nnnn=Rn, | 342 // Pattern ccccxxxxxxxfnnnnddddssss1001mmmm where cccc=Cond, dddd=Rd, nnnn=Rn, |
332 // mmmm=Rm, ssss=Rs, f=SetCc, and xxxxxxx=Opcode. | 343 // mmmm=Rm, ssss=Rs, f=SetCc, and xxxxxxx=Opcode. |
333 void emitMulOp(CondARM32::Cond Cond, IValueT Opcode, IValueT Rd, IValueT Rn, | 344 void emitMulOp(CondARM32::Cond Cond, IValueT Opcode, IValueT Rd, IValueT Rn, |
334 IValueT Rm, IValueT Rs, bool SetCc); | 345 IValueT Rm, IValueT Rs, bool SetCc); |
335 | 346 |
| 347 // Implements various forms of Unsigned extend value, using pattern |
| 348 // ccccxxxxxxxxnnnnddddrr000111mmmm where cccc=Cond, xxxxxxxx<<20=Opcode, |
| 349 // nnnn=Rn, dddd=Rd, rr=Rotation, and mmmm=Rm. |
| 350 void emitUxt(CondARM32::Cond, IValueT Opcode, IValueT Rd, IValueT Rn, |
| 351 IValueT Rm, RotationValue Rotation); |
| 352 |
336 // Pattern cccctttxxxxnnnn0000iiiiiiiiiiii where cccc=Cond, nnnn=Rn, | 353 // Pattern cccctttxxxxnnnn0000iiiiiiiiiiii where cccc=Cond, nnnn=Rn, |
337 // ttt=Instruction type (derived from OpSrc1), iiiiiiiiiiii is derived from | 354 // ttt=Instruction type (derived from OpSrc1), iiiiiiiiiiii is derived from |
338 // OpSrc1, and xxxx=Opcode. | 355 // OpSrc1, and xxxx=Opcode. |
339 void emitCompareOp(IValueT Opcode, const Operand *OpRn, const Operand *OpSrc1, | 356 void emitCompareOp(IValueT Opcode, const Operand *OpRn, const Operand *OpSrc1, |
340 CondARM32::Cond Cond); | 357 CondARM32::Cond Cond); |
341 | 358 |
342 void emitBranch(Label *L, CondARM32::Cond, bool Link); | 359 void emitBranch(Label *L, CondARM32::Cond, bool Link); |
343 | 360 |
344 // Encodes the given Offset into the branch instruction Inst. | 361 // Encodes the given Offset into the branch instruction Inst. |
345 IValueT encodeBranchOffset(IOffsetT Offset, IValueT Inst); | 362 IValueT encodeBranchOffset(IOffsetT Offset, IValueT Inst); |
346 | 363 |
347 // Returns the offset encoded in the branch instruction Inst. | 364 // Returns the offset encoded in the branch instruction Inst. |
348 static IOffsetT decodeBranchOffset(IValueT Inst); | 365 static IOffsetT decodeBranchOffset(IValueT Inst); |
349 | 366 |
350 // Implements movw, generating pattern ccccxxxxxxxsiiiiddddiiiiiiiiiiii where | 367 // Implements movw, generating pattern ccccxxxxxxxsiiiiddddiiiiiiiiiiii where |
351 // cccc=Cond, xxxxxxx<<21=Opcode, dddd=Rd, s=SetFlags, and | 368 // cccc=Cond, xxxxxxx<<21=Opcode, dddd=Rd, s=SetFlags, and |
352 // iiiiiiiiiiiiiiii=Imm16. | 369 // iiiiiiiiiiiiiiii=Imm16. |
353 void emitMovw(IValueT Opcode, IValueT Rd, IValueT Imm16, bool SetFlags, | 370 void emitMovw(IValueT Opcode, IValueT Rd, IValueT Imm16, bool SetFlags, |
354 CondARM32::Cond Cond); | 371 CondARM32::Cond Cond); |
355 }; | 372 }; |
356 | 373 |
357 } // end of namespace ARM32 | 374 } // end of namespace ARM32 |
358 } // end of namespace Ice | 375 } // end of namespace Ice |
359 | 376 |
360 #endif // SUBZERO_SRC_ICEASSEMBLERARM32_H | 377 #endif // SUBZERO_SRC_ICEASSEMBLERARM32_H |
OLD | NEW |