| 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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 } | 107 } |
| 108 } | 108 } |
| 109 | 109 |
| 110 MoveRelocatableFixup *createMoveFixup(bool IsMovW, const Constant *Value); | 110 MoveRelocatableFixup *createMoveFixup(bool IsMovW, const Constant *Value); |
| 111 | 111 |
| 112 BlRelocatableFixup *createBlFixup(const ConstantRelocatable *BlTarget); | 112 BlRelocatableFixup *createBlFixup(const ConstantRelocatable *BlTarget); |
| 113 | 113 |
| 114 void alignFunction() override { | 114 void alignFunction() override { |
| 115 const SizeT Align = 1 << getBundleAlignLog2Bytes(); | 115 const SizeT Align = 1 << getBundleAlignLog2Bytes(); |
| 116 SizeT BytesNeeded = Utils::OffsetToAlignment(Buffer.getPosition(), Align); | 116 SizeT BytesNeeded = Utils::OffsetToAlignment(Buffer.getPosition(), Align); |
| 117 constexpr IValueT UndefinedInst = 0xe7fedef0; // udf #60896 | |
| 118 constexpr SizeT InstSize = sizeof(IValueT); | 117 constexpr SizeT InstSize = sizeof(IValueT); |
| 119 assert(BytesNeeded % InstARM32::InstSize == 0); | 118 assert(BytesNeeded % InstARM32::InstSize == 0); |
| 120 while (BytesNeeded > 0) { | 119 while (BytesNeeded > 0) { |
| 121 AssemblerBuffer::EnsureCapacity ensured(&Buffer); | 120 trap(); |
| 122 emitInst(UndefinedInst); | |
| 123 BytesNeeded -= InstSize; | 121 BytesNeeded -= InstSize; |
| 124 } | 122 } |
| 125 } | 123 } |
| 126 | 124 |
| 127 SizeT getBundleAlignLog2Bytes() const override { return 4; } | 125 SizeT getBundleAlignLog2Bytes() const override { return 4; } |
| 128 | 126 |
| 129 const char *getAlignDirective() const override { return ".p2alignl"; } | 127 const char *getAlignDirective() const override { return ".p2alignl"; } |
| 130 | 128 |
| 131 llvm::ArrayRef<uint8_t> getNonExecBundlePadding() const override { | 129 llvm::ArrayRef<uint8_t> getNonExecBundlePadding() const override; |
| 132 // Use a particular UDF encoding -- TRAPNaCl in LLVM: 0xE7FEDEF0 | |
| 133 // http://llvm.org/viewvc/llvm-project?view=revision&revision=173943 | |
| 134 static const uint8_t Padding[] = {0xE7, 0xFE, 0xDE, 0xF0}; | |
| 135 return llvm::ArrayRef<uint8_t>(Padding, 4); | |
| 136 } | |
| 137 | 130 |
| 138 void padWithNop(intptr_t Padding) override; | 131 void padWithNop(intptr_t Padding) override; |
| 139 | 132 |
| 140 Ice::Label *getCfgNodeLabel(SizeT NodeNumber) override { | 133 Ice::Label *getCfgNodeLabel(SizeT NodeNumber) override { |
| 141 assert(NodeNumber < CfgNodeLabels.size()); | 134 assert(NodeNumber < CfgNodeLabels.size()); |
| 142 return CfgNodeLabels[NodeNumber]; | 135 return CfgNodeLabels[NodeNumber]; |
| 143 } | 136 } |
| 144 | 137 |
| 145 Label *getOrCreateCfgNodeLabel(SizeT NodeNumber) { | 138 Label *getOrCreateCfgNodeLabel(SizeT NodeNumber) { |
| 146 return getOrCreateLabel(NodeNumber, CfgNodeLabels); | 139 return getOrCreateLabel(NodeNumber, CfgNodeLabels); |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 const TargetInfo TInfo(Lowering); | 293 const TargetInfo TInfo(Lowering); |
| 301 strex(OpRd, OpRt, OpAddress, Cond, TInfo); | 294 strex(OpRd, OpRt, OpAddress, Cond, TInfo); |
| 302 } | 295 } |
| 303 | 296 |
| 304 void sub(const Operand *OpRd, const Operand *OpRn, const Operand *OpSrc1, | 297 void sub(const Operand *OpRd, const Operand *OpRn, const Operand *OpSrc1, |
| 305 bool SetFlags, CondARM32::Cond Cond); | 298 bool SetFlags, CondARM32::Cond Cond); |
| 306 | 299 |
| 307 // Implements sxtb/sxth depending on type of OpSrc0. | 300 // Implements sxtb/sxth depending on type of OpSrc0. |
| 308 void sxt(const Operand *OpRd, const Operand *OpSrc0, CondARM32::Cond Cond); | 301 void sxt(const Operand *OpRd, const Operand *OpSrc0, CondARM32::Cond Cond); |
| 309 | 302 |
| 303 void trap(); |
| 304 |
| 310 void tst(const Operand *OpRn, const Operand *OpSrc1, CondARM32::Cond Cond); | 305 void tst(const Operand *OpRn, const Operand *OpSrc1, CondARM32::Cond Cond); |
| 311 | 306 |
| 312 void udiv(const Operand *OpRd, const Operand *OpRn, const Operand *OpSrc1, | 307 void udiv(const Operand *OpRd, const Operand *OpRn, const Operand *OpSrc1, |
| 313 CondARM32::Cond Cond); | 308 CondARM32::Cond Cond); |
| 314 | 309 |
| 315 void umull(const Operand *OpRdLo, const Operand *OpRdHi, const Operand *OpRn, | 310 void umull(const Operand *OpRdLo, const Operand *OpRdHi, const Operand *OpRn, |
| 316 const Operand *OpRm, CondARM32::Cond Cond); | 311 const Operand *OpRm, CondARM32::Cond Cond); |
| 317 | 312 |
| 318 // Implements uxtb/uxth depending on type of OpSrc0. | 313 // Implements uxtb/uxth depending on type of OpSrc0. |
| 319 void uxt(const Operand *OpRd, const Operand *OpSrc0, CondARM32::Cond Cond); | 314 void uxt(const Operand *OpRd, const Operand *OpSrc0, CondARM32::Cond Cond); |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 451 // where cccc=Cond, xxxxxxx<<21=Opcode, dddd=Rd, s=SetFlags, and | 446 // where cccc=Cond, xxxxxxx<<21=Opcode, dddd=Rd, s=SetFlags, and |
| 452 // iiiiiiiiiiiiiiii=Imm16. | 447 // iiiiiiiiiiiiiiii=Imm16. |
| 453 void emitMovwt(CondARM32::Cond Cond, bool IsMovw, const Operand *OpRd, | 448 void emitMovwt(CondARM32::Cond Cond, bool IsMovw, const Operand *OpRd, |
| 454 const Operand *OpSrc, const char *MovName); | 449 const Operand *OpSrc, const char *MovName); |
| 455 }; | 450 }; |
| 456 | 451 |
| 457 } // end of namespace ARM32 | 452 } // end of namespace ARM32 |
| 458 } // end of namespace Ice | 453 } // end of namespace Ice |
| 459 | 454 |
| 460 #endif // SUBZERO_SRC_ICEASSEMBLERARM32_H | 455 #endif // SUBZERO_SRC_ICEASSEMBLERARM32_H |
| OLD | NEW |