| 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 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 | 216 |
| 217 void ldr(const Operand *OpRt, const Operand *OpAddress, CondARM32::Cond Cond, | 217 void ldr(const Operand *OpRt, const Operand *OpAddress, CondARM32::Cond Cond, |
| 218 const TargetInfo &TInfo); | 218 const TargetInfo &TInfo); |
| 219 | 219 |
| 220 void ldr(const Operand *OpRt, const Operand *OpAddress, CondARM32::Cond Cond, | 220 void ldr(const Operand *OpRt, const Operand *OpAddress, CondARM32::Cond Cond, |
| 221 const TargetLowering *Lowering) { | 221 const TargetLowering *Lowering) { |
| 222 const TargetInfo TInfo(Lowering); | 222 const TargetInfo TInfo(Lowering); |
| 223 ldr(OpRt, OpAddress, Cond, TInfo); | 223 ldr(OpRt, OpAddress, Cond, TInfo); |
| 224 } | 224 } |
| 225 | 225 |
| 226 void lsl(const Operand *OpRd, const Operand *OpRn, const Operand *OpSrc1, |
| 227 bool SetFlags, CondARM32::Cond Cond); |
| 228 |
| 226 void mov(const Operand *OpRd, const Operand *OpSrc, CondARM32::Cond Cond); | 229 void mov(const Operand *OpRd, const Operand *OpSrc, CondARM32::Cond Cond); |
| 227 | 230 |
| 228 void movw(const Operand *OpRd, const Operand *OpSrc, CondARM32::Cond Cond); | 231 void movw(const Operand *OpRd, const Operand *OpSrc, CondARM32::Cond Cond); |
| 229 | 232 |
| 230 void movt(const Operand *OpRd, const Operand *OpSrc, CondARM32::Cond Cond); | 233 void movt(const Operand *OpRd, const Operand *OpSrc, CondARM32::Cond Cond); |
| 231 | 234 |
| 232 void mla(const Operand *OpRd, const Operand *OpRn, const Operand *OpRm, | 235 void mla(const Operand *OpRd, const Operand *OpRn, const Operand *OpRm, |
| 233 const Operand *OpRa, CondARM32::Cond Cond); | 236 const Operand *OpRa, CondARM32::Cond Cond); |
| 234 | 237 |
| 235 void mul(const Operand *OpRd, const Operand *OpRn, const Operand *OpSrc1, | 238 void mul(const Operand *OpRd, const Operand *OpRn, const Operand *OpSrc1, |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 DB_W = (8 | 0 | 1) << 21, // decrement before with writeback to base | 308 DB_W = (8 | 0 | 1) << 21, // decrement before with writeback to base |
| 306 IB_W = (8 | 4 | 1) << 21 // increment before with writeback to base | 309 IB_W = (8 | 4 | 1) << 21 // increment before with writeback to base |
| 307 }; | 310 }; |
| 308 | 311 |
| 309 Label *getOrCreateLabel(SizeT Number, LabelVector &Labels); | 312 Label *getOrCreateLabel(SizeT Number, LabelVector &Labels); |
| 310 | 313 |
| 311 void bindCfgNodeLabel(const CfgNode *Node) override; | 314 void bindCfgNodeLabel(const CfgNode *Node) override; |
| 312 | 315 |
| 313 void emitInst(IValueT Value) { Buffer.emit<IValueT>(Value); } | 316 void emitInst(IValueT Value) { Buffer.emit<IValueT>(Value); } |
| 314 | 317 |
| 318 // List of possible checks to apply when calling emitType01() (below). |
| 319 enum EmitChecks { NoChecks, RdIsPcAndSetFlags }; |
| 320 |
| 315 // Pattern cccctttoooosnnnnddddiiiiiiiiiiii where cccc=Cond, ttt=Type, | 321 // Pattern cccctttoooosnnnnddddiiiiiiiiiiii where cccc=Cond, ttt=Type, |
| 316 // oooo=Opcode, nnnn=Rn, dddd=Rd, iiiiiiiiiiii=imm12 (See ARM section A5.2.3). | 322 // s=SetFlags, oooo=Opcode, nnnn=Rn, dddd=Rd, iiiiiiiiiiii=imm12 (See ARM |
| 323 // section A5.2.3). |
| 317 void emitType01(CondARM32::Cond Cond, IValueT Type, IValueT Opcode, | 324 void emitType01(CondARM32::Cond Cond, IValueT Type, IValueT Opcode, |
| 318 bool SetCc, IValueT Rn, IValueT Rd, IValueT imm12); | 325 bool SetFlags, IValueT Rn, IValueT Rd, IValueT imm12, |
| 319 | 326 EmitChecks RuleChecks); |
| 320 // List of possible checks to apply when calling emitType01() (below). | |
| 321 enum Type01Checks { | |
| 322 NoChecks, | |
| 323 RdIsPcAndSetFlags, | |
| 324 }; | |
| 325 | 327 |
| 326 // Converts appropriate representation on a data operation, and then calls | 328 // Converts appropriate representation on a data operation, and then calls |
| 327 // emitType01 above. | 329 // emitType01 above. |
| 328 void emitType01(IValueT Opcode, const Operand *OpRd, const Operand *OpRn, | 330 void emitType01(IValueT Opcode, const Operand *OpRd, const Operand *OpRn, |
| 329 const Operand *OpSrc1, bool SetFlags, CondARM32::Cond Cond, | 331 const Operand *OpSrc1, bool SetFlags, CondARM32::Cond Cond, |
| 330 Type01Checks RuleChecks = RdIsPcAndSetFlags); | 332 EmitChecks RuleChecks); |
| 331 | 333 |
| 332 // Same as above, but the value for Rd and Rn have already been converted | 334 // Same as above, but the value for Rd and Rn have already been converted |
| 333 // into instruction values. | 335 // into instruction values. |
| 334 void emitType01(IValueT Opcode, IValueT OpRd, IValueT OpRn, | 336 void emitType01(IValueT Opcode, IValueT OpRd, IValueT OpRn, |
| 335 const Operand *OpSrc1, bool SetFlags, CondARM32::Cond Cond, | 337 const Operand *OpSrc1, bool SetFlags, CondARM32::Cond Cond, |
| 336 Type01Checks RuleChecks = RdIsPcAndSetFlags); | 338 EmitChecks RuleChecks); |
| 337 | 339 |
| 338 void emitType05(CondARM32::Cond COnd, int32_t Offset, bool Link); | 340 void emitType05(CondARM32::Cond COnd, int32_t Offset, bool Link); |
| 339 | 341 |
| 340 // Pattern ccccoooaabalnnnnttttaaaaaaaaaaaa where cccc=Cond, ooo=InstType, | 342 // Pattern ccccoooaabalnnnnttttaaaaaaaaaaaa where cccc=Cond, ooo=InstType, |
| 341 // l=isLoad, b=isByte, and aaa0a0aaaa0000aaaaaaaaaaaa=Address. Note that | 343 // l=isLoad, b=isByte, and aaa0a0aaaa0000aaaaaaaaaaaa=Address. Note that |
| 342 // Address is assumed to be defined by decodeAddress() in | 344 // Address is assumed to be defined by decodeAddress() in |
| 343 // IceAssemblerARM32.cpp. | 345 // IceAssemblerARM32.cpp. |
| 344 void emitMemOp(CondARM32::Cond Cond, IValueT InstType, bool IsLoad, | 346 void emitMemOp(CondARM32::Cond Cond, IValueT InstType, bool IsLoad, |
| 345 bool IsByte, uint32_t Rt, uint32_t Address); | 347 bool IsByte, uint32_t Rt, uint32_t Address); |
| 346 | 348 |
| 347 // Pattern cccc100aaaalnnnnrrrrrrrrrrrrrrrr where cccc=Cond, | 349 // Pattern cccc100aaaalnnnnrrrrrrrrrrrrrrrr where cccc=Cond, |
| 348 // aaaa<<21=AddressMode, l=IsLoad, nnnn=BaseReg, and | 350 // aaaa<<21=AddressMode, l=IsLoad, nnnn=BaseReg, and |
| 349 // rrrrrrrrrrrrrrrr is bitset of Registers. | 351 // rrrrrrrrrrrrrrrr is bitset of Registers. |
| 350 void emitMultiMemOp(CondARM32::Cond Cond, BlockAddressMode AddressMode, | 352 void emitMultiMemOp(CondARM32::Cond Cond, BlockAddressMode AddressMode, |
| 351 bool IsLoad, IValueT BaseReg, IValueT Registers); | 353 bool IsLoad, IValueT BaseReg, IValueT Registers); |
| 352 | 354 |
| 353 // Pattern cccc011100x1dddd1111mmmm0001nnn where cccc=Cond, | 355 // Pattern cccc011100x1dddd1111mmmm0001nnn where cccc=Cond, |
| 354 // x=Opcode, dddd=Rd, nnnn=Rn, mmmm=Rm. | 356 // x=Opcode, dddd=Rd, nnnn=Rn, mmmm=Rm. |
| 355 void emitDivOp(CondARM32::Cond Cond, IValueT Opcode, IValueT Rd, IValueT Rn, | 357 void emitDivOp(CondARM32::Cond Cond, IValueT Opcode, IValueT Rd, IValueT Rn, |
| 356 IValueT Rm); | 358 IValueT Rm); |
| 357 | 359 |
| 358 // Pattern ccccxxxxxxxfnnnnddddssss1001mmmm where cccc=Cond, dddd=Rd, nnnn=Rn, | 360 // Pattern ccccxxxxxxxfnnnnddddssss1001mmmm where cccc=Cond, dddd=Rd, nnnn=Rn, |
| 359 // mmmm=Rm, ssss=Rs, f=SetCc, and xxxxxxx=Opcode. | 361 // mmmm=Rm, ssss=Rs, f=SetFlags and xxxxxxx=Opcode. |
| 360 void emitMulOp(CondARM32::Cond Cond, IValueT Opcode, IValueT Rd, IValueT Rn, | 362 void emitMulOp(CondARM32::Cond Cond, IValueT Opcode, IValueT Rd, IValueT Rn, |
| 361 IValueT Rm, IValueT Rs, bool SetCc); | 363 IValueT Rm, IValueT Rs, bool SetFlags); |
| 362 | 364 |
| 363 // Implements various forms of Unsigned extend value, using pattern | 365 // Implements various forms of Unsigned extend value, using pattern |
| 364 // ccccxxxxxxxxnnnnddddrr000111mmmm where cccc=Cond, xxxxxxxx<<20=Opcode, | 366 // ccccxxxxxxxxnnnnddddrr000111mmmm where cccc=Cond, xxxxxxxx<<20=Opcode, |
| 365 // nnnn=Rn, dddd=Rd, rr=Rotation, and mmmm=Rm. | 367 // nnnn=Rn, dddd=Rd, rr=Rotation, and mmmm=Rm. |
| 366 void emitUxt(CondARM32::Cond, IValueT Opcode, IValueT Rd, IValueT Rn, | 368 void emitUxt(CondARM32::Cond, IValueT Opcode, IValueT Rd, IValueT Rn, |
| 367 IValueT Rm, RotationValue Rotation); | 369 IValueT Rm, RotationValue Rotation); |
| 368 | 370 |
| 369 // Pattern cccctttxxxxnnnn0000iiiiiiiiiiii where cccc=Cond, nnnn=Rn, | 371 // Pattern cccctttxxxxnnnn0000iiiiiiiiiiii where cccc=Cond, nnnn=Rn, |
| 370 // ttt=Instruction type (derived from OpSrc1), iiiiiiiiiiii is derived from | 372 // ttt=Instruction type (derived from OpSrc1), iiiiiiiiiiii is derived from |
| 371 // OpSrc1, and xxxx=Opcode. | 373 // OpSrc1, and xxxx=Opcode. |
| (...skipping 12 matching lines...) Expand all Loading... |
| 384 // cccc=Cond, xxxxxxx<<21=Opcode, dddd=Rd, s=SetFlags, and | 386 // cccc=Cond, xxxxxxx<<21=Opcode, dddd=Rd, s=SetFlags, and |
| 385 // iiiiiiiiiiiiiiii=Imm16. | 387 // iiiiiiiiiiiiiiii=Imm16. |
| 386 void emitMovw(IValueT Opcode, IValueT Rd, IValueT Imm16, bool SetFlags, | 388 void emitMovw(IValueT Opcode, IValueT Rd, IValueT Imm16, bool SetFlags, |
| 387 CondARM32::Cond Cond); | 389 CondARM32::Cond Cond); |
| 388 }; | 390 }; |
| 389 | 391 |
| 390 } // end of namespace ARM32 | 392 } // end of namespace ARM32 |
| 391 } // end of namespace Ice | 393 } // end of namespace Ice |
| 392 | 394 |
| 393 #endif // SUBZERO_SRC_ICEASSEMBLERARM32_H | 395 #endif // SUBZERO_SRC_ICEASSEMBLERARM32_H |
| OLD | NEW |