mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-10-10 16:24:04 +00:00
The "stacksave is not nounwind problem" no longer
needs to be fixed here - a previous commit made sure that intrinsics always get the right attributes. So remove no-longer needed code, and while there use Intrinsic::getDeclaration rather than getOrInsertFunction. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49337 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
a122043c2c
commit
3d292aca03
@ -347,12 +347,10 @@ bool llvm::InlineFunction(CallSite CS, CallGraph *CG, const TargetData *TD) {
|
|||||||
// code with llvm.stacksave/llvm.stackrestore intrinsics.
|
// code with llvm.stacksave/llvm.stackrestore intrinsics.
|
||||||
if (InlinedFunctionInfo.ContainsDynamicAllocas) {
|
if (InlinedFunctionInfo.ContainsDynamicAllocas) {
|
||||||
Module *M = Caller->getParent();
|
Module *M = Caller->getParent();
|
||||||
const Type *BytePtr = PointerType::getUnqual(Type::Int8Ty);
|
|
||||||
// Get the two intrinsics we care about.
|
// Get the two intrinsics we care about.
|
||||||
Constant *StackSave, *StackRestore;
|
Constant *StackSave, *StackRestore;
|
||||||
StackSave = M->getOrInsertFunction("llvm.stacksave", BytePtr, NULL);
|
StackSave = Intrinsic::getDeclaration(M, Intrinsic::stacksave);
|
||||||
StackRestore = M->getOrInsertFunction("llvm.stackrestore", Type::VoidTy,
|
StackRestore = Intrinsic::getDeclaration(M, Intrinsic::stackrestore);
|
||||||
BytePtr, NULL);
|
|
||||||
|
|
||||||
// If we are preserving the callgraph, add edges to the stacksave/restore
|
// If we are preserving the callgraph, add edges to the stacksave/restore
|
||||||
// functions for the calls we insert.
|
// functions for the calls we insert.
|
||||||
@ -368,14 +366,12 @@ bool llvm::InlineFunction(CallSite CS, CallGraph *CG, const TargetData *TD) {
|
|||||||
// Insert the llvm.stacksave.
|
// Insert the llvm.stacksave.
|
||||||
CallInst *SavedPtr = CallInst::Create(StackSave, "savedstack",
|
CallInst *SavedPtr = CallInst::Create(StackSave, "savedstack",
|
||||||
FirstNewBlock->begin());
|
FirstNewBlock->begin());
|
||||||
SavedPtr->setDoesNotThrow();
|
|
||||||
if (CG) CallerNode->addCalledFunction(SavedPtr, StackSaveCGN);
|
if (CG) CallerNode->addCalledFunction(SavedPtr, StackSaveCGN);
|
||||||
|
|
||||||
// Insert a call to llvm.stackrestore before any return instructions in the
|
// Insert a call to llvm.stackrestore before any return instructions in the
|
||||||
// inlined function.
|
// inlined function.
|
||||||
for (unsigned i = 0, e = Returns.size(); i != e; ++i) {
|
for (unsigned i = 0, e = Returns.size(); i != e; ++i) {
|
||||||
CallInst *CI = CallInst::Create(StackRestore, SavedPtr, "", Returns[i]);
|
CallInst *CI = CallInst::Create(StackRestore, SavedPtr, "", Returns[i]);
|
||||||
CI->setDoesNotThrow();
|
|
||||||
if (CG) CallerNode->addCalledFunction(CI, StackRestoreCGN);
|
if (CG) CallerNode->addCalledFunction(CI, StackRestoreCGN);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -388,8 +384,7 @@ bool llvm::InlineFunction(CallSite CS, CallGraph *CG, const TargetData *TD) {
|
|||||||
for (Function::iterator BB = FirstNewBlock, E = Caller->end();
|
for (Function::iterator BB = FirstNewBlock, E = Caller->end();
|
||||||
BB != E; ++BB)
|
BB != E; ++BB)
|
||||||
if (UnwindInst *UI = dyn_cast<UnwindInst>(BB->getTerminator())) {
|
if (UnwindInst *UI = dyn_cast<UnwindInst>(BB->getTerminator())) {
|
||||||
CallInst *CI = CallInst::Create(StackRestore, SavedPtr, "", UI);
|
CallInst::Create(StackRestore, SavedPtr, "", UI);
|
||||||
CI->setDoesNotThrow();
|
|
||||||
++NumStackRestores;
|
++NumStackRestores;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user