[llvm] ad52c9c - [IR] Deprecate some old methods for getting typed pointer types
Bjorn Pettersson via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 10 06:08:26 PDT 2023
Author: Bjorn Pettersson
Date: 2023-08-10T15:07:06+02:00
New Revision: ad52c9cabbf41fd488051f0fd430f9e92e60260e
URL: https://github.com/llvm/llvm-project/commit/ad52c9cabbf41fd488051f0fd430f9e92e60260e
DIFF: https://github.com/llvm/llvm-project/commit/ad52c9cabbf41fd488051f0fd430f9e92e60260e.diff
LOG: [IR] Deprecate some old methods for getting typed pointer types
The convenience methods that now are marked as deprecated are no
long used in-tree. The getInt8PtrTy helper is however still used in
many places, so it is not marked as deprecated to make it possible
to build LLVM with -Werror.
Differential Revision: https://reviews.llvm.org/D156741
Added:
Modified:
llvm/include/llvm/IR/Type.h
llvm/lib/IR/Type.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/IR/Type.h b/llvm/include/llvm/IR/Type.h
index fc558e6ee5db64..d9e1c34275e701 100644
--- a/llvm/include/llvm/IR/Type.h
+++ b/llvm/include/llvm/IR/Type.h
@@ -481,24 +481,69 @@ class Type {
static Type *getFloatingPointTy(LLVMContext &C, const fltSemantics &S);
//===--------------------------------------------------------------------===//
- // Convenience methods for getting pointer types with one of the above builtin
- // types as pointee.
+ // Convenience methods for getting pointer types.
//
- static PointerType *getHalfPtrTy(LLVMContext &C, unsigned AS = 0);
- static PointerType *getBFloatPtrTy(LLVMContext &C, unsigned AS = 0);
- static PointerType *getFloatPtrTy(LLVMContext &C, unsigned AS = 0);
- static PointerType *getDoublePtrTy(LLVMContext &C, unsigned AS = 0);
- static PointerType *getX86_FP80PtrTy(LLVMContext &C, unsigned AS = 0);
- static PointerType *getFP128PtrTy(LLVMContext &C, unsigned AS = 0);
- static PointerType *getPPC_FP128PtrTy(LLVMContext &C, unsigned AS = 0);
- static PointerType *getX86_MMXPtrTy(LLVMContext &C, unsigned AS = 0);
- static PointerType *getX86_AMXPtrTy(LLVMContext &C, unsigned AS = 0);
- static PointerType *getIntNPtrTy(LLVMContext &C, unsigned N, unsigned AS = 0);
- static PointerType *getInt1PtrTy(LLVMContext &C, unsigned AS = 0);
+
+ // TODO: After opaque pointer transition these can be replaced by simply
+ // calling PointerType::get(C, AS).
static PointerType *getInt8PtrTy(LLVMContext &C, unsigned AS = 0);
- static PointerType *getInt16PtrTy(LLVMContext &C, unsigned AS = 0);
- static PointerType *getInt32PtrTy(LLVMContext &C, unsigned AS = 0);
- static PointerType *getInt64PtrTy(LLVMContext &C, unsigned AS = 0);
+ [[deprecated("Pointers no longer have element types")]]
+ inline PointerType *getHalfPtrTy(LLVMContext &C, unsigned AS = 0) {
+ return getInt8PtrTy(C, AS);
+ }
+ [[deprecated("Pointers no longer have element types")]]
+ inline PointerType *getBFloatPtrTy(LLVMContext &C, unsigned AS = 0) {
+ return getInt8PtrTy(C, AS);
+ }
+ [[deprecated("Pointers no longer have element types")]]
+ inline PointerType *getFloatPtrTy(LLVMContext &C, unsigned AS = 0) {
+ return getInt8PtrTy(C, AS);
+ }
+ [[deprecated("Pointers no longer have element types")]]
+ inline PointerType *getDoublePtrTy(LLVMContext &C, unsigned AS = 0) {
+ return getInt8PtrTy(C, AS);
+ }
+ [[deprecated("Pointers no longer have element types")]]
+ inline PointerType *getX86_FP80PtrTy(LLVMContext &C, unsigned AS = 0) {
+ return getInt8PtrTy(C, AS);
+ }
+ [[deprecated("Pointers no longer have element types")]]
+ inline PointerType *getFP128PtrTy(LLVMContext &C, unsigned AS = 0) {
+ return getInt8PtrTy(C, AS);
+ }
+ [[deprecated("Pointers no longer have element types")]]
+ inline PointerType *getPPC_FP128PtrTy(LLVMContext &C, unsigned AS = 0) {
+ return getInt8PtrTy(C, AS);
+ }
+ [[deprecated("Pointers no longer have element types")]]
+ inline PointerType *getX86_MMXPtrTy(LLVMContext &C, unsigned AS = 0) {
+ return getInt8PtrTy(C, AS);
+ }
+ [[deprecated("Pointers no longer have element types")]]
+ inline PointerType *getX86_AMXPtrTy(LLVMContext &C, unsigned AS = 0) {
+ return getInt8PtrTy(C, AS);
+ }
+ [[deprecated("Pointers no longer have element types")]]
+ inline PointerType *getIntNPtrTy(LLVMContext &C, unsigned N, unsigned AS = 0) {
+ return getInt8PtrTy(C, AS);
+ }
+ [[deprecated("Pointers no longer have element types")]]
+ inline PointerType *getInt1PtrTy(LLVMContext &C, unsigned AS = 0) {
+ return getInt8PtrTy(C, AS);
+ }
+ [[deprecated("Pointers no longer have element types")]]
+ inline PointerType *getInt16PtrTy(LLVMContext &C, unsigned AS = 0) {
+ return getInt8PtrTy(C, AS);
+ }
+ [[deprecated("Pointers no longer have element types")]]
+ inline PointerType *getInt32PtrTy(LLVMContext &C, unsigned AS = 0) {
+ return getInt8PtrTy(C, AS);
+ }
+ [[deprecated("Pointers no longer have element types")]]
+ inline PointerType *getInt64PtrTy(LLVMContext &C, unsigned AS = 0) {
+ return getInt8PtrTy(C, AS);
+ }
+
static Type *getWasm_ExternrefTy(LLVMContext &C);
static Type *getWasm_FuncrefTy(LLVMContext &C);
diff --git a/llvm/lib/IR/Type.cpp b/llvm/lib/IR/Type.cpp
index ba4d0f5dc18db5..24d244fdccb37f 100644
--- a/llvm/lib/IR/Type.cpp
+++ b/llvm/lib/IR/Type.cpp
@@ -254,64 +254,8 @@ IntegerType *Type::getIntNTy(LLVMContext &C, unsigned N) {
return IntegerType::get(C, N);
}
-PointerType *Type::getHalfPtrTy(LLVMContext &C, unsigned AS) {
- return getHalfTy(C)->getPointerTo(AS);
-}
-
-PointerType *Type::getBFloatPtrTy(LLVMContext &C, unsigned AS) {
- return getBFloatTy(C)->getPointerTo(AS);
-}
-
-PointerType *Type::getFloatPtrTy(LLVMContext &C, unsigned AS) {
- return getFloatTy(C)->getPointerTo(AS);
-}
-
-PointerType *Type::getDoublePtrTy(LLVMContext &C, unsigned AS) {
- return getDoubleTy(C)->getPointerTo(AS);
-}
-
-PointerType *Type::getX86_FP80PtrTy(LLVMContext &C, unsigned AS) {
- return getX86_FP80Ty(C)->getPointerTo(AS);
-}
-
-PointerType *Type::getFP128PtrTy(LLVMContext &C, unsigned AS) {
- return getFP128Ty(C)->getPointerTo(AS);
-}
-
-PointerType *Type::getPPC_FP128PtrTy(LLVMContext &C, unsigned AS) {
- return getPPC_FP128Ty(C)->getPointerTo(AS);
-}
-
-PointerType *Type::getX86_MMXPtrTy(LLVMContext &C, unsigned AS) {
- return getX86_MMXTy(C)->getPointerTo(AS);
-}
-
-PointerType *Type::getX86_AMXPtrTy(LLVMContext &C, unsigned AS) {
- return getX86_AMXTy(C)->getPointerTo(AS);
-}
-
-PointerType *Type::getIntNPtrTy(LLVMContext &C, unsigned N, unsigned AS) {
- return getIntNTy(C, N)->getPointerTo(AS);
-}
-
-PointerType *Type::getInt1PtrTy(LLVMContext &C, unsigned AS) {
- return getInt1Ty(C)->getPointerTo(AS);
-}
-
PointerType *Type::getInt8PtrTy(LLVMContext &C, unsigned AS) {
- return getInt8Ty(C)->getPointerTo(AS);
-}
-
-PointerType *Type::getInt16PtrTy(LLVMContext &C, unsigned AS) {
- return getInt16Ty(C)->getPointerTo(AS);
-}
-
-PointerType *Type::getInt32PtrTy(LLVMContext &C, unsigned AS) {
- return getInt32Ty(C)->getPointerTo(AS);
-}
-
-PointerType *Type::getInt64PtrTy(LLVMContext &C, unsigned AS) {
- return getInt64Ty(C)->getPointerTo(AS);
+ return PointerType::get(C, AS);
}
Type *Type::getWasm_ExternrefTy(LLVMContext &C) {
More information about the llvm-commits
mailing list