mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-20 10:24:12 +00:00
Rename isNoReturn to doesNotReturn, and isNoUnwind to
doesNotThrow. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45160 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -166,12 +166,12 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// @brief Determine if the function cannot return.
|
/// @brief Determine if the function cannot return.
|
||||||
bool isNoReturn() const {
|
bool doesNotReturn() const {
|
||||||
return paramHasAttr(0, ParamAttr::NoReturn);
|
return paramHasAttr(0, ParamAttr::NoReturn);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @brief Determine if the function cannot unwind.
|
/// @brief Determine if the function cannot unwind.
|
||||||
bool isNoUnwind() const {
|
bool doesNotThrow() const {
|
||||||
return paramHasAttr(0, ParamAttr::NoUnwind);
|
return paramHasAttr(0, ParamAttr::NoUnwind);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -940,12 +940,12 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// @brief Determine if the call cannot return.
|
/// @brief Determine if the call cannot return.
|
||||||
bool isNoReturn() const {
|
bool doesNotReturn() const {
|
||||||
return paramHasAttr(0, ParamAttr::NoReturn);
|
return paramHasAttr(0, ParamAttr::NoReturn);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @brief Determine if the call cannot unwind.
|
/// @brief Determine if the call cannot unwind.
|
||||||
bool isNoUnwind() const {
|
bool doesNotThrow() const {
|
||||||
return paramHasAttr(0, ParamAttr::NoUnwind);
|
return paramHasAttr(0, ParamAttr::NoUnwind);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1744,12 +1744,12 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// @brief Determine if the call cannot return.
|
/// @brief Determine if the call cannot return.
|
||||||
bool isNoReturn() const {
|
bool doesNotReturn() const {
|
||||||
return paramHasAttr(0, ParamAttr::NoReturn);
|
return paramHasAttr(0, ParamAttr::NoReturn);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @brief Determine if the call cannot unwind.
|
/// @brief Determine if the call cannot unwind.
|
||||||
bool isNoUnwind() const {
|
bool doesNotThrow() const {
|
||||||
return paramHasAttr(0, ParamAttr::NoUnwind);
|
return paramHasAttr(0, ParamAttr::NoUnwind);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,7 +74,7 @@ public:
|
|||||||
bool onlyReadsMemory() const;
|
bool onlyReadsMemory() const;
|
||||||
|
|
||||||
/// @brief Determine if the call cannot unwind.
|
/// @brief Determine if the call cannot unwind.
|
||||||
bool isNoUnwind() const;
|
bool doesNotThrow() const;
|
||||||
|
|
||||||
/// getType - Return the type of the instruction that generated this call site
|
/// getType - Return the type of the instruction that generated this call site
|
||||||
///
|
///
|
||||||
|
@ -74,11 +74,11 @@ bool PruneEH::runOnSCC(const std::vector<CallGraphNode *> &SCC) {
|
|||||||
SCCMightUnwind = true;
|
SCCMightUnwind = true;
|
||||||
SCCMightReturn = true;
|
SCCMightReturn = true;
|
||||||
} else if (F->isDeclaration()) {
|
} else if (F->isDeclaration()) {
|
||||||
SCCMightUnwind |= !F->isNoUnwind();
|
SCCMightUnwind |= !F->doesNotThrow();
|
||||||
SCCMightReturn |= !F->isNoReturn();
|
SCCMightReturn |= !F->doesNotReturn();
|
||||||
} else {
|
} else {
|
||||||
bool CheckUnwind = !SCCMightUnwind && !F->isNoUnwind();
|
bool CheckUnwind = !SCCMightUnwind && !F->doesNotThrow();
|
||||||
bool CheckReturn = !SCCMightReturn && !F->isNoReturn();
|
bool CheckReturn = !SCCMightReturn && !F->doesNotReturn();
|
||||||
|
|
||||||
if (!CheckUnwind && !CheckReturn)
|
if (!CheckUnwind && !CheckReturn)
|
||||||
continue;
|
continue;
|
||||||
@ -98,7 +98,7 @@ bool PruneEH::runOnSCC(const std::vector<CallGraphNode *> &SCC) {
|
|||||||
if (CheckUnwind && !SCCMightUnwind)
|
if (CheckUnwind && !SCCMightUnwind)
|
||||||
for (BasicBlock::iterator I = BB->begin(), E = BB->end(); I != E; ++I)
|
for (BasicBlock::iterator I = BB->begin(), E = BB->end(); I != E; ++I)
|
||||||
if (CallInst *CI = dyn_cast<CallInst>(I)) {
|
if (CallInst *CI = dyn_cast<CallInst>(I)) {
|
||||||
if (CI->isNoUnwind()) {
|
if (CI->doesNotThrow()) {
|
||||||
// This call cannot throw.
|
// This call cannot throw.
|
||||||
} else if (Function *Callee = CI->getCalledFunction()) {
|
} else if (Function *Callee = CI->getCalledFunction()) {
|
||||||
CallGraphNode *CalleeNode = CG[Callee];
|
CallGraphNode *CalleeNode = CG[Callee];
|
||||||
@ -155,7 +155,7 @@ bool PruneEH::SimplifyFunction(Function *F) {
|
|||||||
bool MadeChange = false;
|
bool MadeChange = false;
|
||||||
for (Function::iterator BB = F->begin(), E = F->end(); BB != E; ++BB) {
|
for (Function::iterator BB = F->begin(), E = F->end(); BB != E; ++BB) {
|
||||||
if (InvokeInst *II = dyn_cast<InvokeInst>(BB->getTerminator()))
|
if (InvokeInst *II = dyn_cast<InvokeInst>(BB->getTerminator()))
|
||||||
if (II->isNoUnwind()) {
|
if (II->doesNotThrow()) {
|
||||||
SmallVector<Value*, 8> Args(II->op_begin()+3, II->op_end());
|
SmallVector<Value*, 8> Args(II->op_begin()+3, II->op_end());
|
||||||
// Insert a call instruction before the invoke.
|
// Insert a call instruction before the invoke.
|
||||||
CallInst *Call = new CallInst(II->getCalledValue(),
|
CallInst *Call = new CallInst(II->getCalledValue(),
|
||||||
@ -187,7 +187,7 @@ bool PruneEH::SimplifyFunction(Function *F) {
|
|||||||
|
|
||||||
for (BasicBlock::iterator I = BB->begin(), E = BB->end(); I != E; )
|
for (BasicBlock::iterator I = BB->begin(), E = BB->end(); I != E; )
|
||||||
if (CallInst *CI = dyn_cast<CallInst>(I++))
|
if (CallInst *CI = dyn_cast<CallInst>(I++))
|
||||||
if (CI->isNoReturn() && !isa<UnreachableInst>(I)) {
|
if (CI->doesNotReturn() && !isa<UnreachableInst>(I)) {
|
||||||
// This call calls a function that cannot return. Insert an
|
// This call calls a function that cannot return. Insert an
|
||||||
// unreachable instruction after it and simplify the code. Do this
|
// unreachable instruction after it and simplify the code. Do this
|
||||||
// by splitting the BB, adding the unreachable, then deleting the
|
// by splitting the BB, adding the unreachable, then deleting the
|
||||||
|
@ -8039,7 +8039,7 @@ Instruction *InstCombiner::visitCallSite(CallSite CS) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isa<InlineAsm>(Callee) && !CS.isNoUnwind()) {
|
if (isa<InlineAsm>(Callee) && !CS.paramHasAttr(0, ParamAttr::NoUnwind)) {
|
||||||
// Inline asm calls cannot throw - mark them 'nounwind'.
|
// Inline asm calls cannot throw - mark them 'nounwind'.
|
||||||
const ParamAttrsList *PAL = CS.getParamAttrs();
|
const ParamAttrsList *PAL = CS.getParamAttrs();
|
||||||
uint16_t RAttributes = PAL ? PAL->getParamAttrs(0) : 0;
|
uint16_t RAttributes = PAL ? PAL->getParamAttrs(0) : 0;
|
||||||
|
@ -111,7 +111,7 @@ static bool MarkAliveBlocks(BasicBlock *BB,
|
|||||||
// canonicalizes unreachable insts into stores to null or undef.
|
// canonicalizes unreachable insts into stores to null or undef.
|
||||||
for (BasicBlock::iterator BBI = BB->begin(), E = BB->end(); BBI != E;++BBI){
|
for (BasicBlock::iterator BBI = BB->begin(), E = BB->end(); BBI != E;++BBI){
|
||||||
if (CallInst *CI = dyn_cast<CallInst>(BBI)) {
|
if (CallInst *CI = dyn_cast<CallInst>(BBI)) {
|
||||||
if (CI->isNoReturn()) {
|
if (CI->doesNotReturn()) {
|
||||||
// If we found a call to a no-return function, insert an unreachable
|
// If we found a call to a no-return function, insert an unreachable
|
||||||
// instruction after it. Make sure there isn't *already* one there
|
// instruction after it. Make sure there isn't *already* one there
|
||||||
// though.
|
// though.
|
||||||
@ -135,7 +135,7 @@ static bool MarkAliveBlocks(BasicBlock *BB,
|
|||||||
|
|
||||||
// Turn invokes that call 'nounwind' functions into ordinary calls.
|
// Turn invokes that call 'nounwind' functions into ordinary calls.
|
||||||
if (InvokeInst *II = dyn_cast<InvokeInst>(BB->getTerminator()))
|
if (InvokeInst *II = dyn_cast<InvokeInst>(BB->getTerminator()))
|
||||||
if (II->isNoUnwind()) {
|
if (II->doesNotThrow()) {
|
||||||
ChangeToCall(II);
|
ChangeToCall(II);
|
||||||
Changed = true;
|
Changed = true;
|
||||||
}
|
}
|
||||||
|
@ -70,7 +70,7 @@ static void HandleInlinedInvoke(InvokeInst *II, BasicBlock *FirstNewBlock,
|
|||||||
CallInst *CI = cast<CallInst>(I);
|
CallInst *CI = cast<CallInst>(I);
|
||||||
|
|
||||||
// If this call cannot unwind, don't convert it to an invoke.
|
// If this call cannot unwind, don't convert it to an invoke.
|
||||||
if (CI->isNoUnwind())
|
if (CI->doesNotThrow())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Convert this function call into an invoke instruction.
|
// Convert this function call into an invoke instruction.
|
||||||
|
@ -65,11 +65,11 @@ bool CallSite::onlyReadsMemory() const {
|
|||||||
else
|
else
|
||||||
return cast<InvokeInst>(I)->onlyReadsMemory();
|
return cast<InvokeInst>(I)->onlyReadsMemory();
|
||||||
}
|
}
|
||||||
bool CallSite::isNoUnwind() const {
|
bool CallSite::doesNotThrow() const {
|
||||||
if (CallInst *CI = dyn_cast<CallInst>(I))
|
if (CallInst *CI = dyn_cast<CallInst>(I))
|
||||||
return CI->isNoUnwind();
|
return CI->doesNotThrow();
|
||||||
else
|
else
|
||||||
return cast<InvokeInst>(I)->isNoUnwind();
|
return cast<InvokeInst>(I)->doesNotThrow();
|
||||||
}
|
}
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
Reference in New Issue
Block a user