OLD | NEW |
1 //===- subzero/src/IceInstMips32.cpp - Mips32 instruction implementation --===// | 1 //===- subzero/src/IceInstMips32.cpp - Mips32 instruction implementation --===// |
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 /// \file | 10 /// \file |
(...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
545 } else if (const auto *CallTarget = | 545 } else if (const auto *CallTarget = |
546 llvm::dyn_cast<ConstantRelocatable>(getCallTarget())) { | 546 llvm::dyn_cast<ConstantRelocatable>(getCallTarget())) { |
547 // Calls only have 26-bits, but the linker should insert veneers to extend | 547 // Calls only have 26-bits, but the linker should insert veneers to extend |
548 // the range if needed. | 548 // the range if needed. |
549 Str << "\t" | 549 Str << "\t" |
550 "jal" | 550 "jal" |
551 "\t"; | 551 "\t"; |
552 CallTarget->emitWithoutPrefix(Func->getTarget()); | 552 CallTarget->emitWithoutPrefix(Func->getTarget()); |
553 } else { | 553 } else { |
554 Str << "\t" | 554 Str << "\t" |
555 "jal" | 555 "jalr" |
556 "\t"; | 556 "\t"; |
557 getCallTarget()->emit(Func); | 557 getCallTarget()->emit(Func); |
558 } | 558 } |
559 } | 559 } |
560 | 560 |
561 void InstMIPS32Call::emitIAS(const Cfg *Func) const { | 561 void InstMIPS32Call::emitIAS(const Cfg *Func) const { |
562 assert(getSrcSize() == 1); | 562 assert(getSrcSize() == 1); |
563 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); | 563 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); |
564 if (const auto *CallTarget = | 564 if (llvm::isa<ConstantInteger32>(getCallTarget())) { |
565 llvm::dyn_cast<ConstantRelocatable>(getCallTarget())) { | 565 llvm::report_fatal_error("MIPS32Call to ConstantInteger32"); |
| 566 } else if (const auto *CallTarget = |
| 567 llvm::dyn_cast<ConstantRelocatable>(getCallTarget())) { |
566 Asm->jal(CallTarget); | 568 Asm->jal(CallTarget); |
567 } else { | 569 } else { |
568 llvm::report_fatal_error("MIPS32Call: Invalid operand"); | 570 const Operand *ImplicitRA = nullptr; |
| 571 Asm->jalr(getCallTarget(), ImplicitRA); |
569 } | 572 } |
570 } | 573 } |
571 | 574 |
572 void InstMIPS32Call::dump(const Cfg *Func) const { | 575 void InstMIPS32Call::dump(const Cfg *Func) const { |
573 if (!BuildDefs::dump()) | 576 if (!BuildDefs::dump()) |
574 return; | 577 return; |
575 Ostream &Str = Func->getContext()->getStrDump(); | 578 Ostream &Str = Func->getContext()->getStrDump(); |
576 if (getDest()) { | 579 if (getDest()) { |
577 dumpDest(Func); | 580 dumpDest(Func); |
578 Str << " = "; | 581 Str << " = "; |
(...skipping 610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1189 Asm->xor_(getDest(), getSrc(0), getSrc(1)); | 1192 Asm->xor_(getDest(), getSrc(0), getSrc(1)); |
1190 } | 1193 } |
1191 | 1194 |
1192 template <> void InstMIPS32Xori::emitIAS(const Cfg *Func) const { | 1195 template <> void InstMIPS32Xori::emitIAS(const Cfg *Func) const { |
1193 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); | 1196 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); |
1194 Asm->xori(getDest(), getSrc(0), Imm); | 1197 Asm->xori(getDest(), getSrc(0), Imm); |
1195 } | 1198 } |
1196 | 1199 |
1197 } // end of namespace MIPS32 | 1200 } // end of namespace MIPS32 |
1198 } // end of namespace Ice | 1201 } // end of namespace Ice |
OLD | NEW |