SmallPtrSet<Instruction *, 16> InstsInThisBlock;
/// \brief Keep track of the metadata nodes that have been checked already.
- SmallPtrSet<Metadata *, 32> MDNodes;
+ SmallPtrSet<const Metadata *, 32> MDNodes;
/// \brief The personality function referenced by the LandingPadInsts.
/// All LandingPadInsts within the same function must use the same
void visitAliaseeSubExpr(SmallPtrSetImpl<const GlobalAlias *> &Visited,
const GlobalAlias &A, const Constant &C);
void visitNamedMDNode(const NamedMDNode &NMD);
- void visitMDNode(MDNode &MD);
- void visitMetadataAsValue(MetadataAsValue &MD, Function *F);
- void visitValueAsMetadata(ValueAsMetadata &MD, Function *F);
+ void visitMDNode(const MDNode &MD);
+ void visitMetadataAsValue(const MetadataAsValue &MD, Function *F);
+ void visitValueAsMetadata(const ValueAsMetadata &MD, Function *F);
void visitComdat(const Comdat &C);
void visitModuleIdents(const Module &M);
void visitModuleFlags(const Module &M);
const Value *V);
void VerifyConstantExprBitcastType(const ConstantExpr *CE);
- void VerifyStatepoint(CallInst &CI);
+ void VerifyStatepoint(ImmutableCallSite CS);
};
class DebugInfoVerifier : public VerifierSupport {
public:
}
}
-void Verifier::visitMDNode(MDNode &MD) {
+void Verifier::visitMDNode(const MDNode &MD) {
// Only visit each node once. Metadata can be mutually recursive, so this
// avoids infinite recursion here, as well as being an optimization.
if (!MDNodes.insert(&MD).second)
Assert1(MD.isResolved(), "All nodes should be resolved!", &MD);
}
-void Verifier::visitValueAsMetadata(ValueAsMetadata &MD, Function *F) {
+void Verifier::visitValueAsMetadata(const ValueAsMetadata &MD, Function *F) {
Assert1(MD.getValue(), "Expected valid value", &MD);
Assert2(!MD.getValue()->getType()->isMetadataTy(),
"Unexpected metadata round-trip through values", &MD, MD.getValue());
Assert1(ActualF == F, "function-local metadata used in wrong function", L);
}
-void Verifier::visitMetadataAsValue(MetadataAsValue &MDV, Function *F) {
+void Verifier::visitMetadataAsValue(const MetadataAsValue &MDV, Function *F) {
Metadata *MD = MDV.getMetadata();
if (auto *N = dyn_cast<MDNode>(MD)) {
visitMDNode(*N);
}
/// \brief Verify that statepoint intrinsic is well formed.
-void Verifier::VerifyStatepoint(CallInst &CI) {
- assert(CI.getCalledFunction() &&
- CI.getCalledFunction()->getIntrinsicID() ==
- Intrinsic::experimental_gc_statepoint);
+void Verifier::VerifyStatepoint(ImmutableCallSite CS) {
+ assert(CS.getCalledFunction() &&
+ CS.getCalledFunction()->getIntrinsicID() ==
+ Intrinsic::experimental_gc_statepoint);
- Assert1(!CI.doesNotAccessMemory() &&
- !CI.onlyReadsMemory(),
+ const Instruction &CI = *CS.getInstruction();
+
+ Assert1(!CS.doesNotAccessMemory() &&
+ !CS.onlyReadsMemory(),
"gc.statepoint must read and write memory to preserve "
"reordering restrictions required by safepoint semantics", &CI);
- Assert1(!CI.isInlineAsm(),
- "gc.statepoint support for inline assembly unimplemented", &CI);
- const Value *Target = CI.getArgOperand(0);
+ const Value *Target = CS.getArgument(0);
const PointerType *PT = dyn_cast<PointerType>(Target->getType());
Assert2(PT && PT->getElementType()->isFunctionTy(),
"gc.statepoint callee must be of function pointer type",
&CI, Target);
FunctionType *TargetFuncType = cast<FunctionType>(PT->getElementType());
- const Value *NumCallArgsV = CI.getArgOperand(1);
+ const Value *NumCallArgsV = CS.getArgument(1);
Assert1(isa<ConstantInt>(NumCallArgsV),
"gc.statepoint number of arguments to underlying call "
"must be constant integer", &CI);
Assert1(NumCallArgs == NumParams,
"gc.statepoint mismatch in number of call args", &CI);
- const Value *Unused = CI.getArgOperand(2);
+ const Value *Unused = CS.getArgument(2);
Assert1(isa<ConstantInt>(Unused) &&
cast<ConstantInt>(Unused)->isNullValue(),
"gc.statepoint parameter #3 must be zero", &CI);
// the type of the wrapped callee.
for (int i = 0; i < NumParams; i++) {
Type *ParamType = TargetFuncType->getParamType(i);
- Type *ArgType = CI.getArgOperand(3+i)->getType();
+ Type *ArgType = CS.getArgument(3+i)->getType();
Assert1(ArgType == ParamType,
"gc.statepoint call argument does not match wrapped "
"function type", &CI);
}
const int EndCallArgsInx = 2+NumCallArgs;
- const Value *NumDeoptArgsV = CI.getArgOperand(EndCallArgsInx+1);
+ const Value *NumDeoptArgsV = CS.getArgument(EndCallArgsInx+1);
Assert1(isa<ConstantInt>(NumDeoptArgsV),
"gc.statepoint number of deoptimization arguments "
"must be constant integer", &CI);
"gc.statepoint number of deoptimization arguments "
"must be positive", &CI);
- Assert1(4 + NumCallArgs + NumDeoptArgs <= (int)CI.getNumArgOperands(),
+ Assert1(4 + NumCallArgs + NumDeoptArgs <= (int)CS.arg_size(),
"gc.statepoint too few arguments according to length fields", &CI);
// Check that the only uses of this gc.statepoint are gc.result or
// gc.relocate calls which are tied to this statepoint and thus part
// of the same statepoint sequence
- for (User *U : CI.users()) {
+ for (const User *U : CI.users()) {
const CallInst *Call = dyn_cast<const CallInst>(U);
Assert2(Call, "illegal use of statepoint token", &CI, U);
if (!Call) continue;
PointerType *ThisArgType = dyn_cast<PointerType>(Ty);
return (!ThisArgType || ThisArgType->getElementType() != ReferenceType);
}
+ case IITDescriptor::VecOfPtrsToElt: {
+ if (D.getArgumentNumber() >= ArgTys.size())
+ return true;
+ VectorType * ReferenceType =
+ dyn_cast<VectorType> (ArgTys[D.getArgumentNumber()]);
+ VectorType *ThisArgVecTy = dyn_cast<VectorType>(Ty);
+ if (!ThisArgVecTy || !ReferenceType ||
+ (ReferenceType->getVectorNumElements() !=
+ ThisArgVecTy->getVectorNumElements()))
+ return true;
+ PointerType *ThisArgEltTy =
+ dyn_cast<PointerType>(ThisArgVecTy->getVectorElementType());
+ if (!ThisArgEltTy)
+ return true;
+ return (!(ThisArgEltTy->getElementType() ==
+ ReferenceType->getVectorElementType()));
+ }
}
llvm_unreachable("unhandled");
}
}
case Intrinsic::experimental_gc_statepoint:
- VerifyStatepoint(CI);
+ Assert1(!CI.isInlineAsm(),
+ "gc.statepoint support for inline assembly unimplemented", &CI);
+
+ VerifyStatepoint(ImmutableCallSite(&CI));
break;
case Intrinsic::experimental_gc_result_int:
case Intrinsic::experimental_gc_result_float: