Lines Matching +full:ri +full:- +full:override
1 //===-- GCRootLowering.cpp - Garbage collection infrastructure ------------===//
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
11 //===----------------------------------------------------------------------===//
35 /// frontend, but the old API made this non-obvious, so we do a potentially
41 /// LowerIntrinsics - This pass rewrites calls to the llvm.gcread or
50 StringRef getPassName() const override;
51 void getAnalysisUsage(AnalysisUsage &AU) const override;
53 bool doInitialization(Module &M) override;
54 bool runOnFunction(Function &F) override;
57 /// GCMachineCodeAnalysis - This is a target-independent pass over the machine
76 void getAnalysisUsage(AnalysisUsage &AU) const override;
78 bool runOnMachineFunction(MachineFunction &MF) override;
98 // -----------------------------------------------------------------------------
100 INITIALIZE_PASS_BEGIN(LowerIntrinsics, "gc-lowering", "GC Lowering", false,
103 INITIALIZE_PASS_END(LowerIntrinsics, "gc-lowering", "GC Lowering", false, false)
124 /// doInitialization - If this module uses the GC intrinsics, find them now.
130 MI->getFunctionInfo(F); // Instantiate the GC strategy.
135 /// CouldBecomeSafePoint - Predicate to conservatively determine whether the
141 // - call, invoke (AfterCall, BeforeCall)
142 // - phis (Loops)
143 // - invoke, ret, unwind (Exit)
146 // libcalls upon lowering (e.g., div i64 on a 32-bit platform), so instead
155 if (Function *F = CI->getCalledFunction())
156 if (Intrinsic::ID IID = F->getIntrinsicID())
174 dyn_cast<AllocaInst>(SI->getOperand(1)->stripPointerCasts()))
183 ConstantPointerNull::get(cast<PointerType>(Root->getAllocatedType())),
184 Root, std::next(Root->getIterator()));
191 /// runOnFunction - Replace gcread/gcwrite intrinsics with loads and stores.
214 Function *F = CI->getCalledFunction();
215 switch (F->getIntrinsicID()) {
219 Value *St = new StoreInst(CI->getArgOperand(0), CI->getArgOperand(2),
220 CI->getIterator());
221 CI->replaceAllUsesWith(St);
222 CI->eraseFromParent();
228 Value *Ld = new LoadInst(CI->getType(), CI->getArgOperand(1), "",
229 CI->getIterator());
230 Ld->takeName(CI);
231 CI->replaceAllUsesWith(Ld);
232 CI->eraseFromParent();
240 cast<AllocaInst>(CI->getArgOperand(0)->stripPointerCasts()));
252 // -----------------------------------------------------------------------------
257 INITIALIZE_PASS(GCMachineCodeAnalysis, "gc-analysis",
271 MCSymbol *Label = MBB.getParent()->getContext().createTempSymbol();
272 BuildMI(MBB, MI, DL, TII->get(TargetOpcode::GC_LABEL)).addSym(Label);
282 MCSymbol *Label = InsertLabel(*CI->getParent(), RAI, CI->getDebugLoc());
283 FI->addSafePoint(Label, CI->getDebugLoc());
304 for (GCFunctionInfo::roots_iterator RI = FI->roots_begin();
305 RI != FI->roots_end();) {
307 if (MF.getFrameInfo().isDeadObjectIndex(RI->Num)) {
308 RI = FI->removeStackRoot(RI);
312 auto FrameOffset = TFI->getFrameIndexReference(MF, RI->Num, FrameReg);
315 RI->StackOffset = FrameOffset.getFixed();
316 ++RI;
334 MFI.hasVarSizedObjects() || RegInfo->hasStackRealignment(MF);
335 FI->setFrameSize(DynamicFrameSize ? UINT64_MAX : MFI.getStackSize());
338 if (FI->getStrategy().needsSafePoints())