Skip to content

Commit 3c853c8

Browse files
committed
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
1 parent 28cc956 commit 3c853c8

File tree

2 files changed

+18
-13
lines changed

2 files changed

+18
-13
lines changed

llvm/include/llvm/CodeGen/ValueTypes.td

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ class ValueType<int size, int value> {
1616
string Namespace = "MVT";
1717
int Size = size;
1818
int Value = value;
19+
int isOverloaded = false;
20+
}
21+
22+
class VTAny<int value> : ValueType<0, value> {
23+
let isOverloaded = true;
1924
}
2025

2126
def OtherVT : ValueType<0, 1>; // "Other" value
@@ -245,22 +250,22 @@ def MetadataVT : ValueType<0, 249>; // Metadata
245250

246251
// Pseudo valuetype mapped to the current pointer size to any address space.
247252
// Should only be used in TableGen.
248-
def iPTRAny : ValueType<0, 250>;
253+
def iPTRAny : VTAny<250>;
249254

250255
// Pseudo valuetype to represent "vector of any size"
251-
def vAny : ValueType<0, 251>;
256+
def vAny : VTAny<251>;
252257

253258
// Pseudo valuetype to represent "float of any format"
254-
def fAny : ValueType<0, 252>;
259+
def fAny : VTAny<252>;
255260

256261
// Pseudo valuetype to represent "integer of any bit width"
257-
def iAny : ValueType<0, 253>;
262+
def iAny : VTAny<253>;
258263

259264
// Pseudo valuetype mapped to the current pointer size.
260265
def iPTR : ValueType<0, 254>;
261266

262267
// Pseudo valuetype to represent "any type of any size".
263-
def Any : ValueType<0, 255>;
268+
def Any : VTAny<255>;
264269

265270
/// This class is for targets that want to use pointer types in patterns
266271
/// with the GlobalISelEmitter. Targets must define their own pointer

llvm/include/llvm/IR/Intrinsics.td

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ def ArgKind {
188188

189189
class LLVMType<ValueType vt> {
190190
ValueType VT = vt;
191-
int isAny = false;
191+
int isAny = vt.isOverloaded;
192192
}
193193

194194
class LLVMQualPointerType<LLVMType elty, int addrspace>
@@ -204,7 +204,7 @@ class LLVMAnyPointerType<LLVMType elty>
204204
: LLVMType<iPTRAny>{
205205
LLVMType ElTy = elty;
206206

207-
let isAny = true;
207+
assert isAny, "iPTRAny should have isOverloaded";
208208
}
209209

210210
// Match the type of another intrinsic parameter. Number is an index into the
@@ -254,12 +254,12 @@ class LLVMSubdivide4VectorType<int num> : LLVMMatchType<num>;
254254
class LLVMVectorOfBitcastsToInt<int num> : LLVMMatchType<num>;
255255

256256
def llvm_void_ty : LLVMType<isVoid>;
257-
let isAny = true in {
258-
def llvm_any_ty : LLVMType<Any>;
259-
def llvm_anyint_ty : LLVMType<iAny>;
260-
def llvm_anyfloat_ty : LLVMType<fAny>;
261-
def llvm_anyvector_ty : LLVMType<vAny>;
262-
}
257+
258+
def llvm_any_ty : LLVMType<Any>;
259+
def llvm_anyint_ty : LLVMType<iAny>;
260+
def llvm_anyfloat_ty : LLVMType<fAny>;
261+
def llvm_anyvector_ty : LLVMType<vAny>;
262+
263263
def llvm_i1_ty : LLVMType<i1>;
264264
def llvm_i8_ty : LLVMType<i8>;
265265
def llvm_i16_ty : LLVMType<i16>;

0 commit comments

Comments
 (0)