| 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 class TargetInfo { |
| 63 TargetInfo(const TargetInfo &) = delete; |
| 64 TargetInfo &operator=(const TargetInfo &) = delete; |
| 65 |
| 66 public: |
| 67 TargetInfo(bool HasFramePointer, SizeT FrameOrStackReg, |
| 68 int32_t StackAdjustment) |
| 69 : HasFramePointer(HasFramePointer), FrameOrStackReg(FrameOrStackReg), |
| 70 StackAdjustment(StackAdjustment) {} |
| 71 explicit TargetInfo(const TargetLowering *Target) |
| 72 : HasFramePointer(Target->hasFramePointer()), |
| 73 FrameOrStackReg(Target->getFrameOrStackReg()), |
| 74 StackAdjustment(Target->getStackAdjustment()) {} |
| 75 const bool HasFramePointer; |
| 76 const SizeT FrameOrStackReg; |
| 77 const int32_t StackAdjustment; |
| 78 }; |
| 79 |
| 62 explicit AssemblerARM32(bool use_far_branches = false) | 80 explicit AssemblerARM32(bool use_far_branches = false) |
| 63 : Assembler(Asm_ARM32) { | 81 : Assembler(Asm_ARM32) { |
| 64 // TODO(kschimpf): Add mode if needed when branches are handled. | 82 // TODO(kschimpf): Add mode if needed when branches are handled. |
| 65 (void)use_far_branches; | 83 (void)use_far_branches; |
| 66 } | 84 } |
| 67 ~AssemblerARM32() override { | 85 ~AssemblerARM32() override { |
| 68 if (BuildDefs::asserts()) { | 86 if (BuildDefs::asserts()) { |
| 69 for (const Label *Label : CfgNodeLabels) { | 87 for (const Label *Label : CfgNodeLabels) { |
| 70 Label->finalCheck(); | 88 Label->finalCheck(); |
| 71 } | 89 } |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 void bkpt(uint16_t Imm16); | 183 void bkpt(uint16_t Imm16); |
| 166 | 184 |
| 167 void cmp(const Operand *OpRn, const Operand *OpSrc1, CondARM32::Cond Cond); | 185 void cmp(const Operand *OpRn, const Operand *OpSrc1, CondARM32::Cond Cond); |
| 168 | 186 |
| 169 void bic(const Operand *OpRd, const Operand *OpRn, const Operand *OpSrc1, | 187 void bic(const Operand *OpRd, const Operand *OpRn, const Operand *OpSrc1, |
| 170 bool SetFlags, CondARM32::Cond Cond); | 188 bool SetFlags, CondARM32::Cond Cond); |
| 171 | 189 |
| 172 void eor(const Operand *OpRd, const Operand *OpRn, const Operand *OpSrc1, | 190 void eor(const Operand *OpRd, const Operand *OpRn, const Operand *OpSrc1, |
| 173 bool SetFlags, CondARM32::Cond Cond); | 191 bool SetFlags, CondARM32::Cond Cond); |
| 174 | 192 |
| 175 void ldr(const Operand *OpRt, const Operand *OpAddress, CondARM32::Cond Cond); | 193 void ldr(const Operand *OpRt, const Operand *OpAddress, CondARM32::Cond Cond, |
| 194 const TargetInfo &TInfo); |
| 195 |
| 196 void ldr(const Operand *OpRt, const Operand *OpAddress, CondARM32::Cond Cond, |
| 197 const TargetLowering *Lowering) { |
| 198 const TargetInfo TInfo(Lowering); |
| 199 ldr(OpRt, OpAddress, Cond, TInfo); |
| 200 } |
| 176 | 201 |
| 177 void mov(const Operand *OpRd, const Operand *OpSrc, CondARM32::Cond Cond); | 202 void mov(const Operand *OpRd, const Operand *OpSrc, CondARM32::Cond Cond); |
| 178 | 203 |
| 179 void movw(const Operand *OpRd, const Operand *OpSrc, CondARM32::Cond Cond); | 204 void movw(const Operand *OpRd, const Operand *OpSrc, CondARM32::Cond Cond); |
| 180 | 205 |
| 181 void movt(const Operand *OpRd, const Operand *OpSrc, CondARM32::Cond Cond); | 206 void movt(const Operand *OpRd, const Operand *OpSrc, CondARM32::Cond Cond); |
| 182 | 207 |
| 183 void mla(const Operand *OpRd, const Operand *OpRn, const Operand *OpRm, | 208 void mla(const Operand *OpRd, const Operand *OpRn, const Operand *OpRm, |
| 184 const Operand *OpRa, CondARM32::Cond Cond); | 209 const Operand *OpRa, CondARM32::Cond Cond); |
| 185 | 210 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 198 | 223 |
| 199 // Note: Registers is a bitset, where bit n corresponds to register Rn. | 224 // Note: Registers is a bitset, where bit n corresponds to register Rn. |
| 200 void pushList(const IValueT Registers, CondARM32::Cond Cond); | 225 void pushList(const IValueT Registers, CondARM32::Cond Cond); |
| 201 | 226 |
| 202 void sbc(const Operand *OpRd, const Operand *OpRn, const Operand *OpSrc1, | 227 void sbc(const Operand *OpRd, const Operand *OpRn, const Operand *OpSrc1, |
| 203 bool SetFlags, CondARM32::Cond Cond); | 228 bool SetFlags, CondARM32::Cond Cond); |
| 204 | 229 |
| 205 void sdiv(const Operand *OpRd, const Operand *OpRn, const Operand *OpSrc1, | 230 void sdiv(const Operand *OpRd, const Operand *OpRn, const Operand *OpSrc1, |
| 206 CondARM32::Cond Cond); | 231 CondARM32::Cond Cond); |
| 207 | 232 |
| 208 void str(const Operand *OpRt, const Operand *OpAddress, CondARM32::Cond Cond); | 233 void str(const Operand *OpRt, const Operand *OpAddress, CondARM32::Cond Cond, |
| 234 const TargetInfo &TInfo); |
| 235 |
| 236 void str(const Operand *OpRt, const Operand *OpAddress, CondARM32::Cond Cond, |
| 237 const TargetLowering *Lowering) { |
| 238 const TargetInfo TInfo(Lowering); |
| 239 str(OpRt, OpAddress, Cond, TInfo); |
| 240 } |
| 209 | 241 |
| 210 void sub(const Operand *OpRd, const Operand *OpRn, const Operand *OpSrc1, | 242 void sub(const Operand *OpRd, const Operand *OpRn, const Operand *OpSrc1, |
| 211 bool SetFlags, CondARM32::Cond Cond); | 243 bool SetFlags, CondARM32::Cond Cond); |
| 212 | 244 |
| 213 void tst(const Operand *OpRn, const Operand *OpSrc1, CondARM32::Cond Cond); | 245 void tst(const Operand *OpRn, const Operand *OpSrc1, CondARM32::Cond Cond); |
| 214 | 246 |
| 215 void udiv(const Operand *OpRd, const Operand *OpRn, const Operand *OpSrc1, | 247 void udiv(const Operand *OpRd, const Operand *OpRn, const Operand *OpSrc1, |
| 216 CondARM32::Cond Cond); | 248 CondARM32::Cond Cond); |
| 217 | 249 |
| 218 void umull(const Operand *OpRdLo, const Operand *OpRdHi, const Operand *OpRn, | 250 void umull(const Operand *OpRdLo, const Operand *OpRdHi, const Operand *OpRn, |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 319 // cccc=Cond, xxxxxxx<<21=Opcode, dddd=Rd, s=SetFlags, and | 351 // cccc=Cond, xxxxxxx<<21=Opcode, dddd=Rd, s=SetFlags, and |
| 320 // iiiiiiiiiiiiiiii=Imm16. | 352 // iiiiiiiiiiiiiiii=Imm16. |
| 321 void emitMovw(IValueT Opcode, IValueT Rd, IValueT Imm16, bool SetFlags, | 353 void emitMovw(IValueT Opcode, IValueT Rd, IValueT Imm16, bool SetFlags, |
| 322 CondARM32::Cond Cond); | 354 CondARM32::Cond Cond); |
| 323 }; | 355 }; |
| 324 | 356 |
| 325 } // end of namespace ARM32 | 357 } // end of namespace ARM32 |
| 326 } // end of namespace Ice | 358 } // end of namespace Ice |
| 327 | 359 |
| 328 #endif // SUBZERO_SRC_ICEASSEMBLERARM32_H | 360 #endif // SUBZERO_SRC_ICEASSEMBLERARM32_H |
| OLD | NEW |