summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorPhilip Reames <listmail@philipreames.com>2014-12-04 00:01:48 +0000
committerPhilip Reames <listmail@philipreames.com>2014-12-04 00:01:48 +0000
commita7eb3cb46e83a6c275cd212c95497627e157aa98 (patch)
treeae78c6c492b9a443710e126cf66f1adf8490d91a /llvm/lib
parent12084a24750f1b10f9ffe93e5b7d0e14d76ab8c6 (diff)
downloadbcm5719-llvm-a7eb3cb46e83a6c275cd212c95497627e157aa98.tar.gz
bcm5719-llvm-a7eb3cb46e83a6c275cd212c95497627e157aa98.zip
A few more checks for gc.statepoints in the Verifier
This is simply a grab bag of unrelated checks: - A statepoint call can't be marked readonly or readnone - We don't currently support inline asm or varadic target functions. Both could be supported, but don't currently work. - I forgot to check that the number of call arguments actually matched the wrapped callee in my previous change. Included here. llvm-svn: 223322
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/IR/Verifier.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/llvm/lib/IR/Verifier.cpp b/llvm/lib/IR/Verifier.cpp
index d5b54f237d0..976786d047c 100644
--- a/llvm/lib/IR/Verifier.cpp
+++ b/llvm/lib/IR/Verifier.cpp
@@ -2562,12 +2562,21 @@ void Verifier::visitIntrinsicFunctionCall(Intrinsic::ID ID, CallInst &CI) {
break;
case Intrinsic::experimental_gc_statepoint: {
+ Assert1(!CI.doesNotAccessMemory() &&
+ !CI.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 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());
+ Assert1(!TargetFuncType->isVarArg(),
+ "gc.statepoint support for var arg functions not implemented", &CI);
const Value *NumCallArgsV = CI.getArgOperand(1);
Assert1(isa<ConstantInt>(NumCallArgsV),
@@ -2577,6 +2586,8 @@ void Verifier::visitIntrinsicFunctionCall(Intrinsic::ID ID, CallInst &CI) {
Assert1(NumCallArgs >= 0,
"gc.statepoint number of arguments to underlying call "
"must be positive", &CI);
+ Assert1(NumCallArgs == (int)TargetFuncType->getNumParams(),
+ "gc.statepoint mismatch in number of call args", &CI);
const Value *Unused = CI.getArgOperand(2);
Assert1(isa<ConstantInt>(Unused) &&
OpenPOWER on IntegriCloud