27 #define DEBUG_TYPE "lowerinvoke"
29 STATISTIC(NumInvokes,
"Number of invokes replaced");
44 "Lower invoke and unwind, for unwindless code generators",
51 return new LowerInvoke();
54 bool LowerInvoke::runOnFunction(
Function &
F) {
57 if (
InvokeInst *II = dyn_cast<InvokeInst>(BB->getTerminator())) {
62 NewCall->takeName(II);
63 NewCall->setCallingConv(II->getCallingConv());
64 NewCall->setAttributes(II->getAttributes());
65 NewCall->setDebugLoc(II->getDebugLoc());
66 II->replaceAllUsesWith(NewCall);
72 II->getUnwindDest()->removePredecessor(BB);
75 BB->getInstList().erase(II);
77 ++NumInvokes; Changed =
true;
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
STATISTIC(NumFunctions,"Total number of functions")
CallInst - This class represents a function call, abstracting a target machine's calling convention...
static CallInst * Create(Value *Func, ArrayRef< Value * > Args, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
FunctionPass class - This class is used to implement most global optimizations.
#define INITIALIZE_PASS(passName, arg, name, cfg, analysis)
void initializeLowerInvokePass(PassRegistry &)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
Module.h This file contains the declarations for the Module class.
static BranchInst * Create(BasicBlock *IfTrue, Instruction *InsertBefore=nullptr)
FunctionPass * createLowerInvokePass()
InvokeInst - Invoke instruction.