aboutsummaryrefslogtreecommitdiff
path: root/clang
diff options
context:
space:
mode:
Diffstat (limited to 'clang')
-rw-r--r--clang/lib/CodeGen/CGGPUBuiltin.cpp13
-rw-r--r--clang/lib/CodeGen/CodeGenTypes.cpp2
-rw-r--r--clang/lib/CodeGen/CoverageMappingGen.cpp2
-rw-r--r--clang/tools/clang-linker-wrapper/OffloadWrapper.cpp53
4 files changed, 36 insertions, 34 deletions
diff --git a/clang/lib/CodeGen/CGGPUBuiltin.cpp b/clang/lib/CodeGen/CGGPUBuiltin.cpp
index 75fb06d..de4ee68 100644
--- a/clang/lib/CodeGen/CGGPUBuiltin.cpp
+++ b/clang/lib/CodeGen/CGGPUBuiltin.cpp
@@ -23,8 +23,8 @@ using namespace CodeGen;
namespace {
llvm::Function *GetVprintfDeclaration(llvm::Module &M) {
- llvm::Type *ArgTypes[] = {llvm::Type::getInt8PtrTy(M.getContext()),
- llvm::Type::getInt8PtrTy(M.getContext())};
+ llvm::Type *ArgTypes[] = {llvm::PointerType::getUnqual(M.getContext()),
+ llvm::PointerType::getUnqual(M.getContext())};
llvm::FunctionType *VprintfFuncType = llvm::FunctionType::get(
llvm::Type::getInt32Ty(M.getContext()), ArgTypes, false);
@@ -45,8 +45,8 @@ llvm::Function *GetVprintfDeclaration(llvm::Module &M) {
llvm::Function *GetOpenMPVprintfDeclaration(CodeGenModule &CGM) {
const char *Name = "__llvm_omp_vprintf";
llvm::Module &M = CGM.getModule();
- llvm::Type *ArgTypes[] = {llvm::Type::getInt8PtrTy(M.getContext()),
- llvm::Type::getInt8PtrTy(M.getContext()),
+ llvm::Type *ArgTypes[] = {llvm::PointerType::getUnqual(M.getContext()),
+ llvm::PointerType::getUnqual(M.getContext()),
llvm::Type::getInt32Ty(M.getContext())};
llvm::FunctionType *VprintfFuncType = llvm::FunctionType::get(
llvm::Type::getInt32Ty(M.getContext()), ArgTypes, false);
@@ -99,7 +99,8 @@ packArgsIntoNVPTXFormatBuffer(CodeGenFunction *CGF, const CallArgList &Args) {
// Construct and fill the args buffer that we'll pass to vprintf.
if (Args.size() <= 1) {
// If there are no args, pass a null pointer and size 0
- llvm::Value * BufferPtr = llvm::ConstantPointerNull::get(llvm::Type::getInt8PtrTy(Ctx));
+ llvm::Value *BufferPtr =
+ llvm::ConstantPointerNull::get(llvm::PointerType::getUnqual(Ctx));
return {BufferPtr, llvm::TypeSize::Fixed(0)};
} else {
llvm::SmallVector<llvm::Type *, 8> ArgTypes;
@@ -120,7 +121,7 @@ packArgsIntoNVPTXFormatBuffer(CodeGenFunction *CGF, const CallArgList &Args) {
Builder.CreateAlignedStore(Arg, P, DL.getPrefTypeAlign(Arg->getType()));
}
llvm::Value *BufferPtr =
- Builder.CreatePointerCast(Alloca, llvm::Type::getInt8PtrTy(Ctx));
+ Builder.CreatePointerCast(Alloca, llvm::PointerType::getUnqual(Ctx));
return {BufferPtr, DL.getTypeAllocSize(AllocaTy)};
}
}
diff --git a/clang/lib/CodeGen/CodeGenTypes.cpp b/clang/lib/CodeGen/CodeGenTypes.cpp
index 29f4f51..a6b51bf 100644
--- a/clang/lib/CodeGen/CodeGenTypes.cpp
+++ b/clang/lib/CodeGen/CodeGenTypes.cpp
@@ -422,7 +422,7 @@ llvm::Type *CodeGenTypes::ConvertType(QualType T) {
case BuiltinType::NullPtr:
// Model std::nullptr_t as i8*
- ResultType = llvm::Type::getInt8PtrTy(getLLVMContext());
+ ResultType = llvm::PointerType::getUnqual(getLLVMContext());
break;
case BuiltinType::UInt128:
diff --git a/clang/lib/CodeGen/CoverageMappingGen.cpp b/clang/lib/CodeGen/CoverageMappingGen.cpp
index d77aa4d..b16358e 100644
--- a/clang/lib/CodeGen/CoverageMappingGen.cpp
+++ b/clang/lib/CodeGen/CoverageMappingGen.cpp
@@ -1820,7 +1820,7 @@ void CoverageMappingModuleGen::emit() {
CGM.addUsedGlobal(CovData);
// Create the deferred function records array
if (!FunctionNames.empty()) {
- auto NamesArrTy = llvm::ArrayType::get(llvm::Type::getInt8PtrTy(Ctx),
+ auto NamesArrTy = llvm::ArrayType::get(llvm::PointerType::getUnqual(Ctx),
FunctionNames.size());
auto NamesArrVal = llvm::ConstantArray::get(NamesArrTy, FunctionNames);
// This variable will *NOT* be emitted to the object file. It is used
diff --git a/clang/tools/clang-linker-wrapper/OffloadWrapper.cpp b/clang/tools/clang-linker-wrapper/OffloadWrapper.cpp
index e562c20..64f7044 100644
--- a/clang/tools/clang-linker-wrapper/OffloadWrapper.cpp
+++ b/clang/tools/clang-linker-wrapper/OffloadWrapper.cpp
@@ -40,7 +40,7 @@ enum OffloadEntryKindFlag : uint32_t {
IntegerType *getSizeTTy(Module &M) {
LLVMContext &C = M.getContext();
- switch (M.getDataLayout().getPointerTypeSize(Type::getInt8PtrTy(C))) {
+ switch (M.getDataLayout().getPointerTypeSize(PointerType::getUnqual(C))) {
case 4u:
return Type::getInt32Ty(C);
case 8u:
@@ -60,9 +60,10 @@ StructType *getEntryTy(Module &M) {
LLVMContext &C = M.getContext();
StructType *EntryTy = StructType::getTypeByName(C, "__tgt_offload_entry");
if (!EntryTy)
- EntryTy = StructType::create("__tgt_offload_entry", Type::getInt8PtrTy(C),
- Type::getInt8PtrTy(C), getSizeTTy(M),
- Type::getInt32Ty(C), Type::getInt32Ty(C));
+ EntryTy =
+ StructType::create("__tgt_offload_entry", PointerType::getUnqual(C),
+ PointerType::getUnqual(C), getSizeTTy(M),
+ Type::getInt32Ty(C), Type::getInt32Ty(C));
return EntryTy;
}
@@ -80,9 +81,9 @@ StructType *getDeviceImageTy(Module &M) {
LLVMContext &C = M.getContext();
StructType *ImageTy = StructType::getTypeByName(C, "__tgt_device_image");
if (!ImageTy)
- ImageTy = StructType::create("__tgt_device_image", Type::getInt8PtrTy(C),
- Type::getInt8PtrTy(C), getEntryPtrTy(M),
- getEntryPtrTy(M));
+ ImageTy = StructType::create(
+ "__tgt_device_image", PointerType::getUnqual(C),
+ PointerType::getUnqual(C), getEntryPtrTy(M), getEntryPtrTy(M));
return ImageTy;
}
@@ -284,9 +285,9 @@ StructType *getFatbinWrapperTy(Module &M) {
LLVMContext &C = M.getContext();
StructType *FatbinTy = StructType::getTypeByName(C, "fatbin_wrapper");
if (!FatbinTy)
- FatbinTy = StructType::create("fatbin_wrapper", Type::getInt32Ty(C),
- Type::getInt32Ty(C), Type::getInt8PtrTy(C),
- Type::getInt8PtrTy(C));
+ FatbinTy = StructType::create(
+ "fatbin_wrapper", Type::getInt32Ty(C), Type::getInt32Ty(C),
+ PointerType::getUnqual(C), PointerType::getUnqual(C));
return FatbinTy;
}
@@ -294,7 +295,7 @@ StructType *getFatbinWrapperTy(Module &M) {
/// runtime.
GlobalVariable *createFatbinDesc(Module &M, ArrayRef<char> Image, bool IsHIP) {
LLVMContext &C = M.getContext();
- llvm::Type *Int8PtrTy = Type::getInt8PtrTy(C);
+ llvm::Type *Int8PtrTy = PointerType::getUnqual(C);
llvm::Triple Triple = llvm::Triple(M.getTargetTriple());
// Create the global string containing the fatbinary.
@@ -315,7 +316,7 @@ GlobalVariable *createFatbinDesc(Module &M, ArrayRef<char> Image, bool IsHIP) {
ConstantInt::get(Type::getInt32Ty(C), IsHIP ? HIPFatMagic : CudaFatMagic),
ConstantInt::get(Type::getInt32Ty(C), 1),
ConstantExpr::getPointerBitCastOrAddrSpaceCast(Fatbin, Int8PtrTy),
- ConstantPointerNull::get(Type::getInt8PtrTy(C))};
+ ConstantPointerNull::get(PointerType::getUnqual(C))};
Constant *FatbinInitializer =
ConstantStruct::get(getFatbinWrapperTy(M), FatbinWrapper);
@@ -529,21 +530,21 @@ void createRegisterFatbinFunction(Module &M, GlobalVariable *FatbinDesc,
DtorFunc->setSection(".text.startup");
// Get the __cudaRegisterFatBinary function declaration.
- auto *RegFatTy = FunctionType::get(Type::getInt8PtrTy(C)->getPointerTo(),
- Type::getInt8PtrTy(C),
+ auto *RegFatTy = FunctionType::get(PointerType::getUnqual(C)->getPointerTo(),
+ PointerType::getUnqual(C),
/*isVarArg*/ false);
FunctionCallee RegFatbin = M.getOrInsertFunction(
IsHIP ? "__hipRegisterFatBinary" : "__cudaRegisterFatBinary", RegFatTy);
// Get the __cudaRegisterFatBinaryEnd function declaration.
- auto *RegFatEndTy = FunctionType::get(Type::getVoidTy(C),
- Type::getInt8PtrTy(C)->getPointerTo(),
- /*isVarArg*/ false);
+ auto *RegFatEndTy = FunctionType::get(
+ Type::getVoidTy(C), PointerType::getUnqual(C)->getPointerTo(),
+ /*isVarArg*/ false);
FunctionCallee RegFatbinEnd =
M.getOrInsertFunction("__cudaRegisterFatBinaryEnd", RegFatEndTy);
// Get the __cudaUnregisterFatBinary function declaration.
- auto *UnregFatTy = FunctionType::get(Type::getVoidTy(C),
- Type::getInt8PtrTy(C)->getPointerTo(),
- /*isVarArg*/ false);
+ auto *UnregFatTy = FunctionType::get(
+ Type::getVoidTy(C), PointerType::getUnqual(C)->getPointerTo(),
+ /*isVarArg*/ false);
FunctionCallee UnregFatbin = M.getOrInsertFunction(
IsHIP ? "__hipUnregisterFatBinary" : "__cudaUnregisterFatBinary",
UnregFatTy);
@@ -554,19 +555,19 @@ void createRegisterFatbinFunction(Module &M, GlobalVariable *FatbinDesc,
FunctionCallee AtExit = M.getOrInsertFunction("atexit", AtExitTy);
auto *BinaryHandleGlobal = new llvm::GlobalVariable(
- M, Type::getInt8PtrTy(C)->getPointerTo(), false,
+ M, PointerType::getUnqual(C)->getPointerTo(), false,
llvm::GlobalValue::InternalLinkage,
- llvm::ConstantPointerNull::get(Type::getInt8PtrTy(C)->getPointerTo()),
+ llvm::ConstantPointerNull::get(PointerType::getUnqual(C)->getPointerTo()),
IsHIP ? ".hip.binary_handle" : ".cuda.binary_handle");
// Create the constructor to register this image with the runtime.
IRBuilder<> CtorBuilder(BasicBlock::Create(C, "entry", CtorFunc));
CallInst *Handle = CtorBuilder.CreateCall(
RegFatbin, ConstantExpr::getPointerBitCastOrAddrSpaceCast(
- FatbinDesc, Type::getInt8PtrTy(C)));
+ FatbinDesc, PointerType::getUnqual(C)));
CtorBuilder.CreateAlignedStore(
Handle, BinaryHandleGlobal,
- Align(M.getDataLayout().getPointerTypeSize(Type::getInt8PtrTy(C))));
+ Align(M.getDataLayout().getPointerTypeSize(PointerType::getUnqual(C))));
CtorBuilder.CreateCall(createRegisterGlobalsFunction(M, IsHIP), Handle);
if (!IsHIP)
CtorBuilder.CreateCall(RegFatbinEnd, Handle);
@@ -578,8 +579,8 @@ void createRegisterFatbinFunction(Module &M, GlobalVariable *FatbinDesc,
// `atexit()` intead.
IRBuilder<> DtorBuilder(BasicBlock::Create(C, "entry", DtorFunc));
LoadInst *BinaryHandle = DtorBuilder.CreateAlignedLoad(
- Type::getInt8PtrTy(C)->getPointerTo(), BinaryHandleGlobal,
- Align(M.getDataLayout().getPointerTypeSize(Type::getInt8PtrTy(C))));
+ PointerType::getUnqual(C)->getPointerTo(), BinaryHandleGlobal,
+ Align(M.getDataLayout().getPointerTypeSize(PointerType::getUnqual(C))));
DtorBuilder.CreateCall(UnregFatbin, BinaryHandle);
DtorBuilder.CreateRetVoid();