| OLD | NEW |
| 1 //===- subzero/src/IceInstARM32.h - ARM32 machine instructions --*- C++ -*-===// | 1 //===- subzero/src/IceInstARM32.h - ARM32 machine instructions --*- C++ -*-===// |
| 2 // | 2 // |
| 3 // The Subzero Code Generator | 3 // The Subzero Code Generator |
| 4 // | 4 // |
| 5 // This file is distributed under the University of Illinois Open Source | 5 // This file is distributed under the University of Illinois Open Source |
| 6 // License. See LICENSE.TXT for details. | 6 // License. See LICENSE.TXT for details. |
| 7 // | 7 // |
| 8 //===----------------------------------------------------------------------===// | 8 //===----------------------------------------------------------------------===// |
| 9 // | 9 // |
| 10 // This file declares the InstARM32 and OperandARM32 classes and | 10 // This file declares the InstARM32 and OperandARM32 classes and |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 | 45 |
| 46 enum ShiftKind { | 46 enum ShiftKind { |
| 47 kNoShift = -1, | 47 kNoShift = -1, |
| 48 #define X(enum, emit) enum, | 48 #define X(enum, emit) enum, |
| 49 ICEINSTARM32SHIFT_TABLE | 49 ICEINSTARM32SHIFT_TABLE |
| 50 #undef X | 50 #undef X |
| 51 }; | 51 }; |
| 52 | 52 |
| 53 using Operand::dump; | 53 using Operand::dump; |
| 54 void dump(const Cfg *, Ostream &Str) const override { | 54 void dump(const Cfg *, Ostream &Str) const override { |
| 55 if (ALLOW_DUMP) | 55 if (buildAllowsDump()) |
| 56 Str << "<OperandARM32>"; | 56 Str << "<OperandARM32>"; |
| 57 } | 57 } |
| 58 | 58 |
| 59 protected: | 59 protected: |
| 60 OperandARM32(OperandKindARM32 Kind, Type Ty) | 60 OperandARM32(OperandKindARM32 Kind, Type Ty) |
| 61 : Operand(static_cast<OperandKind>(Kind), Ty) {} | 61 : Operand(static_cast<OperandKind>(Kind), Ty) {} |
| 62 }; | 62 }; |
| 63 | 63 |
| 64 // OperandARM32Mem represents a memory operand in any of the various ARM32 | 64 // OperandARM32Mem represents a memory operand in any of the various ARM32 |
| 65 // addressing modes. | 65 // addressing modes. |
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 340 InstARM32UnaryopGPR(const InstARM32UnaryopGPR &) = delete; | 340 InstARM32UnaryopGPR(const InstARM32UnaryopGPR &) = delete; |
| 341 InstARM32UnaryopGPR &operator=(const InstARM32UnaryopGPR &) = delete; | 341 InstARM32UnaryopGPR &operator=(const InstARM32UnaryopGPR &) = delete; |
| 342 | 342 |
| 343 public: | 343 public: |
| 344 static InstARM32UnaryopGPR *create(Cfg *Func, Variable *Dest, Operand *Src, | 344 static InstARM32UnaryopGPR *create(Cfg *Func, Variable *Dest, Operand *Src, |
| 345 CondARM32::Cond Predicate) { | 345 CondARM32::Cond Predicate) { |
| 346 return new (Func->allocate<InstARM32UnaryopGPR>()) | 346 return new (Func->allocate<InstARM32UnaryopGPR>()) |
| 347 InstARM32UnaryopGPR(Func, Dest, Src, Predicate); | 347 InstARM32UnaryopGPR(Func, Dest, Src, Predicate); |
| 348 } | 348 } |
| 349 void emit(const Cfg *Func) const override { | 349 void emit(const Cfg *Func) const override { |
| 350 if (!ALLOW_DUMP) | 350 if (!buildAllowsDump()) |
| 351 return; | 351 return; |
| 352 emitUnaryopGPR(Opcode, this, Func); | 352 emitUnaryopGPR(Opcode, this, Func); |
| 353 } | 353 } |
| 354 void emitIAS(const Cfg *Func) const override { | 354 void emitIAS(const Cfg *Func) const override { |
| 355 (void)Func; | 355 (void)Func; |
| 356 llvm_unreachable("Not yet implemented"); | 356 llvm_unreachable("Not yet implemented"); |
| 357 } | 357 } |
| 358 void dump(const Cfg *Func) const override { | 358 void dump(const Cfg *Func) const override { |
| 359 if (!ALLOW_DUMP) | 359 if (!buildAllowsDump()) |
| 360 return; | 360 return; |
| 361 Ostream &Str = Func->getContext()->getStrDump(); | 361 Ostream &Str = Func->getContext()->getStrDump(); |
| 362 dumpDest(Func); | 362 dumpDest(Func); |
| 363 Str << " = "; | 363 Str << " = "; |
| 364 dumpOpcodePred(Str, Opcode, getDest()->getType()); | 364 dumpOpcodePred(Str, Opcode, getDest()->getType()); |
| 365 Str << " "; | 365 Str << " "; |
| 366 dumpSources(Func); | 366 dumpSources(Func); |
| 367 } | 367 } |
| 368 static bool classof(const Inst *Inst) { return isClassof(Inst, K); } | 368 static bool classof(const Inst *Inst) { return isClassof(Inst, K); } |
| 369 | 369 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 385 InstARM32TwoAddrGPR &operator=(const InstARM32TwoAddrGPR &) = delete; | 385 InstARM32TwoAddrGPR &operator=(const InstARM32TwoAddrGPR &) = delete; |
| 386 | 386 |
| 387 public: | 387 public: |
| 388 // Dest must be a register. | 388 // Dest must be a register. |
| 389 static InstARM32TwoAddrGPR *create(Cfg *Func, Variable *Dest, Operand *Src, | 389 static InstARM32TwoAddrGPR *create(Cfg *Func, Variable *Dest, Operand *Src, |
| 390 CondARM32::Cond Predicate) { | 390 CondARM32::Cond Predicate) { |
| 391 return new (Func->allocate<InstARM32TwoAddrGPR>()) | 391 return new (Func->allocate<InstARM32TwoAddrGPR>()) |
| 392 InstARM32TwoAddrGPR(Func, Dest, Src, Predicate); | 392 InstARM32TwoAddrGPR(Func, Dest, Src, Predicate); |
| 393 } | 393 } |
| 394 void emit(const Cfg *Func) const override { | 394 void emit(const Cfg *Func) const override { |
| 395 if (!ALLOW_DUMP) | 395 if (!buildAllowsDump()) |
| 396 return; | 396 return; |
| 397 emitTwoAddr(Opcode, this, Func); | 397 emitTwoAddr(Opcode, this, Func); |
| 398 } | 398 } |
| 399 void emitIAS(const Cfg *Func) const override { | 399 void emitIAS(const Cfg *Func) const override { |
| 400 (void)Func; | 400 (void)Func; |
| 401 llvm::report_fatal_error("Not yet implemented"); | 401 llvm::report_fatal_error("Not yet implemented"); |
| 402 } | 402 } |
| 403 void dump(const Cfg *Func) const override { | 403 void dump(const Cfg *Func) const override { |
| 404 if (!ALLOW_DUMP) | 404 if (!buildAllowsDump()) |
| 405 return; | 405 return; |
| 406 Ostream &Str = Func->getContext()->getStrDump(); | 406 Ostream &Str = Func->getContext()->getStrDump(); |
| 407 dumpDest(Func); | 407 dumpDest(Func); |
| 408 Str << " = "; | 408 Str << " = "; |
| 409 dumpOpcodePred(Str, Opcode, getDest()->getType()); | 409 dumpOpcodePred(Str, Opcode, getDest()->getType()); |
| 410 Str << " "; | 410 Str << " "; |
| 411 dumpSources(Func); | 411 dumpSources(Func); |
| 412 } | 412 } |
| 413 static bool classof(const Inst *Inst) { return isClassof(Inst, K); } | 413 static bool classof(const Inst *Inst) { return isClassof(Inst, K); } |
| 414 | 414 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 437 return new (Func->allocate<InstARM32Movlike>()) | 437 return new (Func->allocate<InstARM32Movlike>()) |
| 438 InstARM32Movlike(Func, Dest, Source, Predicate); | 438 InstARM32Movlike(Func, Dest, Source, Predicate); |
| 439 } | 439 } |
| 440 bool isRedundantAssign() const override { | 440 bool isRedundantAssign() const override { |
| 441 return checkForRedundantAssign(getDest(), getSrc(0)); | 441 return checkForRedundantAssign(getDest(), getSrc(0)); |
| 442 } | 442 } |
| 443 bool isSimpleAssign() const override { return true; } | 443 bool isSimpleAssign() const override { return true; } |
| 444 void emit(const Cfg *Func) const override; | 444 void emit(const Cfg *Func) const override; |
| 445 void emitIAS(const Cfg *Func) const override; | 445 void emitIAS(const Cfg *Func) const override; |
| 446 void dump(const Cfg *Func) const override { | 446 void dump(const Cfg *Func) const override { |
| 447 if (!ALLOW_DUMP) | 447 if (!buildAllowsDump()) |
| 448 return; | 448 return; |
| 449 Ostream &Str = Func->getContext()->getStrDump(); | 449 Ostream &Str = Func->getContext()->getStrDump(); |
| 450 dumpOpcodePred(Str, Opcode, getDest()->getType()); | 450 dumpOpcodePred(Str, Opcode, getDest()->getType()); |
| 451 Str << " "; | 451 Str << " "; |
| 452 dumpDest(Func); | 452 dumpDest(Func); |
| 453 Str << ", "; | 453 Str << ", "; |
| 454 dumpSources(Func); | 454 dumpSources(Func); |
| 455 } | 455 } |
| 456 static bool classof(const Inst *Inst) { return isClassof(Inst, K); } | 456 static bool classof(const Inst *Inst) { return isClassof(Inst, K); } |
| 457 | 457 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 477 // Create an ordinary binary-op instruction like add, and sub. | 477 // Create an ordinary binary-op instruction like add, and sub. |
| 478 // Dest and Src1 must be registers. | 478 // Dest and Src1 must be registers. |
| 479 static InstARM32ThreeAddrGPR *create(Cfg *Func, Variable *Dest, | 479 static InstARM32ThreeAddrGPR *create(Cfg *Func, Variable *Dest, |
| 480 Variable *Src1, Operand *Src2, | 480 Variable *Src1, Operand *Src2, |
| 481 CondARM32::Cond Predicate, | 481 CondARM32::Cond Predicate, |
| 482 bool SetFlags = false) { | 482 bool SetFlags = false) { |
| 483 return new (Func->allocate<InstARM32ThreeAddrGPR>()) | 483 return new (Func->allocate<InstARM32ThreeAddrGPR>()) |
| 484 InstARM32ThreeAddrGPR(Func, Dest, Src1, Src2, Predicate, SetFlags); | 484 InstARM32ThreeAddrGPR(Func, Dest, Src1, Src2, Predicate, SetFlags); |
| 485 } | 485 } |
| 486 void emit(const Cfg *Func) const override { | 486 void emit(const Cfg *Func) const override { |
| 487 if (!ALLOW_DUMP) | 487 if (!buildAllowsDump()) |
| 488 return; | 488 return; |
| 489 emitThreeAddr(Opcode, this, Func, SetFlags); | 489 emitThreeAddr(Opcode, this, Func, SetFlags); |
| 490 } | 490 } |
| 491 void emitIAS(const Cfg *Func) const override { | 491 void emitIAS(const Cfg *Func) const override { |
| 492 (void)Func; | 492 (void)Func; |
| 493 llvm::report_fatal_error("Not yet implemented"); | 493 llvm::report_fatal_error("Not yet implemented"); |
| 494 } | 494 } |
| 495 void dump(const Cfg *Func) const override { | 495 void dump(const Cfg *Func) const override { |
| 496 if (!ALLOW_DUMP) | 496 if (!buildAllowsDump()) |
| 497 return; | 497 return; |
| 498 Ostream &Str = Func->getContext()->getStrDump(); | 498 Ostream &Str = Func->getContext()->getStrDump(); |
| 499 dumpDest(Func); | 499 dumpDest(Func); |
| 500 Str << " = "; | 500 Str << " = "; |
| 501 dumpOpcodePred(Str, Opcode, getDest()->getType()); | 501 dumpOpcodePred(Str, Opcode, getDest()->getType()); |
| 502 Str << (SetFlags ? ".s " : " "); | 502 Str << (SetFlags ? ".s " : " "); |
| 503 dumpSources(Func); | 503 dumpSources(Func); |
| 504 } | 504 } |
| 505 static bool classof(const Inst *Inst) { return isClassof(Inst, K); } | 505 static bool classof(const Inst *Inst) { return isClassof(Inst, K); } |
| 506 | 506 |
| (...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 845 // Declare partial template specializations of emit() methods that | 845 // Declare partial template specializations of emit() methods that |
| 846 // already have default implementations. Without this, there is the | 846 // already have default implementations. Without this, there is the |
| 847 // possibility of ODR violations and link errors. | 847 // possibility of ODR violations and link errors. |
| 848 | 848 |
| 849 template <> void InstARM32Movw::emit(const Cfg *Func) const; | 849 template <> void InstARM32Movw::emit(const Cfg *Func) const; |
| 850 template <> void InstARM32Movt::emit(const Cfg *Func) const; | 850 template <> void InstARM32Movt::emit(const Cfg *Func) const; |
| 851 | 851 |
| 852 } // end of namespace Ice | 852 } // end of namespace Ice |
| 853 | 853 |
| 854 #endif // SUBZERO_SRC_ICEINSTARM32_H | 854 #endif // SUBZERO_SRC_ICEINSTARM32_H |
| OLD | NEW |