if (GV.hasAppendingLinkage()) {
const GlobalVariable *GVar = dyn_cast<GlobalVariable>(&GV);
- Assert(GVar && GVar->getType()->getElementType()->isArrayTy(),
+ Assert(GVar && GVar->getValueType()->isArrayTy(),
"Only global arrays can have appending linkage!", GVar);
}
}
"invalid linkage for intrinsic global variable", &GV);
// Don't worry about emitting an error for it not being an array,
// visitGlobalValue will complain on appending non-array.
- if (ArrayType *ATy = dyn_cast<ArrayType>(GV.getType()->getElementType())) {
+ if (ArrayType *ATy = dyn_cast<ArrayType>(GV.getValueType())) {
StructType *STy = dyn_cast<StructType>(ATy->getElementType());
PointerType *FuncPtrTy =
FunctionType::get(Type::getVoidTy(*Context), false)->getPointerTo();
V);
Assert(!AttrBuilder(Attrs, Idx)
- .hasAttributes(AttributeFuncs::typeIncompatible(Ty, Idx), Idx),
+ .overlaps(AttributeFuncs::typeIncompatible(Ty)),
"Wrong types for attribute: " +
- AttributeFuncs::typeIncompatible(Ty, Idx).getAsString(Idx),
+ AttributeSet::get(*Context, Idx,
+ AttributeFuncs::typeIncompatible(Ty)).getAsString(Idx),
V);
if (PointerType *PTy = dyn_cast<PointerType>(Ty)) {
const PointerType *PT = dyn_cast<PointerType>(Target->getType());
Assert(PT && PT->getElementType()->isFunctionTy(),
"gc.statepoint callee must be of function pointer type", &CI, Target);
- FunctionType *TargetFuncType = cast<FunctionType>(PT->getElementType());
+ FunctionType *TargetFuncType = CS.getFunctionType();
const Value *NumCallArgsV = CS.getArgument(1);
Assert(isa<ConstantInt>(NumCallArgsV),
Assert(NumCallArgs == NumParams,
"gc.statepoint mismatch in number of call args", &CI);
- const Value *Unused = CS.getArgument(2);
- Assert(isa<ConstantInt>(Unused) && cast<ConstantInt>(Unused)->isNullValue(),
- "gc.statepoint parameter #3 must be zero", &CI);
+ const Value *FlagsV = CS.getArgument(2);
+ Assert(isa<ConstantInt>(FlagsV),
+ "gc.statepoint flags must be constant integer", &CI);
+ const uint64_t Flags = cast<ConstantInt>(FlagsV)->getZExtValue();
+ Assert((Flags & ~(uint64_t)StatepointFlags::MaskAll) == 0,
+ "unknown flag used in gc.statepoint flags argument", &CI);
// Verify that the types of the call parameter arguments match
// the type of the wrapped callee.
&CI);
}
const int EndCallArgsInx = 2+NumCallArgs;
- const Value *NumDeoptArgsV = CS.getArgument(EndCallArgsInx+1);
+
+ const Value *NumTransitionArgsV = CS.getArgument(EndCallArgsInx+1);
+ Assert(isa<ConstantInt>(NumTransitionArgsV),
+ "gc.statepoint number of transition arguments "
+ "must be constant integer",
+ &CI);
+ const int NumTransitionArgs =
+ cast<ConstantInt>(NumTransitionArgsV)->getZExtValue();
+ Assert(NumTransitionArgs >= 0,
+ "gc.statepoint number of transition arguments must be positive", &CI);
+ const int EndTransitionArgsInx = EndCallArgsInx + 1 + NumTransitionArgs;
+
+ const Value *NumDeoptArgsV = CS.getArgument(EndTransitionArgsInx+1);
Assert(isa<ConstantInt>(NumDeoptArgsV),
"gc.statepoint number of deoptimization arguments "
"must be constant integer",
"must be positive",
&CI);
- Assert(4 + NumCallArgs + NumDeoptArgs <= (int)CS.arg_size(),
+ const int ExpectedNumArgs =
+ 5 + NumCallArgs + NumTransitionArgs + NumDeoptArgs;
+ Assert(ExpectedNumArgs <= (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
dyn_cast<PointerType>(ThisArgVecTy->getVectorElementType());
if (!ThisArgEltTy)
return true;
- return (!(ThisArgEltTy->getElementType() ==
- ReferenceType->getVectorElementType()));
+ return ThisArgEltTy->getElementType() !=
+ ReferenceType->getVectorElementType();
}
}
llvm_unreachable("unhandled");
Assert(AI, "llvm.gcroot parameter #1 must be an alloca.", &CI);
Assert(isa<Constant>(CI.getArgOperand(1)),
"llvm.gcroot parameter #2 must be a constant.", &CI);
- if (!AI->getType()->getElementType()->isPointerTy()) {
+ if (!AI->getAllocatedType()->isPointerTy()) {
Assert(!isa<ConstantPointerNull>(CI.getArgOperand(1)),
"llvm.gcroot parameter #1 must either be a pointer alloca, "
"or argument #2 must be a non-null constant.",
// Verify rest of the relocate arguments
GCRelocateOperands ops(&CI);
- ImmutableCallSite StatepointCS(ops.statepoint());
+ ImmutableCallSite StatepointCS(ops.getStatepoint());
// Both the base and derived must be piped through the safepoint
Value* Base = CI.getArgOperand(1);
Assert(StatepointCS.arg_size() > NumCallArgs+3,
"gc.statepoint: mismatch in number of call arguments");
Assert(isa<ConstantInt>(StatepointCS.getArgument(NumCallArgs+3)),
+ "gc.statepoint: number of transition arguments must be "
+ "a constant integer");
+ const int NumTransitionArgs =
+ cast<ConstantInt>(StatepointCS.getArgument(NumCallArgs + 3))->getZExtValue();
+ const int DeoptArgsStart = 2 + NumCallArgs + 1 + NumTransitionArgs + 1;
+ Assert(isa<ConstantInt>(StatepointCS.getArgument(DeoptArgsStart)),
"gc.statepoint: number of deoptimization arguments must be "
"a constant integer");
const int NumDeoptArgs =
- cast<ConstantInt>(StatepointCS.getArgument(NumCallArgs + 3))->getZExtValue();
- const int GCParamArgsStart = NumCallArgs + NumDeoptArgs + 4;
+ cast<ConstantInt>(StatepointCS.getArgument(DeoptArgsStart))->getZExtValue();
+ const int GCParamArgsStart = DeoptArgsStart + 1 + NumDeoptArgs;
const int GCParamArgsEnd = StatepointCS.arg_size();
Assert(GCParamArgsStart <= BaseIndex && BaseIndex < GCParamArgsEnd,
"gc.relocate: statepoint base index doesn't fall within the "
// Assert that the result type matches the type of the relocated pointer
GCRelocateOperands Operands(&CI);
- Assert(Operands.derivedPtr()->getType() == CI.getType(),
+ Assert(Operands.getDerivedPtr()->getType() == CI.getType(),
"gc.relocate: relocating a pointer shouldn't change its type", &CI);
break;
}