protected:
explicit StatepointBase(InstructionTy *I) {
- StatepointCall = isStatepoint(I) ? cast<CallTy>(I) : nullptr;
+ StatepointCall = dyn_cast<GCStatepointInst>(I);
}
explicit StatepointBase(CallTy *Call) {
- StatepointCall = isStatepoint(Call) ? Call : nullptr;
+ StatepointCall = dyn_cast<GCStatepointInst>(Call);
}
public:
}
/// The statepoint with which this gc.relocate is associated.
- const CallBase *getStatepoint() const {
+ const GCStatepointInst *getStatepoint() const {
const Value *Token = getArgOperand(0);
// This takes care both of relocates for call statepoints and relocates
// on normal path of invoke statepoint.
- if (!isa<LandingPadInst>(Token)) {
- assert(isStatepoint(Token));
- return cast<CallBase>(Token);
- }
+ if (!isa<LandingPadInst>(Token))
+ return cast<GCStatepointInst>(Token);
// This relocate is on exceptional path of an invoke statepoint
const BasicBlock *InvokeBB =
assert(InvokeBB && "safepoints should have unique landingpads");
assert(InvokeBB->getTerminator() &&
"safepoint block should be well formed");
- assert(isStatepoint(InvokeBB->getTerminator()));
- return cast<CallBase>(InvokeBB->getTerminator());
+ return cast<GCStatepointInst>(InvokeBB->getTerminator());
}
};
void SelectionDAGBuilder::visitGCResult(const GCResultInst &CI) {
// The result value of the gc_result is simply the result of the actual
// call. We've already emitted this, so just grab the value.
- const Instruction *I = CI.getStatepoint();
+ const GCStatepointInst *I = CI.getStatepoint();
if (I->getParent() != CI.getParent()) {
// Statepoint is in different basic block so we should have stored call
// register because statepoint and actual call return types can be
// different, and getValue() will use CopyFromReg of the wrong type,
// which is always i32 in our case.
- Type *RetTy = cast<GCStatepointInst>(I)->getActualReturnType();
+ Type *RetTy = I->getActualReturnType();
SDValue CopyFromReg = getCopyFromRegs(I, RetTy);
assert(CopyFromReg.getNode());
// Verify rest of the relocate arguments.
const CallBase &StatepointCall =
- *cast<CallBase>(cast<GCRelocateInst>(Call).getStatepoint());
+ *cast<GCRelocateInst>(Call).getStatepoint();
// Both the base and derived must be piped through the safepoint.
Value *Base = Call.getArgOperand(1);