[llvm] 3c853c8 - ValueTypes.td: Introduce VTAny as `isOverloaded = true`
NAKAMURA Takumi via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 24 16:53:37 PDT 2023
Author: NAKAMURA Takumi
Date: 2023-04-25T08:53:17+09:00
New Revision: 3c853c845ad6ff1591f60a909fa3c7d293c27b49
URL: https://github.com/llvm/llvm-project/commit/3c853c845ad6ff1591f60a909fa3c7d293c27b49
DIFF: https://github.com/llvm/llvm-project/commit/3c853c845ad6ff1591f60a909fa3c7d293c27b49.diff
LOG: ValueTypes.td: Introduce VTAny as `isOverloaded = true`
`ValueType.isOverloaded` is used for;
- Define `iPTRAny`, `vAny`, `fAny`, and `Any`
- Reflect `ValueType.isOverloaded` to `LLVMType.isAny` in `Intrinsics.td`
- (Planninig) Reflect the condition to `MVT::isOverloaded()`
Part of D146179
Added:
Modified:
llvm/include/llvm/CodeGen/ValueTypes.td
llvm/include/llvm/IR/Intrinsics.td
Removed:
################################################################################
diff --git a/llvm/include/llvm/CodeGen/ValueTypes.td b/llvm/include/llvm/CodeGen/ValueTypes.td
index 336b2a49b131..7b683129ece9 100644
--- a/llvm/include/llvm/CodeGen/ValueTypes.td
+++ b/llvm/include/llvm/CodeGen/ValueTypes.td
@@ -16,6 +16,11 @@ class ValueType<int size, int value> {
string Namespace = "MVT";
int Size = size;
int Value = value;
+ int isOverloaded = false;
+}
+
+class VTAny<int value> : ValueType<0, value> {
+ let isOverloaded = true;
}
def OtherVT : ValueType<0, 1>; // "Other" value
@@ -245,22 +250,22 @@ def MetadataVT : ValueType<0, 249>; // Metadata
// Pseudo valuetype mapped to the current pointer size to any address space.
// Should only be used in TableGen.
-def iPTRAny : ValueType<0, 250>;
+def iPTRAny : VTAny<250>;
// Pseudo valuetype to represent "vector of any size"
-def vAny : ValueType<0, 251>;
+def vAny : VTAny<251>;
// Pseudo valuetype to represent "float of any format"
-def fAny : ValueType<0, 252>;
+def fAny : VTAny<252>;
// Pseudo valuetype to represent "integer of any bit width"
-def iAny : ValueType<0, 253>;
+def iAny : VTAny<253>;
// Pseudo valuetype mapped to the current pointer size.
def iPTR : ValueType<0, 254>;
// Pseudo valuetype to represent "any type of any size".
-def Any : ValueType<0, 255>;
+def Any : VTAny<255>;
/// This class is for targets that want to use pointer types in patterns
/// with the GlobalISelEmitter. Targets must define their own pointer
diff --git a/llvm/include/llvm/IR/Intrinsics.td b/llvm/include/llvm/IR/Intrinsics.td
index 2b9436d326b7..48372362fdbf 100644
--- a/llvm/include/llvm/IR/Intrinsics.td
+++ b/llvm/include/llvm/IR/Intrinsics.td
@@ -188,7 +188,7 @@ def ArgKind {
class LLVMType<ValueType vt> {
ValueType VT = vt;
- int isAny = false;
+ int isAny = vt.isOverloaded;
}
class LLVMQualPointerType<LLVMType elty, int addrspace>
@@ -204,7 +204,7 @@ class LLVMAnyPointerType<LLVMType elty>
: LLVMType<iPTRAny>{
LLVMType ElTy = elty;
- let isAny = true;
+ assert isAny, "iPTRAny should have isOverloaded";
}
// Match the type of another intrinsic parameter. Number is an index into the
@@ -254,12 +254,12 @@ class LLVMSubdivide4VectorType<int num> : LLVMMatchType<num>;
class LLVMVectorOfBitcastsToInt<int num> : LLVMMatchType<num>;
def llvm_void_ty : LLVMType<isVoid>;
-let isAny = true in {
- def llvm_any_ty : LLVMType<Any>;
- def llvm_anyint_ty : LLVMType<iAny>;
- def llvm_anyfloat_ty : LLVMType<fAny>;
- def llvm_anyvector_ty : LLVMType<vAny>;
-}
+
+def llvm_any_ty : LLVMType<Any>;
+def llvm_anyint_ty : LLVMType<iAny>;
+def llvm_anyfloat_ty : LLVMType<fAny>;
+def llvm_anyvector_ty : LLVMType<vAny>;
+
def llvm_i1_ty : LLVMType<i1>;
def llvm_i8_ty : LLVMType<i8>;
def llvm_i16_ty : LLVMType<i16>;
More information about the llvm-commits
mailing list