Index: src/IceInstMIPS32.cpp |
diff --git a/src/IceInstMIPS32.cpp b/src/IceInstMIPS32.cpp |
index 8cf559365cf8b5bb340748c14e1d7fcf1185374d..b627a201f16dca7fe00eb7b7b43733e89b6650d6 100644 |
--- a/src/IceInstMIPS32.cpp |
+++ b/src/IceInstMIPS32.cpp |
@@ -552,7 +552,7 @@ void InstMIPS32Call::emit(const Cfg *Func) const { |
CallTarget->emitWithoutPrefix(Func->getTarget()); |
} else { |
Str << "\t" |
- "jal" |
+ "jalr" |
"\t"; |
getCallTarget()->emit(Func); |
} |
@@ -561,11 +561,14 @@ void InstMIPS32Call::emit(const Cfg *Func) const { |
void InstMIPS32Call::emitIAS(const Cfg *Func) const { |
assert(getSrcSize() == 1); |
auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); |
- if (const auto *CallTarget = |
- llvm::dyn_cast<ConstantRelocatable>(getCallTarget())) { |
+ if (llvm::isa<ConstantInteger32>(getCallTarget())) { |
+ llvm::report_fatal_error("MIPS32Call to ConstantInteger32"); |
+ } else if (const auto *CallTarget = |
+ llvm::dyn_cast<ConstantRelocatable>(getCallTarget())) { |
Asm->jal(CallTarget); |
} else { |
- llvm::report_fatal_error("MIPS32Call: Invalid operand"); |
+ const Operand *ImplicitRA = nullptr; |
+ Asm->jalr(getCallTarget(), ImplicitRA); |
} |
} |