diff options
author | Chris Lattner <sabre@nondot.org> | 2006-05-19 21:25:17 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2006-05-19 21:25:17 +0000 |
commit | 80105ddf5148711b8de8b7869a19649286482f16 (patch) | |
tree | bff1567698932251afb69feab8f45b84000b50be /lib/VMCore | |
parent | 91b18484ae2572afd57b6701c830065f620fbf55 (diff) | |
download | external_llvm-80105ddf5148711b8de8b7869a19649286482f16.zip external_llvm-80105ddf5148711b8de8b7869a19649286482f16.tar.gz external_llvm-80105ddf5148711b8de8b7869a19649286482f16.tar.bz2 |
csret functions can be varargs (as can target cc's). Verify restrictions on
csret functions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28405 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore')
-rw-r--r-- | lib/VMCore/Verifier.cpp | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/lib/VMCore/Verifier.cpp b/lib/VMCore/Verifier.cpp index 0814f69..8a4cf2c 100644 --- a/lib/VMCore/Verifier.cpp +++ b/lib/VMCore/Verifier.cpp @@ -302,9 +302,6 @@ void Verifier::verifySymbolTable(SymbolTable &ST) { // visitFunction - Verify that a function is ok. // void Verifier::visitFunction(Function &F) { - Assert1(!F.isVarArg() || F.getCallingConv() == CallingConv::C, - "Varargs functions must have C calling conventions!", &F); - // Check function arguments. const FunctionType *FT = F.getFunctionType(); unsigned NumArgs = F.getArgumentList().size(); @@ -316,6 +313,24 @@ void Verifier::visitFunction(Function &F) { F.getReturnType() == Type::VoidTy, "Functions cannot return aggregate values!", &F); + // Check that this function meets the restrictions on this calling convention. + switch (F.getCallingConv()) { + default: + break; + case CallingConv::C: + break; + case CallingConv::CSRet: + Assert1(FT->getReturnType() == Type::VoidTy && + FT->getNumParams() > 0 && isa<PointerType>(FT->getParamType(0)), + "Invalid struct-return function!", &F); + break; + case CallingConv::Fast: + case CallingConv::Cold: + Assert1(!F.isVarArg(), + "Varargs functions must have C calling conventions!", &F); + break; + } + // Check that the argument values match the function type for this function... unsigned i = 0; for (Function::arg_iterator I = F.arg_begin(), E = F.arg_end(); I != E; ++I, ++i) { |