#include "llvm/Module.h"
#include "llvm/Type.h"
#include "llvm/CodeGen/IntrinsicLowering.h"
-#include "llvm/Support/IRBuilder.h"
#include "llvm/Support/ErrorHandling.h"
+#include "llvm/Support/IRBuilder.h"
+#include "llvm/Support/raw_ostream.h"
#include "llvm/Target/TargetData.h"
#include "llvm/ADT/SmallVector.h"
using namespace llvm;
break;
case Intrinsic::memcpy:
M.getOrInsertFunction("memcpy",
- PointerType::getUnqual(Type::getInt8Ty(Context)),
- PointerType::getUnqual(Type::getInt8Ty(Context)),
- PointerType::getUnqual(Type::getInt8Ty(Context)),
+ Type::getInt8PtrTy(Context),
+ Type::getInt8PtrTy(Context),
+ Type::getInt8PtrTy(Context),
TD.getIntPtrType(Context), (Type *)0);
break;
case Intrinsic::memmove:
M.getOrInsertFunction("memmove",
- PointerType::getUnqual(Type::getInt8Ty(Context)),
- PointerType::getUnqual(Type::getInt8Ty(Context)),
- PointerType::getUnqual(Type::getInt8Ty(Context)),
+ Type::getInt8PtrTy(Context),
+ Type::getInt8PtrTy(Context),
+ Type::getInt8PtrTy(Context),
TD.getIntPtrType(Context), (Type *)0);
break;
case Intrinsic::memset:
M.getOrInsertFunction("memset",
- PointerType::getUnqual(Type::getInt8Ty(Context)),
- PointerType::getUnqual(Type::getInt8Ty(Context)),
+ Type::getInt8PtrTy(Context),
+ Type::getInt8PtrTy(Context),
Type::getInt32Ty(M.getContext()),
TD.getIntPtrType(Context), (Type *)0);
break;
case Intrinsic::stacksave:
case Intrinsic::stackrestore: {
if (!Warned)
- cerr << "WARNING: this target does not support the llvm.stack"
- << (Callee->getIntrinsicID() == Intrinsic::stacksave ?
+ errs() << "WARNING: this target does not support the llvm.stack"
+ << (Callee->getIntrinsicID() == Intrinsic::stacksave ?
"save" : "restore") << " intrinsic.\n";
Warned = true;
if (Callee->getIntrinsicID() == Intrinsic::stacksave)
case Intrinsic::returnaddress:
case Intrinsic::frameaddress:
- cerr << "WARNING: this target does not support the llvm."
- << (Callee->getIntrinsicID() == Intrinsic::returnaddress ?
+ errs() << "WARNING: this target does not support the llvm."
+ << (Callee->getIntrinsicID() == Intrinsic::returnaddress ?
"return" : "frame") << "address intrinsic.\n";
CI->replaceAllUsesWith(ConstantPointerNull::get(
cast<PointerType>(CI->getType())));
case Intrinsic::pcmarker:
break; // Simply strip out pcmarker on unsupported architectures
case Intrinsic::readcyclecounter: {
- cerr << "WARNING: this target does not support the llvm.readcyclecoun"
- << "ter intrinsic. It is being lowered to a constant 0\n";
+ errs() << "WARNING: this target does not support the llvm.readcyclecoun"
+ << "ter intrinsic. It is being lowered to a constant 0\n";
CI->replaceAllUsesWith(ConstantInt::get(Type::getInt64Ty(Context), 0));
break;
}
break; // Simply strip out debugging intrinsics
case Intrinsic::eh_exception:
- case Intrinsic::eh_selector_i32:
- case Intrinsic::eh_selector_i64:
+ case Intrinsic::eh_selector:
CI->replaceAllUsesWith(Constant::getNullValue(CI->getType()));
break;
- case Intrinsic::eh_typeid_for_i32:
- case Intrinsic::eh_typeid_for_i64:
+ case Intrinsic::eh_typeid_for:
// Return something different to eh_selector.
CI->replaceAllUsesWith(ConstantInt::get(CI->getType(), 1));
break;
if (CI->getType() != Type::getVoidTy(Context))
CI->replaceAllUsesWith(ConstantInt::get(CI->getType(), 1));
break;
+ case Intrinsic::invariant_start:
+ case Intrinsic::lifetime_start:
+ // Discard region information.
+ CI->replaceAllUsesWith(UndefValue::get(CI->getType()));
+ break;
+ case Intrinsic::invariant_end:
+ case Intrinsic::lifetime_end:
+ // Discard region information.
+ break;
}
assert(CI->use_empty() &&