mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-07-21 18:29:45 +00:00
Preserve calling conv when hacking on calls
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22025 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
e43702695d
commit
65af1abd1e
@ -525,6 +525,7 @@ Value *llvm::ConvertExpressionToType(Value *V, const Type *Ty,
|
|||||||
Name);
|
Name);
|
||||||
if (cast<CallInst>(I)->isTailCall())
|
if (cast<CallInst>(I)->isTailCall())
|
||||||
cast<CallInst>(Res)->setTailCall();
|
cast<CallInst>(Res)->setTailCall();
|
||||||
|
cast<CallInst>(Res)->setCallingConv(cast<CallInst>(I)->getCallingConv());
|
||||||
VMC.ExprMap[I] = Res;
|
VMC.ExprMap[I] = Res;
|
||||||
Res->setOperand(0, ConvertExpressionToType(I->getOperand(0),NewPTy,VMC,TD));
|
Res->setOperand(0, ConvertExpressionToType(I->getOperand(0),NewPTy,VMC,TD));
|
||||||
break;
|
break;
|
||||||
@ -1218,6 +1219,9 @@ static void ConvertOperandToType(User *U, Value *OldVal, Value *NewVal,
|
|||||||
}
|
}
|
||||||
|
|
||||||
Res = new CallInst(Meth, Params, Name);
|
Res = new CallInst(Meth, Params, Name);
|
||||||
|
if (cast<CallInst>(I)->isTailCall())
|
||||||
|
cast<CallInst>(Res)->setTailCall();
|
||||||
|
cast<CallInst>(Res)->setCallingConv(cast<CallInst>(I)->getCallingConv());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
@ -538,6 +538,8 @@ bool RPR::PeepholeOptimize(BasicBlock *BB, BasicBlock::iterator &BI) {
|
|||||||
// Create a new call instruction...
|
// Create a new call instruction...
|
||||||
CallInst *NewCall = new CallInst(NewCast,
|
CallInst *NewCall = new CallInst(NewCast,
|
||||||
std::vector<Value*>(CI->op_begin()+1, CI->op_end()));
|
std::vector<Value*>(CI->op_begin()+1, CI->op_end()));
|
||||||
|
if (CI->isTailCall()) NewCall->setTailCall();
|
||||||
|
NewCall->setCallingConv(CI->getCallingConv());
|
||||||
++BI;
|
++BI;
|
||||||
ReplaceInstWithInst(CI, NewCall);
|
ReplaceInstWithInst(CI, NewCall);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user