| 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 &Target); |
| 195 |
| 196 void ldr(const Operand *OpRt, const Operand *OpAddress, CondARM32::Cond Cond, |
| 197 const TargetLowering *Lowering) { |
| 198 TargetInfo Target(Lowering); |
| 199 ldr(OpRt, OpAddress, Cond, Target); |
| 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 |
| 186 void mul(const Operand *OpRd, const Operand *OpRn, const Operand *OpSrc1, | 211 void mul(const Operand *OpRd, const Operand *OpRn, const Operand *OpSrc1, |
| 187 bool SetFlags, CondARM32::Cond Cond); | 212 bool SetFlags, CondARM32::Cond Cond); |
| 188 | 213 |
| 189 void orr(const Operand *OpRd, const Operand *OpRn, const Operand *OpSrc1, | 214 void orr(const Operand *OpRd, const Operand *OpRn, const Operand *OpSrc1, |
| 190 bool SetFlags, CondARM32::Cond Cond); | 215 bool SetFlags, CondARM32::Cond Cond); |
| 191 | 216 |
| 192 void push(const Operand *OpRt, CondARM32::Cond Cond); | 217 void push(const Operand *OpRt, CondARM32::Cond Cond); |
| 193 | 218 |
| 194 // Note: Registers is a bitset, where bit n corresponds to register Rn. | 219 // Note: Registers is a bitset, where bit n corresponds to register Rn. |
| 195 void pushList(const IValueT Registers, CondARM32::Cond Cond); | 220 void pushList(const IValueT Registers, CondARM32::Cond Cond); |
| 196 | 221 |
| 197 void sbc(const Operand *OpRd, const Operand *OpRn, const Operand *OpSrc1, | 222 void sbc(const Operand *OpRd, const Operand *OpRn, const Operand *OpSrc1, |
| 198 bool SetFlags, CondARM32::Cond Cond); | 223 bool SetFlags, CondARM32::Cond Cond); |
| 199 | 224 |
| 200 void sdiv(const Operand *OpRd, const Operand *OpRn, const Operand *OpSrc1, | 225 void sdiv(const Operand *OpRd, const Operand *OpRn, const Operand *OpSrc1, |
| 201 CondARM32::Cond Cond); | 226 CondARM32::Cond Cond); |
| 202 | 227 |
| 203 void str(const Operand *OpRt, const Operand *OpAddress, CondARM32::Cond Cond); | 228 void str(const Operand *OpRt, const Operand *OpAddress, CondARM32::Cond Cond, |
| 229 const TargetInfo &Target); |
| 230 |
| 231 void str(const Operand *OpRt, const Operand *OpAddress, CondARM32::Cond Cond, |
| 232 const TargetLowering *Lowering) { |
| 233 TargetInfo Target(Lowering); |
| 234 str(OpRt, OpAddress, Cond, Target); |
| 235 } |
| 204 | 236 |
| 205 void sub(const Operand *OpRd, const Operand *OpRn, const Operand *OpSrc1, | 237 void sub(const Operand *OpRd, const Operand *OpRn, const Operand *OpSrc1, |
| 206 bool SetFlags, CondARM32::Cond Cond); | 238 bool SetFlags, CondARM32::Cond Cond); |
| 207 | 239 |
| 208 void tst(const Operand *OpRn, const Operand *OpSrc1, CondARM32::Cond Cond); | 240 void tst(const Operand *OpRn, const Operand *OpSrc1, CondARM32::Cond Cond); |
| 209 | 241 |
| 210 void udiv(const Operand *OpRd, const Operand *OpRn, const Operand *OpSrc1, | 242 void udiv(const Operand *OpRd, const Operand *OpRn, const Operand *OpSrc1, |
| 211 CondARM32::Cond Cond); | 243 CondARM32::Cond Cond); |
| 212 | 244 |
| 213 void umull(const Operand *OpRdLo, const Operand *OpRdHi, const Operand *OpRn, | 245 void umull(const Operand *OpRdLo, const Operand *OpRdHi, const Operand *OpRn, |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 IValueT encodeBranchOffset(IOffsetT Offset, IValueT Inst); | 340 IValueT encodeBranchOffset(IOffsetT Offset, IValueT Inst); |
| 309 | 341 |
| 310 // Returns the offset encoded in the branch instruction Inst. | 342 // Returns the offset encoded in the branch instruction Inst. |
| 311 static IOffsetT decodeBranchOffset(IValueT Inst); | 343 static IOffsetT decodeBranchOffset(IValueT Inst); |
| 312 }; | 344 }; |
| 313 | 345 |
| 314 } // end of namespace ARM32 | 346 } // end of namespace ARM32 |
| 315 } // end of namespace Ice | 347 } // end of namespace Ice |
| 316 | 348 |
| 317 #endif // SUBZERO_SRC_ICEASSEMBLERARM32_H | 349 #endif // SUBZERO_SRC_ICEASSEMBLERARM32_H |
| OLD | NEW |