Chromium Code Reviews| 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 20 matching lines...) Expand all Loading... | |
| 31 #include "IceConditionCodesARM32.h" | 31 #include "IceConditionCodesARM32.h" |
| 32 #include "IceDefs.h" | 32 #include "IceDefs.h" |
| 33 #include "IceFixups.h" | 33 #include "IceFixups.h" |
| 34 #include "IceInstARM32.h" | 34 #include "IceInstARM32.h" |
| 35 #include "IceRegistersARM32.h" | 35 #include "IceRegistersARM32.h" |
| 36 #include "IceTargetLowering.h" | 36 #include "IceTargetLowering.h" |
| 37 | 37 |
| 38 namespace Ice { | 38 namespace Ice { |
| 39 namespace ARM32 { | 39 namespace ARM32 { |
| 40 | 40 |
| 41 /// Encoding of an ARM 32-bit instruction. | |
| 42 using IValueT = uint32_t; | |
| 43 | |
| 44 /// An Offset value (+/-) used in an ARM 32-bit instruction. | |
| 45 using IOffsetT = int32_t; | |
| 46 | |
| 47 /// Handles encoding of bottom/top 16 bits of an address using movw/movt. | 41 /// Handles encoding of bottom/top 16 bits of an address using movw/movt. |
| 48 class MoveRelocatableFixup final : public AssemblerFixup { | 42 class MoveRelocatableFixup final : public AssemblerFixup { |
| 49 MoveRelocatableFixup &operator=(const MoveRelocatableFixup &) = delete; | 43 MoveRelocatableFixup &operator=(const MoveRelocatableFixup &) = delete; |
| 50 MoveRelocatableFixup(const MoveRelocatableFixup &) = default; | 44 MoveRelocatableFixup(const MoveRelocatableFixup &) = default; |
| 51 | 45 |
| 52 public: | 46 public: |
| 53 MoveRelocatableFixup() = default; | 47 MoveRelocatableFixup() = default; |
| 54 size_t emit(GlobalContext *Ctx, const Assembler &Asm) const final; | 48 size_t emit(GlobalContext *Ctx, const Assembler &Asm) const final; |
| 55 }; | 49 }; |
| 56 | 50 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 104 for (const Label *Label : LocalLabels) { | 98 for (const Label *Label : LocalLabels) { |
| 105 Label->finalCheck(); | 99 Label->finalCheck(); |
| 106 } | 100 } |
| 107 } | 101 } |
| 108 } | 102 } |
| 109 | 103 |
| 110 MoveRelocatableFixup *createMoveFixup(bool IsMovW, const Constant *Value); | 104 MoveRelocatableFixup *createMoveFixup(bool IsMovW, const Constant *Value); |
| 111 | 105 |
| 112 BlRelocatableFixup *createBlFixup(const ConstantRelocatable *BlTarget); | 106 BlRelocatableFixup *createBlFixup(const ConstantRelocatable *BlTarget); |
| 113 | 107 |
| 108 static IValueT getEncodedGPRegNum(const Variable *Var); | |
|
John
2016/01/06 16:10:21
can these be moved to anonymous namespaces within
Karl
2016/01/06 23:21:58
Moving back to anonymous namespace.
| |
| 109 | |
| 110 static IValueT getEncodedSRegNum(const Variable *Var); | |
| 111 | |
| 114 void alignFunction() override { | 112 void alignFunction() override { |
| 115 const SizeT Align = 1 << getBundleAlignLog2Bytes(); | 113 const SizeT Align = 1 << getBundleAlignLog2Bytes(); |
| 116 SizeT BytesNeeded = Utils::OffsetToAlignment(Buffer.getPosition(), Align); | 114 SizeT BytesNeeded = Utils::OffsetToAlignment(Buffer.getPosition(), Align); |
| 117 constexpr SizeT InstSize = sizeof(IValueT); | 115 constexpr SizeT InstSize = sizeof(IValueT); |
| 118 assert(BytesNeeded % InstARM32::InstSize == 0); | 116 assert(BytesNeeded % InstARM32::InstSize == 0); |
| 119 while (BytesNeeded > 0) { | 117 while (BytesNeeded > 0) { |
| 120 trap(); | 118 trap(); |
| 121 BytesNeeded -= InstSize; | 119 BytesNeeded -= InstSize; |
| 122 } | 120 } |
| 123 } | 121 } |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 248 void mul(const Operand *OpRd, const Operand *OpRn, const Operand *OpSrc1, | 246 void mul(const Operand *OpRd, const Operand *OpRn, const Operand *OpSrc1, |
| 249 bool SetFlags, CondARM32::Cond Cond); | 247 bool SetFlags, CondARM32::Cond Cond); |
| 250 | 248 |
| 251 void mvn(const Operand *OpRd, const Operand *OpScc, CondARM32::Cond Cond); | 249 void mvn(const Operand *OpRd, const Operand *OpScc, CondARM32::Cond Cond); |
| 252 | 250 |
| 253 void nop(); | 251 void nop(); |
| 254 | 252 |
| 255 void orr(const Operand *OpRd, const Operand *OpRn, const Operand *OpSrc1, | 253 void orr(const Operand *OpRd, const Operand *OpRn, const Operand *OpSrc1, |
| 256 bool SetFlags, CondARM32::Cond Cond); | 254 bool SetFlags, CondARM32::Cond Cond); |
| 257 | 255 |
| 258 void pop(const Operand *OpRt, CondARM32::Cond Cond); | 256 void pop(const Variable *OpRt, CondARM32::Cond Cond); |
| 259 | 257 |
| 260 // Note: Registers is a bitset, where bit n corresponds to register Rn. | 258 // Note: Registers is a bitset, where bit n corresponds to register Rn. |
| 261 void popList(const IValueT Registers, CondARM32::Cond Cond); | 259 void popList(const IValueT Registers, CondARM32::Cond Cond); |
| 262 | 260 |
| 263 void push(const Operand *OpRt, CondARM32::Cond Cond); | 261 void push(const Operand *OpRt, CondARM32::Cond Cond); |
| 264 | 262 |
| 265 // Note: Registers is a bitset, where bit n corresponds to register Rn. | 263 // Note: Registers is a bitset, where bit n corresponds to register Rn. |
| 266 void pushList(const IValueT Registers, CondARM32::Cond Cond); | 264 void pushList(const IValueT Registers, CondARM32::Cond Cond); |
| 267 | 265 |
| 268 void rbit(const Operand *OpRd, const Operand *OpRm, CondARM32::Cond Cond); | 266 void rbit(const Operand *OpRd, const Operand *OpRm, CondARM32::Cond Cond); |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 470 // where cccc=Cond, xxxxxxx<<21=Opcode, dddd=Rd, s=SetFlags, and | 468 // where cccc=Cond, xxxxxxx<<21=Opcode, dddd=Rd, s=SetFlags, and |
| 471 // iiiiiiiiiiiiiiii=Imm16. | 469 // iiiiiiiiiiiiiiii=Imm16. |
| 472 void emitMovwt(CondARM32::Cond Cond, bool IsMovw, const Operand *OpRd, | 470 void emitMovwt(CondARM32::Cond Cond, bool IsMovw, const Operand *OpRd, |
| 473 const Operand *OpSrc, const char *MovName); | 471 const Operand *OpSrc, const char *MovName); |
| 474 }; | 472 }; |
| 475 | 473 |
| 476 } // end of namespace ARM32 | 474 } // end of namespace ARM32 |
| 477 } // end of namespace Ice | 475 } // end of namespace Ice |
| 478 | 476 |
| 479 #endif // SUBZERO_SRC_ICEASSEMBLERARM32_H | 477 #endif // SUBZERO_SRC_ICEASSEMBLERARM32_H |
| OLD | NEW |