Lines Matching +full:ri +full:- +full:override

1 //===- DwarfEHPrepare - Prepare exception handling for code generation ----===//
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
12 //===----------------------------------------------------------------------===//
45 #define DEBUG_TYPE "dwarf-eh-prepare"
69 Value *GetExceptionObject(ResumeInst *RI);
93 Value *DwarfEHPrepare::GetExceptionObject(ResumeInst *RI) {
94 Value *V = RI->getOperand(0);
102 if (SelIVI->getNumIndices() == 1 && *SelIVI->idx_begin() == 1) {
103 ExcIVI = dyn_cast<InsertValueInst>(SelIVI->getOperand(0));
104 if (ExcIVI && isa<UndefValue>(ExcIVI->getOperand(0)) &&
105 ExcIVI->getNumIndices() == 1 && *ExcIVI->idx_begin() == 0) {
106 ExnObj = ExcIVI->getOperand(1);
107 SelLoad = dyn_cast<LoadInst>(SelIVI->getOperand(1));
114 ExnObj = ExtractValueInst::Create(RI->getOperand(0), 0, "exn.obj",
115 RI->getIterator());
117 RI->eraseFromParent();
120 if (SelIVI->use_empty())
121 SelIVI->eraseFromParent();
122 if (ExcIVI->use_empty())
123 ExcIVI->eraseFromParent();
124 if (SelLoad && SelLoad->use_empty())
125 SelLoad->eraseFromParent();
138 for (auto *RI : Resumes) {
140 if (isPotentiallyReachable(LP, RI, nullptr, &DTU->getDomTree())) {
157 ResumeInst *RI = Resumes[I];
159 Resumes[ResumesLeft++] = RI;
161 BasicBlock *BB = RI->getParent();
162 new UnreachableInst(Ctx, RI->getIterator());
163 RI->eraseFromParent();
179 if (auto *RI = dyn_cast<ResumeInst>(BB.getTerminator()))
180 Resumes.push_back(RI);
182 if (LP->isCleanup())
191 // Check the personality, don't do anything if it's scope-based.
205 if (LP->isCleanup())
208 NumCleanupLandingPadsUnreachable += CleanupLPads.size() - NumRemainingLPs;
209 NumCleanupLandingPadsRemaining -= CleanupLPads.size() - NumRemainingLPs;
216 // RewindFunction - _Unwind_Resume or the target equivalent.
237 RewindFunction = F.getParent()->getOrInsertFunction(RewindName, FTy);
243 ResumeInst *RI = Resumes.front();
244 BasicBlock *UnwindBB = RI->getParent();
245 Value *ExnObj = GetExceptionObject(RI);
253 // The verifier requires that all calls of debug-info-bearing functions
254 // from debug-info-bearing functions have a debug location (for inlining
257 if (RewindFn && RewindFn->getSubprogram())
259 CI->setDebugLoc(DILocation::get(SP->getContext(), 0, 0, SP));
260 CI->setCallingConv(RewindFunctionCallingConv);
263 CI->setDoesNotReturn();
279 for (ResumeInst *RI : Resumes) {
280 BasicBlock *Parent = RI->getParent();
284 Value *ExnObj = GetExceptionObject(RI);
285 PN->addIncoming(ExnObj, Parent);
296 // The verifier requires that all calls of debug-info-bearing functions
297 // from debug-info-bearing functions have a debug location (for inlining
300 if (RewindFn && RewindFn->getSubprogram())
302 CI->setDebugLoc(DILocation::get(SP->getContext(), 0, 0, SP));
303 CI->setCallingConv(RewindFunctionCallingConv);
306 CI->setDoesNotReturn();
310 DTU->applyUpdates(Updates);
344 bool runOnFunction(Function &F) override {
347 const TargetLowering &TLI = *TM.getSubtargetImpl(F)->getTargetLowering();
351 DT = &DTWP->getDomTree();
360 void getAnalysisUsage(AnalysisUsage &AU) const override {
370 StringRef getPassName() const override {
379 const auto &TLI = *TM->getSubtargetImpl(F)->getTargetLowering();
382 auto OptLevel = TM->getOptLevel();
389 prepareDwarfEH(OptLevel, F, TLI, DT, TTI, TM->getTargetTriple());