Finish adding the llvm.readio and llvm.writeio intrinsics.
[oota-llvm.git] / lib / VMCore / Verifier.cpp
index f40ffe0a13bf0fc2bd8c1f93e0efa520bcf17ca5..fc237e69e5198a2cbb027a39ee93fccec6cd3c1b 100644 (file)
@@ -618,14 +618,36 @@ void Verifier::visitIntrinsicFunctionCall(Intrinsic::ID ID, CallInst &CI) {
     NumArgs = 2;
     break;
 
+  case Intrinsic::writeio:
+    Assert1(FT->getNumParams() == 2,
+            "Illegal # arguments for intrinsic function!", IF);
+    Assert1(FT->getParamType(0)->isFirstClassType(),
+            "First argument not a first class type!", IF);
+    Assert1(FT->getParamType(1)->getPrimitiveID() == Type::PointerTyID,
+            "Second argument not a pointer!", IF);
+    NumArgs = 2;
+    break;
+
   case Intrinsic::readport:
     Assert1(FT->getNumParams() == 1,
             "Illegal # arguments for intrinsic function!", IF);
+    Assert1(FT->getReturnType()->isFirstClassType(),
+            "Return type is not a first class type!", IF);
     Assert1(FT->getParamType(0)->isUnsigned(),
             "First argument not unsigned int!", IF);
     NumArgs = 1;
     break;
 
+  case Intrinsic:: readio:
+    Assert1(FT->getNumParams() == 1,
+            "Illegal # arguments for intrinsic function!", IF);
+    Assert1(FT->getReturnType()->isFirstClassType(),
+            "Return type is not a first class type!", IF);
+    Assert1(FT->getParamType(0)->getPrimitiveID() == Type::PointerTyID,
+            "First argument not a pointer!", IF);
+    NumArgs = 1;
+    break;
+
   case Intrinsic::setjmp:          NumArgs = 1; break;
   case Intrinsic::longjmp:         NumArgs = 2; break;
   case Intrinsic::sigsetjmp:       NumArgs = 2; break;