[llvm-commits] CVS: llvm/lib/VMCore/Verifier.cpp
Chris Lattner
lattner at cs.uiuc.edu
Fri May 19 14:25:29 PDT 2006
Changes in directory llvm/lib/VMCore:
Verifier.cpp updated: 1.155 -> 1.156
---
Log message:
csret functions can be varargs (as can target cc's). Verify restrictions on
csret functions.
---
Diffs of the changes: (+18 -3)
Verifier.cpp | 21 ++++++++++++++++++---
1 files changed, 18 insertions(+), 3 deletions(-)
Index: llvm/lib/VMCore/Verifier.cpp
diff -u llvm/lib/VMCore/Verifier.cpp:1.155 llvm/lib/VMCore/Verifier.cpp:1.156
--- llvm/lib/VMCore/Verifier.cpp:1.155 Sun May 14 13:34:36 2006
+++ llvm/lib/VMCore/Verifier.cpp Fri May 19 16:25:17 2006
@@ -302,9 +302,6 @@
// 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 @@
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) {
More information about the llvm-commits
mailing list