+ case Intrinsic::vaend: NumArgs = 1; break;
+ case Intrinsic::vacopy: NumArgs = 2; break;
+
+ case Intrinsic::returnaddress:
+ case Intrinsic::frameaddress:
+ Assert1(isa<PointerType>(FT->getReturnType()),
+ "llvm.(frame|return)address must return pointers", IF);
+ Assert1(FT->getNumParams() == 1 && isa<ConstantInt>(CI.getOperand(1)),
+ "llvm.(frame|return)address require a single constant integer argument",
+ &CI);
+ NumArgs = 1;
+ break;
+
+ // Verify that read and write port have integral parameters of the correct
+ // signed-ness.
+ case Intrinsic::writeport:
+ Assert1(FT->getNumParams() == 2,
+ "Illegal # arguments for intrinsic function!", IF);
+ Assert1(FT->getParamType(0)->isIntegral(),
+ "First argument not unsigned int!", IF);
+ Assert1(FT->getParamType(1)->isUnsigned(),
+ "First argument not unsigned int!", IF);
+ 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(isa<PointerType>(FT->getParamType(1)),
+ "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: {
+ const PointerType *ParamType = dyn_cast<PointerType>(FT->getParamType(0));
+ const Type *ReturnType = FT->getReturnType();
+
+ Assert1(FT->getNumParams() == 1,
+ "Illegal # arguments for intrinsic function!", IF);
+ Assert1(ParamType, "First argument not a pointer!", IF);
+ Assert1(ParamType->getElementType() == ReturnType,
+ "Pointer type doesn't match return type!", IF);
+ NumArgs = 1;
+ break;
+ }
+
+ case Intrinsic::isunordered_f32:
+ Assert1(FT->getNumParams() == 2,
+ "Illegal # arguments for intrinsic function!", IF);
+ Assert1(FT->getReturnType() == Type::BoolTy,
+ "Return type is not bool!", IF);
+ Assert1(FT->getParamType(0) == FT->getParamType(1),
+ "Arguments must be of the same type!", IF);
+ Assert1(FT->getParamType(0) == Type::FloatTy,
+ "Arguments must be a 32-bit floating point type!", IF);
+ NumArgs = 2;
+ break;
+
+ case Intrinsic::isunordered_f64:
+ Assert1(FT->getNumParams() == 2,
+ "Illegal # arguments for intrinsic function!", IF);
+ Assert1(FT->getReturnType() == Type::BoolTy,
+ "Return type is not bool!", IF);
+ Assert1(FT->getParamType(0) == FT->getParamType(1),
+ "Arguments must be of the same type!", IF);
+ Assert1(FT->getParamType(0) == Type::DoubleTy,
+ "Argument is not a 64-bit floating point type!", IF);
+ NumArgs = 2;
+ break;
+
+ case Intrinsic::readcyclecounter:
+ Assert1(FT->getNumParams() == 0,
+ "Illegal # arguments for intrinsic function!", IF);
+ Assert1(FT->getReturnType() == Type::ULongTy,
+ "Return type is not ulong!", IF);
+ NumArgs = 0;
+ break;
+
+ case Intrinsic::bswap_i16:
+ Assert1(FT->getNumParams() == 1,
+ "Illegal # arguments for intrinsic function!", IF);
+ Assert1(FT->getReturnType() == FT->getParamType(0),
+ "Return type does not match source type", IF);
+ Assert1(FT->getReturnType() == Type::UShortTy,
+ "Return type is not ushort!", IF);
+ NumArgs = 1;
+ break;
+
+ case Intrinsic::bswap_i32:
+ Assert1(FT->getNumParams() == 1,
+ "Illegal # arguments for intrinsic function!", IF);
+ Assert1(FT->getReturnType() == FT->getParamType(0),
+ "Return type does not match source type", IF);
+ Assert1(FT->getReturnType() == Type::UIntTy,
+ "Return type is not uint!", IF);
+ NumArgs = 1;
+ break;
+
+ case Intrinsic::bswap_i64:
+ Assert1(FT->getNumParams() == 1,
+ "Illegal # arguments for intrinsic function!", IF);
+ Assert1(FT->getReturnType() == FT->getParamType(0),
+ "Return type does not match source type", IF);
+ Assert1(FT->getReturnType() == Type::ULongTy,
+ "Return type is not ulong!", IF);
+ NumArgs = 1;
+ break;
+
+ case Intrinsic::ctpop_i8:
+ Assert1(FT->getNumParams() == 1,
+ "Illegal # arguments for intrinsic function!", IF);
+ Assert1(FT->getReturnType() == FT->getParamType(0),
+ "Return type does not match source type", IF);
+ Assert1(FT->getParamType(0) == Type::UByteTy,
+ "Argument is not ubyte!", IF);
+ NumArgs = 1;
+ break;
+
+ case Intrinsic::ctpop_i16:
+ Assert1(FT->getNumParams() == 1,
+ "Illegal # arguments for intrinsic function!", IF);
+ Assert1(FT->getReturnType() == FT->getParamType(0),
+ "Return type does not match source type", IF);
+ Assert1(FT->getParamType(0) == Type::UShortTy,
+ "Argument is not ushort!", IF);
+ NumArgs = 1;
+ break;
+
+ case Intrinsic::ctpop_i32:
+ Assert1(FT->getNumParams() == 1,
+ "Illegal # arguments for intrinsic function!", IF);
+ Assert1(FT->getReturnType() == FT->getParamType(0),
+ "Return type does not match source type", IF);
+ Assert1(FT->getParamType(0) == Type::UIntTy, "Argument is not uint!", IF);
+ NumArgs = 1;
+ break;
+
+ case Intrinsic::ctpop_i64:
+ Assert1(FT->getNumParams() == 1,
+ "Illegal # arguments for intrinsic function!", IF);
+ Assert1(FT->getReturnType() == FT->getParamType(0),
+ "Return type does not match source type", IF);
+ Assert1(FT->getParamType(0) == Type::ULongTy, "Argument is not ulong!", IF);
+ NumArgs = 1;
+ break;
+
+ case Intrinsic::ctlz_i8:
+ Assert1(FT->getNumParams() == 1,
+ "Illegal # arguments for intrinsic function!", IF);
+ Assert1(FT->getReturnType() == FT->getParamType(0),
+ "Return type does not match source type", IF);
+ Assert1(FT->getParamType(0) == Type::UByteTy, "Argument is not ubyte!", IF);
+ NumArgs = 1;
+ break;
+
+ case Intrinsic::ctlz_i16:
+ Assert1(FT->getNumParams() == 1,
+ "Illegal # arguments for intrinsic function!", IF);
+ Assert1(FT->getReturnType() == FT->getParamType(0),
+ "Return type does not match source type", IF);
+ Assert1(FT->getParamType(0) == Type::UShortTy,
+ "Argument is not ushort!", IF);
+ NumArgs = 1;
+ break;
+ case Intrinsic::ctlz_i32:
+ Assert1(FT->getNumParams() == 1,
+ "Illegal # arguments for intrinsic function!", IF);
+ Assert1(FT->getReturnType() == FT->getParamType(0),
+ "Return type does not match source type", IF);
+ Assert1(FT->getParamType(0) == Type::UIntTy, "Argument is not uint!", IF);
+ NumArgs = 1;
+ break;
+ case Intrinsic::ctlz_i64:
+ Assert1(FT->getNumParams() == 1,
+ "Illegal # arguments for intrinsic function!", IF);
+ Assert1(FT->getReturnType() == FT->getParamType(0),
+ "Return type does not match source type", IF);
+ Assert1(FT->getParamType(0) == Type::ULongTy, "Argument is not ulong!", IF);
+ NumArgs = 1;
+ break;
+ case Intrinsic::cttz_i8:
+ Assert1(FT->getNumParams() == 1,
+ "Illegal # arguments for intrinsic function!", IF);
+ Assert1(FT->getReturnType() == FT->getParamType(0),
+ "Return type does not match source type", IF);
+ Assert1(FT->getParamType(0) == Type::UByteTy, "Argument is not ubyte!", IF);
+ NumArgs = 1;
+ break;
+ case Intrinsic::cttz_i16:
+ Assert1(FT->getNumParams() == 1,
+ "Illegal # arguments for intrinsic function!", IF);
+ Assert1(FT->getReturnType() == FT->getParamType(0),
+ "Return type does not match source type", IF);
+ Assert1(FT->getParamType(0) == Type::UShortTy,
+ "Argument is not ushort!", IF);
+ NumArgs = 1;
+ break;
+ case Intrinsic::cttz_i32:
+ Assert1(FT->getNumParams() == 1,
+ "Illegal # arguments for intrinsic function!", IF);
+ Assert1(FT->getReturnType() == FT->getParamType(0),
+ "Return type does not match source type", IF);
+ Assert1(FT->getParamType(0) == Type::UIntTy, "Argument is not uint!", IF);
+ NumArgs = 1;
+ break;
+ case Intrinsic::cttz_i64:
+ Assert1(FT->getNumParams() == 1,
+ "Illegal # arguments for intrinsic function!", IF);
+ Assert1(FT->getReturnType() == FT->getParamType(0),
+ "Return type does not match source type", IF);
+ Assert1(FT->getParamType(0) == Type::ULongTy, "Argument Is not ulong!", IF);
+ NumArgs = 1;
+ break;
+
+ case Intrinsic::sqrt_f32:
+ Assert1(FT->getNumParams() == 1,
+ "Illegal # arguments for intrinsic function!", IF);
+ Assert1(FT->getParamType(0) == Type::FloatTy,
+ "Argument is not a 32-bit floating point type!", IF);
+ Assert1(FT->getReturnType() == FT->getParamType(0),
+ "Return type is not the same as argument type!", IF);
+ NumArgs = 1;
+ break;
+
+ case Intrinsic::sqrt_f64:
+ Assert1(FT->getNumParams() == 1,
+ "Illegal # arguments for intrinsic function!", IF);
+ Assert1(FT->getParamType(0) == Type::DoubleTy,
+ "Argument is not a 64-bit floating point type!", IF);
+ Assert1(FT->getReturnType() == FT->getParamType(0),
+ "Return type is not the same as argument type!", IF);
+ NumArgs = 1;
+ break;
+
+ case Intrinsic::setjmp: NumArgs = 1; break;
+ case Intrinsic::longjmp: NumArgs = 2; break;
+ case Intrinsic::sigsetjmp: NumArgs = 2; break;
+ case Intrinsic::siglongjmp: NumArgs = 2; break;
+
+ case Intrinsic::gcroot:
+ Assert1(FT->getNumParams() == 2,
+ "Illegal # arguments for intrinsic function!", IF);
+ Assert1(isa<Constant>(CI.getOperand(2)),
+ "Second argument to llvm.gcroot must be a constant!", &CI);
+ NumArgs = 2;
+ break;
+ case Intrinsic::gcread: NumArgs = 2; break;
+ case Intrinsic::gcwrite: NumArgs = 3; break;
+
+ case Intrinsic::dbg_stoppoint: NumArgs = 4; break;
+ case Intrinsic::dbg_region_start:NumArgs = 1; break;
+ case Intrinsic::dbg_region_end: NumArgs = 1; break;
+ case Intrinsic::dbg_func_start: NumArgs = 1; break;
+ case Intrinsic::dbg_declare: NumArgs = 1; break;
+
+ case Intrinsic::memcpy: NumArgs = 4; break;
+ case Intrinsic::memmove: NumArgs = 4; break;
+ case Intrinsic::memset: NumArgs = 4; break;
+
+ case Intrinsic::stacksave:
+ NumArgs = 0;
+ Assert1(CI.getType() == PointerType::get(Type::SByteTy),
+ "llvm.stacksave must return an sbyte*", &CI);
+ break;
+ case Intrinsic::stackrestore:
+ NumArgs = 1;
+ Assert1(CI.getOperand(1)->getType() == PointerType::get(Type::SByteTy),
+ "llvm.stackrestore must take an sbyte*", &CI);
+ Assert1(CI.getType() == Type::VoidTy,
+ "llvm.stackrestore return void", &CI);
+ break;
+ case Intrinsic::prefetch: NumArgs = 3; break;
+ case Intrinsic::pcmarker:
+ NumArgs = 1;
+ Assert1(isa<Constant>(CI.getOperand(1)),
+ "First argument to llvm.pcmarker must be a constant!", &CI);
+ break;
+
+ case Intrinsic::not_intrinsic: