+static void EnsureFPIntrinsicsExist(Module &M, Module::iterator I,
+ const char *FName,
+ const char *DName, const char *LDName) {
+ // Insert definitions for all the floating point types.
+ switch((int)I->arg_begin()->getType()->getTypeID()) {
+ case Type::FloatTyID:
+ EnsureFunctionExists(M, FName, I->arg_begin(), I->arg_end(),
+ Type::FloatTy);
+ case Type::DoubleTyID:
+ EnsureFunctionExists(M, DName, I->arg_begin(), I->arg_end(),
+ Type::DoubleTy);
+ case Type::X86_FP80TyID:
+ case Type::FP128TyID:
+ case Type::PPC_FP128TyID:
+ EnsureFunctionExists(M, LDName, I->arg_begin(), I->arg_end(),
+ I->arg_begin()->getType());
+ }
+}
+