Lines Matching +full:depth +full:- +full:wise

1 //===- StatepointLowering.cpp - SDAGBuilder's statepoint code -------------===//
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
12 //===----------------------------------------------------------------------===//
56 #define DEBUG_TYPE "statepoint-lowering"
65 "use-registers-for-deopt-values", cl::Hidden, cl::init(false),
69 "use-registers-for-gc-values-in-landing-pad", cl::Hidden, cl::init(false),
73 "max-registers-for-gc-values", cl::Hidden, cl::init(0),
92 // Need to resize this on each safepoint - we need the two to stay in sync and
114 (-8u & (7 + ValueType.getSizeInBits())) && // Round up modulo 8.
142 const unsigned FI = cast<FrameIndexSDNode>(SpillSlot)->getIndex();
159 /// LookUpDepth specifies maximum DFS depth this function is allowed to look.
163 // Can not look any further - give up now
169 const Value *Statepoint = Relocate->getStatepoint();
182 auto &Record = It->second;
191 return findPreviousSpillSlot(Cast->getOperand(0), Builder, LookUpDepth - 1);
199 for (const auto &IncomingValue : Phi->incoming_values()) {
201 findPreviousSpillSlot(IncomingValue, Builder, LookUpDepth - 1);
244 /// Return true if-and-only-if the given SDValue can be lowered as either a
342 if (CallEnd->getOpcode() == ISD::EH_LABEL)
343 CallEnd = CallEnd->getOperand(0).getNode();
345 bool HasDef = !SI.CLI.RetTy->isVoidTy();
347 if (CallEnd->getOpcode() == ISD::LOAD)
348 CallEnd = CallEnd->getOperand(0).getNode();
350 while (CallEnd->getOpcode() == ISD::CopyFromReg)
351 CallEnd = CallEnd->getOperand(0).getNode();
354 assert(CallEnd->getOpcode() == ISD::CALLSEQ_END && "expected!");
355 return std::make_pair(ReturnValue, CallEnd->getOperand(0).getNode());
385 int Index = cast<FrameIndexSDNode>(Loc)->getIndex();
396 (-8 & (7 + // Round up modulo 8.
436 Ops.push_back(Builder.DAG.getTargetFrameIndex(FI->getIndex(),
461 pushStackMapConstant(Ops, Builder, C->getSExtValue());
465 C->getValueAPF().bitcastToAPInt().getZExtValue());
475 // If this value is live in (not live-on-return, or live-through), we can
480 // clobbered by the call. This is fine for live-in. For live-through
481 // fix-up pass should be executed to force spilling of such registers.
486 // independent, but don't bother to exploit that chain wise. DAGCombine
503 auto *Ty = V->getType();
504 if (!Ty->isPtrOrPtrVectorTy())
507 if (auto IsManaged = GFI->getStrategy().isGCManagedPointer(Ty))
530 // Note: It is conservatively correct to lower both "live-in" and "live-out"
531 // as "live-through". A "live-through" variable is one which is "live-in",
532 // "live-out", and live throughout the lifetime of the call (i.e. we can find
536 // fine for live-out, but not for live-through. If we were willing to make
538 // potentially allow live-through values in callee saved registers.
551 LandingPadInst *LPI = StInvoke->getLandingPadInst();
553 if (Relocate->getOperand(0) == LPI) {
554 LPadPointers.insert(Builder.getValue(Relocate->getBasePtr()));
555 LPadPointers.insert(Builder.getValue(Relocate->getDerivedPtr()));
580 GCPtrIndexMap[PtrSD] = LoweredGCPtrs.size() - 1;
585 assert(V->getType()->isVectorTy() == PtrSD.getValueType().isVector() &&
682 FI->getIndex(), Builder.getFrameIndexTy()));
724 if (Reloc->getParent() == SI.StatepointInstr->getParent())
753 SDValue Chain = CallNode->getOperand(0);
756 bool CallHasIncomingGlue = CallNode->getGluedNode();
759 Glue = CallNode->getOperand(CallNode->getNumOperands() - 1);
766 // any of the operands is a pointer-typed, that operand is immediately
781 if (V->getType()->isPointerTy())
800 // and flags to be read-only.
811 CallNode->getNumOperands() - (CallHasIncomingGlue ? 4 : 3);
815 SDValue CallTarget = SDValue(CallNode->getOperand(1).getNode(), 0);
822 RegMaskIt = CallNode->op_end() - 2;
824 RegMaskIt = CallNode->op_end() - 1;
825 Ops.insert(Ops.end(), CallNode->op_begin() + 2, RegMaskIt);
867 // For values lowered to tied-defs, create the virtual registers if used
872 Value *Derived = Relocate->getDerivedPtr();
878 SDValue Relocated = SDValue(StatepointMCNode, It->second);
882 if (SI.StatepointInstr->getParent() == Relocate->getParent()) {
895 auto *RetTy = Relocate->getType();
911 const Value *V = Relocate->getDerivedPtr();
915 bool IsLocal = (Relocate->getParent() == StatepointInstr->getParent());
927 Record.payload.FI = cast<FrameIndexSDNode>(Loc)->getIndex();
934 if (Relocate->getParent() != StatepointInstr->getParent())
952 TEOps.push_back(SDValue(StatepointMCNode, NumResults - 2));
957 if (V->getType()->isPointerTy())
962 TEOps.push_back(SDValue(StatepointMCNode, NumResults - 1));
975 unsigned NumSinkValues = SinkNode->getNumValues();
976 SDValue StatepointValues[2] = {SDValue(SinkNode, NumSinkValues - 2),
977 SDValue(SinkNode, NumSinkValues - 1)};
996 /// gc.result, second result is a non-block local gc.result. Corresponding
1005 if (GRI->getParent() == S.getParent())
1021 assert(GFI->getStrategy().useStatepoints() &&
1042 retAttrs = GCResultLocality.first->getAttributes().getRetAttrs();
1067 SDValue DerivedSD = getValue(Relocate->getDerivedPtr());
1069 SI.Bases.push_back(Relocate->getBasePtr());
1070 SI.Ptrs.push_back(Relocate->getDerivedPtr());
1107 setValue(&I, DAG.getIntPtrConstant(-1, getCurSDLoc()));
1128 Type *RetTy = GCResultLocality.second->getType();
1144 unsigned ArgBeginIndex = Call->arg_begin() - Call->op_begin();
1146 SI.CLI, Call, ArgBeginIndex, Call->arg_size(), Callee,
1147 ForceVoidReturnTy ? Type::getVoidTy(*DAG.getContext()) : Call->getType(),
1148 Call->getAttributes().getRetAttrs(), /*IsPatchPoint=*/false);
1150 SI.CLI.IsVarArg = Call->getFunctionType()->isVarArg();
1152 auto DeoptBundle = *Call->getOperandBundle(LLVMContext::OB_deopt);
1156 auto SD = parseStatepointDirectivesFromAttrs(Call->getAttributes());
1190 if (cast<GCStatepointInst>(SI)->getParent() == CI.getParent()) {
1219 if (cast<GCStatepointInst>(Statepoint)->getParent() == Relocate.getParent())
1228 const RecordType &Record = SlotIt->second;
1232 assert(cast<GCStatepointInst>(Statepoint)->getParent() ==