| 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 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 311 | 311 |
| 312 void udiv(const Operand *OpRd, const Operand *OpRn, const Operand *OpSrc1, | 312 void udiv(const Operand *OpRd, const Operand *OpRn, const Operand *OpSrc1, |
| 313 CondARM32::Cond Cond); | 313 CondARM32::Cond Cond); |
| 314 | 314 |
| 315 void umull(const Operand *OpRdLo, const Operand *OpRdHi, const Operand *OpRn, | 315 void umull(const Operand *OpRdLo, const Operand *OpRdHi, const Operand *OpRn, |
| 316 const Operand *OpRm, CondARM32::Cond Cond); | 316 const Operand *OpRm, CondARM32::Cond Cond); |
| 317 | 317 |
| 318 // Implements uxtb/uxth depending on type of OpSrc0. | 318 // Implements uxtb/uxth depending on type of OpSrc0. |
| 319 void uxt(const Operand *OpRd, const Operand *OpSrc0, CondARM32::Cond Cond); | 319 void uxt(const Operand *OpRd, const Operand *OpSrc0, CondARM32::Cond Cond); |
| 320 | 320 |
| 321 void vaddd(const Operand *OpDd, const Operand *OpDn, const Operand *OpDm, |
| 322 CondARM32::Cond Cond); |
| 323 |
| 324 void vadds(const Operand *OpSd, const Operand *OpSn, const Operand *OpSm, |
| 325 CondARM32::Cond Cond); |
| 326 |
| 321 void vpop(const Variable *OpBaseReg, SizeT NumConsecRegs, | 327 void vpop(const Variable *OpBaseReg, SizeT NumConsecRegs, |
| 322 CondARM32::Cond Cond); | 328 CondARM32::Cond Cond); |
| 323 | 329 |
| 324 void vpush(const Variable *OpBaseReg, SizeT NumConsecRegs, | 330 void vpush(const Variable *OpBaseReg, SizeT NumConsecRegs, |
| 325 CondARM32::Cond Cond); | 331 CondARM32::Cond Cond); |
| 326 | 332 |
| 327 static bool classof(const Assembler *Asm) { | 333 static bool classof(const Assembler *Asm) { |
| 328 return Asm->getKind() == Asm_ARM32; | 334 return Asm->getKind() == Asm_ARM32; |
| 329 } | 335 } |
| 330 | 336 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 376 void emitType01(CondARM32::Cond Cond, IValueT Opcode, const Operand *OpRd, | 382 void emitType01(CondARM32::Cond Cond, IValueT Opcode, const Operand *OpRd, |
| 377 const Operand *OpRn, const Operand *OpSrc1, bool SetFlags, | 383 const Operand *OpRn, const Operand *OpSrc1, bool SetFlags, |
| 378 EmitChecks RuleChecks, const char *InstName); | 384 EmitChecks RuleChecks, const char *InstName); |
| 379 | 385 |
| 380 // Same as above, but the value for Rd and Rn have already been converted | 386 // Same as above, but the value for Rd and Rn have already been converted |
| 381 // into instruction values. | 387 // into instruction values. |
| 382 void emitType01(CondARM32::Cond Cond, IValueT Opcode, IValueT OpRd, | 388 void emitType01(CondARM32::Cond Cond, IValueT Opcode, IValueT OpRd, |
| 383 IValueT OpRn, const Operand *OpSrc1, bool SetFlags, | 389 IValueT OpRn, const Operand *OpSrc1, bool SetFlags, |
| 384 EmitChecks RuleChecks, const char *InstName); | 390 EmitChecks RuleChecks, const char *InstName); |
| 385 | 391 |
| 386 void emitType05(CondARM32::Cond Cond, int32_t Offset, bool Link, | 392 void emitType05(CondARM32::Cond Cond, int32_t Offset, bool Link); |
| 387 const char *InstName); | |
| 388 | 393 |
| 389 // Emit ccccoooaabalnnnnttttaaaaaaaaaaaa where cccc=Cond, | 394 // Emit ccccoooaabalnnnnttttaaaaaaaaaaaa where cccc=Cond, |
| 390 // ooo=InstType, l=isLoad, b=isByte, and | 395 // ooo=InstType, l=isLoad, b=isByte, and |
| 391 // aaa0a0aaaa0000aaaaaaaaaaaa=Address. Note that Address is assumed to be | 396 // aaa0a0aaaa0000aaaaaaaaaaaa=Address. Note that Address is assumed to be |
| 392 // defined by decodeAddress() in IceAssemblerARM32.cpp. | 397 // defined by decodeAddress() in IceAssemblerARM32.cpp. |
| 393 void emitMemOp(CondARM32::Cond Cond, IValueT InstType, bool IsLoad, | 398 void emitMemOp(CondARM32::Cond Cond, IValueT InstType, bool IsLoad, |
| 394 bool IsByte, IValueT Rt, IValueT Address, | 399 bool IsByte, IValueT Rt, IValueT Address); |
| 395 const char *InstName); | |
| 396 | 400 |
| 397 // Emit ccccxxxxxxxxxxxxddddxxxxxxxxmmmm where cccc=Cond, | 401 // Emit ccccxxxxxxxxxxxxddddxxxxxxxxmmmm where cccc=Cond, |
| 398 // xxxxxxxxxxxx0000xxxxxxxx0000=Opcode, dddd=Rd, and mmmm=Rm. | 402 // xxxxxxxxxxxx0000xxxxxxxx0000=Opcode, dddd=Rd, and mmmm=Rm. |
| 399 void emitRdRm(CondARM32::Cond Cond, IValueT Opcode, const Operand *OpRd, | 403 void emitRdRm(CondARM32::Cond Cond, IValueT Opcode, const Operand *OpRd, |
| 400 const Operand *OpRm, const char *InstName); | 404 const Operand *OpRm, const char *InstName); |
| 401 | 405 |
| 402 // Emit ldr/ldrb/str/strb instruction with given address. | 406 // Emit ldr/ldrb/str/strb instruction with given address. |
| 403 void emitMemOp(CondARM32::Cond Cond, bool IsLoad, bool IsByte, IValueT Rt, | 407 void emitMemOp(CondARM32::Cond Cond, bool IsLoad, bool IsByte, IValueT Rt, |
| 404 const Operand *OpAddress, const TargetInfo &TInfo, | 408 const Operand *OpAddress, const TargetInfo &TInfo, |
| 405 const char *InstName); | 409 const char *InstName); |
| 406 | 410 |
| 407 // Emit ldrh/ldrd/strh/strd instruction with given address using encoding 3. | 411 // Emit ldrh/ldrd/strh/strd instruction with given address using encoding 3. |
| 408 void emitMemOpEnc3(CondARM32::Cond Cond, IValueT Opcode, IValueT Rt, | 412 void emitMemOpEnc3(CondARM32::Cond Cond, IValueT Opcode, IValueT Rt, |
| 409 const Operand *OpAddress, const TargetInfo &TInfo, | 413 const Operand *OpAddress, const TargetInfo &TInfo, |
| 410 const char *InstName); | 414 const char *InstName); |
| 411 | 415 |
| 412 // Emit cccc00011xxlnnnndddd11111001tttt where cccc=Cond, xx encodes type | 416 // Emit cccc00011xxlnnnndddd11111001tttt where cccc=Cond, xx encodes type |
| 413 // size, l=IsLoad, nnnn=Rn (as defined by OpAddress), and tttt=Rt. | 417 // size, l=IsLoad, nnnn=Rn (as defined by OpAddress), and tttt=Rt. |
| 414 void emitMemExOp(CondARM32::Cond, Type Ty, bool IsLoad, const Operand *OpRd, | 418 void emitMemExOp(CondARM32::Cond, Type Ty, bool IsLoad, const Operand *OpRd, |
| 415 IValueT Rt, const Operand *OpAddress, | 419 IValueT Rt, const Operand *OpAddress, |
| 416 const TargetInfo &TInfo, const char *InstName); | 420 const TargetInfo &TInfo, const char *InstName); |
| 417 | 421 |
| 418 // Pattern cccc100aaaalnnnnrrrrrrrrrrrrrrrr where cccc=Cond, | 422 // Pattern cccc100aaaalnnnnrrrrrrrrrrrrrrrr where cccc=Cond, |
| 419 // aaaa<<21=AddressMode, l=IsLoad, nnnn=BaseReg, and | 423 // aaaa<<21=AddressMode, l=IsLoad, nnnn=BaseReg, and |
| 420 // rrrrrrrrrrrrrrrr is bitset of Registers. | 424 // rrrrrrrrrrrrrrrr is bitset of Registers. |
| 421 void emitMultiMemOp(CondARM32::Cond Cond, BlockAddressMode AddressMode, | 425 void emitMultiMemOp(CondARM32::Cond Cond, BlockAddressMode AddressMode, |
| 422 bool IsLoad, IValueT BaseReg, IValueT Registers, | 426 bool IsLoad, IValueT BaseReg, IValueT Registers); |
| 423 const char *InstName); | |
| 424 | 427 |
| 425 // Pattern ccccxxxxxDxxxxxxddddxxxxiiiiiiii where cccc=Cond, ddddD=BaseReg, | 428 // Pattern ccccxxxxxDxxxxxxddddxxxxiiiiiiii where cccc=Cond, ddddD=BaseReg, |
| 426 // iiiiiiii=NumConsecRegs, and xxxxx0xxxxxx0000xxxx00000000=Opcode. | 429 // iiiiiiii=NumConsecRegs, and xxxxx0xxxxxx0000xxxx00000000=Opcode. |
| 427 void emitVStackOp(CondARM32::Cond Cond, IValueT Opcode, | 430 void emitVStackOp(CondARM32::Cond Cond, IValueT Opcode, |
| 428 const Variable *OpBaseReg, SizeT NumConsecRegs, | 431 const Variable *OpBaseReg, SizeT NumConsecRegs); |
| 429 const char *InstName); | |
| 430 | 432 |
| 431 // Pattern cccc011100x1dddd1111mmmm0001nnn where cccc=Cond, | 433 // Pattern cccc011100x1dddd1111mmmm0001nnn where cccc=Cond, |
| 432 // x=Opcode, dddd=Rd, nnnn=Rn, mmmm=Rm. | 434 // x=Opcode, dddd=Rd, nnnn=Rn, mmmm=Rm. |
| 433 void emitDivOp(CondARM32::Cond Cond, IValueT Opcode, IValueT Rd, IValueT Rn, | 435 void emitDivOp(CondARM32::Cond Cond, IValueT Opcode, IValueT Rd, IValueT Rn, |
| 434 IValueT Rm, const char *InstName); | 436 IValueT Rm); |
| 435 | 437 |
| 436 // Pattern ccccxxxxxxxfnnnnddddssss1001mmmm where cccc=Cond, dddd=Rd, nnnn=Rn, | 438 // Pattern ccccxxxxxxxfnnnnddddssss1001mmmm where cccc=Cond, dddd=Rd, nnnn=Rn, |
| 437 // mmmm=Rm, ssss=Rs, f=SetFlags and xxxxxxx=Opcode. | 439 // mmmm=Rm, ssss=Rs, f=SetFlags and xxxxxxx=Opcode. |
| 438 void emitMulOp(CondARM32::Cond Cond, IValueT Opcode, IValueT Rd, IValueT Rn, | 440 void emitMulOp(CondARM32::Cond Cond, IValueT Opcode, IValueT Rd, IValueT Rn, |
| 439 IValueT Rm, IValueT Rs, bool SetFlags, const char *InstName); | 441 IValueT Rm, IValueT Rs, bool SetFlags); |
| 440 | 442 |
| 441 // Pattern cccc0001101s0000ddddxxxxxtt0mmmm where cccc=Cond, s=SetFlags, | 443 // Pattern cccc0001101s0000ddddxxxxxtt0mmmm where cccc=Cond, s=SetFlags, |
| 442 // dddd=Rd, mmmm=Rm, tt=Shift, and xxxxx is defined by OpSrc1. OpSrc1 defines | 444 // dddd=Rd, mmmm=Rm, tt=Shift, and xxxxx is defined by OpSrc1. OpSrc1 defines |
| 443 // either xxxxx=Imm5, or xxxxx=ssss0 where ssss=Rs. | 445 // either xxxxx=Imm5, or xxxxx=ssss0 where ssss=Rs. |
| 444 void emitShift(const CondARM32::Cond Cond, | 446 void emitShift(const CondARM32::Cond Cond, |
| 445 const OperandARM32::ShiftKind Shift, const Operand *OpRd, | 447 const OperandARM32::ShiftKind Shift, const Operand *OpRd, |
| 446 const Operand *OpRm, const Operand *OpSrc1, | 448 const Operand *OpRm, const Operand *OpSrc1, |
| 447 const bool SetFlags, const char *InstName); | 449 const bool SetFlags, const char *InstName); |
| 448 | 450 |
| 449 // Implements various forms of signed/unsigned extend value, using pattern | 451 // Implements various forms of signed/unsigned extend value, using pattern |
| (...skipping 14 matching lines...) Expand all Loading... |
| 464 IValueT encodeBranchOffset(IOffsetT Offset, IValueT Inst); | 466 IValueT encodeBranchOffset(IOffsetT Offset, IValueT Inst); |
| 465 | 467 |
| 466 // Returns the offset encoded in the branch instruction Inst. | 468 // Returns the offset encoded in the branch instruction Inst. |
| 467 static IOffsetT decodeBranchOffset(IValueT Inst); | 469 static IOffsetT decodeBranchOffset(IValueT Inst); |
| 468 | 470 |
| 469 // Implements movw/movt, generating pattern ccccxxxxxxxsiiiiddddiiiiiiiiiiii | 471 // Implements movw/movt, generating pattern ccccxxxxxxxsiiiiddddiiiiiiiiiiii |
| 470 // where cccc=Cond, xxxxxxx<<21=Opcode, dddd=Rd, s=SetFlags, and | 472 // where cccc=Cond, xxxxxxx<<21=Opcode, dddd=Rd, s=SetFlags, and |
| 471 // iiiiiiiiiiiiiiii=Imm16. | 473 // iiiiiiiiiiiiiiii=Imm16. |
| 472 void emitMovwt(CondARM32::Cond Cond, bool IsMovw, const Operand *OpRd, | 474 void emitMovwt(CondARM32::Cond Cond, bool IsMovw, const Operand *OpRd, |
| 473 const Operand *OpSrc, const char *MovName); | 475 const Operand *OpSrc, const char *MovName); |
| 476 |
| 477 // Emit VFP instruction with 3 D registers. |
| 478 void emitVFPddd(CondARM32::Cond Cond, IValueT Opcode, IValueT Dd, IValueT Dn, |
| 479 IValueT Dm); |
| 480 |
| 481 // Emit VFP instruction with 3 S registers. |
| 482 void emitVFPsss(CondARM32::Cond Cond, IValueT Opcode, IValueT Sd, IValueT Sn, |
| 483 IValueT Sm); |
| 474 }; | 484 }; |
| 475 | 485 |
| 476 } // end of namespace ARM32 | 486 } // end of namespace ARM32 |
| 477 } // end of namespace Ice | 487 } // end of namespace Ice |
| 478 | 488 |
| 479 #endif // SUBZERO_SRC_ICEASSEMBLERARM32_H | 489 #endif // SUBZERO_SRC_ICEASSEMBLERARM32_H |
| OLD | NEW |