I want to insert specific opcode before BasicBlock terminator, in my case before ReturnInst.
It is possible?
Example:
TerminatorInst* terminator = BasicBlock->getTerminator(); if (isa<ReturnInst>(terminator)) { //Insert opcode here. }
Problem solved by using llvm::InlineAsm
llvm::InlineAsm *AsmCode = llvm::InlineAsm::get(Asm, nopInstruction, "", true, false, llvm::InlineAsm::AD_Intel);
where Asm - llvm::FunctionType, nopInstruction - llvm::StringRef(char*)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With