mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-05 13:26:55 +00:00
Don't forget to match the calling convention when producing a thunk.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73231 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -478,6 +478,7 @@ static void ThunkGToF(Function *F, Function *G) {
|
|||||||
|
|
||||||
CallInst *CI = CallInst::Create(F, Args.begin(), Args.end(), "", BB);
|
CallInst *CI = CallInst::Create(F, Args.begin(), Args.end(), "", BB);
|
||||||
CI->setTailCall();
|
CI->setTailCall();
|
||||||
|
CI->setCallingConv(F->getCallingConv());
|
||||||
if (NewG->getReturnType() == Type::VoidTy) {
|
if (NewG->getReturnType() == Type::VoidTy) {
|
||||||
ReturnInst::Create(BB);
|
ReturnInst::Create(BB);
|
||||||
} else if (CI->getType() != NewG->getReturnType()) {
|
} else if (CI->getType() != NewG->getReturnType()) {
|
||||||
@@ -492,8 +493,7 @@ static void ThunkGToF(Function *F, Function *G) {
|
|||||||
G->replaceAllUsesWith(NewG);
|
G->replaceAllUsesWith(NewG);
|
||||||
G->eraseFromParent();
|
G->eraseFromParent();
|
||||||
|
|
||||||
// TODO: look at direct callers to G and make them all direct callers to F
|
// TODO: look at direct callers to G and make them all direct callers to F.
|
||||||
// iff G->hasAddressTaken() is false.
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void AliasGToF(Function *F, Function *G) {
|
static void AliasGToF(Function *F, Function *G) {
|
||||||
|
Reference in New Issue
Block a user