25#define DEBUG_TYPE "lower-invoke"
40char LowerInvokeLegacyPass::ID = 0;
42 "Lower invoke and unwind, for unwindless code generators",
49 SmallVector<Value *, 16> CallArgs(II->args());
50 SmallVector<OperandBundleDef, 1> OpBundles;
51 II->getOperandBundlesAsDefs(OpBundles);
54 CallInst::Create(II->getFunctionType(), II->getCalledOperand(),
55 CallArgs, OpBundles,
"", II->getIterator());
56 NewCall->takeName(II);
57 NewCall->setCallingConv(II->getCallingConv());
58 NewCall->setAttributes(II->getAttributes());
59 NewCall->setDebugLoc(II->getDebugLoc());
60 II->replaceAllUsesWith(NewCall);
63 BranchInst::Create(II->getNormalDest(), II->getIterator());
66 II->getUnwindDest()->removePredecessor(&BB);
69 II->eraseFromParent();
77bool LowerInvokeLegacyPass::runOnFunction(
Function &
F) {
static bool runOnFunction(Function &F, bool PostInlining)
static bool runImpl(Function &F, const TargetLowering &TLI, AssumptionCache *AC)
uint64_t IntrinsicInst * II
#define INITIALIZE_PASS(passName, arg, name, cfg, analysis)
This file defines the SmallVector class.
This file defines the 'Statistic' class, which is designed to be an easy way to expose various metric...
#define STATISTIC(VARNAME, DESC)
LLVM Basic Block Representation.
FunctionPass class - This class is used to implement most global optimizations.
PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM)
static LLVM_ABI PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
A set of analyses that are preserved following a run of a transformation pass.
static PreservedAnalyses none()
Convenience factory function for the empty preserved set.
static PreservedAnalyses all()
Construct a special preserved set that preserves all passes.
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
This is an optimization pass for GlobalISel generic memory operations.
LLVM_ABI void initializeLowerInvokeLegacyPassPass(PassRegistry &)
decltype(auto) dyn_cast(const From &Val)
dyn_cast<X> - Return the argument parameter cast to the specified type.
LLVM_ABI FunctionPass * createLowerInvokePass()
AnalysisManager< Function > FunctionAnalysisManager
Convenience typedef for the Function analysis manager.
LLVM_ABI char & LowerInvokePassID