}
void
-SelectionDAGBuilder::LowerStatepoint(ImmutableStatepoint ISP,
+SelectionDAGBuilder::LowerStatepoint(const GCStatepointInst &I,
const BasicBlock *EHPadBB /*= nullptr*/) {
- assert(ISP.getCall()->getCallingConv() != CallingConv::AnyReg &&
+ ImmutableStatepoint ISP(&I);
+ assert(I.getCallingConv() != CallingConv::AnyReg &&
"anyregcc is not supported on statepoints!");
#ifndef NDEBUG
SDValue ActualCallee;
SDValue Callee = getValue(ISP.getCalledValue());
- if (ISP.getNumPatchBytes() > 0) {
+ if (I.getNumPatchBytes() > 0) {
// If we've been asked to emit a nop sequence instead of a call instruction
// for this statepoint then don't lower the call target, but use a constant
// `undef` instead. Not lowering the call target lets statepoint clients
}
StatepointLoweringInfo SI(DAG);
- populateCallLoweringInfo(SI.CLI, ISP.getCall(),
- ImmutableStatepoint::CallArgsBeginPos,
- ISP.getNumCallArgs(), ActualCallee,
+ populateCallLoweringInfo(SI.CLI, &I, GCStatepointInst::CallArgsBeginPos,
+ I.getNumCallArgs(), ActualCallee,
ISP.getActualReturnType(), false /* IsPatchPoint */);
// There may be duplication in the gc.relocate list; such as two copies of
}
SI.GCArgs = ArrayRef<const Use>(ISP.gc_args_begin(), ISP.gc_args_end());
- SI.StatepointInstr = ISP.getInstruction();
- SI.ID = ISP.getID();
+ SI.StatepointInstr = &I;
+ SI.ID = I.getID();
- if (auto Opt = ISP.getCall()->getOperandBundle(LLVMContext::OB_deopt)) {
+ if (auto Opt = I.getOperandBundle(LLVMContext::OB_deopt)) {
assert(ISP.deopt_begin() == ISP.deopt_end() &&
"can't list both deopt operands and deopt bundle");
auto &Inputs = Opt->Inputs;
} else {
SI.DeoptState = ArrayRef<const Use>(ISP.deopt_begin(), ISP.deopt_end());
}
- if (auto Opt = ISP.getCall()->getOperandBundle(LLVMContext::OB_gc_transition)) {
+ if (auto Opt = I.getOperandBundle(LLVMContext::OB_gc_transition)) {
assert(ISP.gc_transition_args_begin() == ISP.gc_transition_args_end() &&
"can't list both gc_transition operands and bundle");
auto &Inputs = Opt->Inputs;
ISP.gc_transition_args_end());
}
- SI.StatepointFlags = ISP.getFlags();
- SI.NumPatchBytes = ISP.getNumPatchBytes();
+ SI.StatepointFlags = I.getFlags();
+ SI.NumPatchBytes = I.getNumPatchBytes();
SI.EHPadBB = EHPadBB;
SDValue ReturnValue = LowerAsSTATEPOINT(SI);
const GCResultInst *GCResult = ISP.getGCResult();
Type *RetTy = ISP.getActualReturnType();
if (!RetTy->isVoidTy() && GCResult) {
- if (GCResult->getParent() != ISP.getCall()->getParent()) {
+ if (GCResult->getParent() != I.getParent()) {
// Result value will be used in a different basic block so we need to
// export it now. Default exporting mechanism will not work here because
// statepoint call has a different type than the actual call. It means
unsigned Reg = FuncInfo.CreateRegs(RetTy);
RegsForValue RFV(*DAG.getContext(), DAG.getTargetLoweringInfo(),
DAG.getDataLayout(), Reg, RetTy,
- ISP.getCall()->getCallingConv());
+ I.getCallingConv());
SDValue Chain = DAG.getEntryNode();
RFV.getCopyToRegs(ReturnValue, DAG, getCurSDLoc(), Chain, nullptr);
PendingExports.push_back(Chain);
- FuncInfo.ValueMap[ISP.getInstruction()] = Reg;
+ FuncInfo.ValueMap[&I] = Reg;
} else {
// Result value will be used in a same basic block. Don't export it or
// perform any explicit register copies.
// We'll replace the actuall call node shortly. gc_result will grab
// this value.
- setValue(ISP.getInstruction(), ReturnValue);
+ setValue(&I, ReturnValue);
}
} else {
// The token value is never used from here on, just generate a poison value
- setValue(ISP.getInstruction(), DAG.getIntPtrConstant(-1, getCurSDLoc()));
+ setValue(&I, DAG.getIntPtrConstant(-1, getCurSDLoc()));
}
}