Skip to content

Commit 0aeaec3

Browse files
committed
llvm/test/TableGen/intrinsic-*.td: Use Intrinsics.td instead of mock
- `intrinsic-pointer-to-any.td` - `intrinsic-varargs.td` They used their own mock. I have introduced `TEST_INTRINSICS_SUPPRESS_DEFS` in `Intrinsics.td`. Tests of intrinsics may use it. Differential Revision: https://reviews.llvm.org/D146147
1 parent b688b58 commit 0aeaec3

File tree

3 files changed

+8
-72
lines changed

3 files changed

+8
-72
lines changed

llvm/include/llvm/IR/Intrinsics.td

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,7 @@ class MSBuiltin<string name> {
404404
string MSBuiltinName = name;
405405
}
406406

407+
#ifndef TEST_INTRINSICS_SUPPRESS_DEFS
407408

408409
//===--------------- Variable Argument Handling Intrinsics ----------------===//
409410
//
@@ -2203,3 +2204,5 @@ include "llvm/IR/IntrinsicsSPIRV.td"
22032204
include "llvm/IR/IntrinsicsVE.td"
22042205
include "llvm/IR/IntrinsicsDirectX.td"
22052206
include "llvm/IR/IntrinsicsLoongArch.td"
2207+
2208+
#endif // TEST_INTRINSICS_SUPPRESS_DEFS
Lines changed: 2 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,12 @@
1-
// RUN: llvm-tblgen -gen-intrinsic-impl %s | FileCheck %s
1+
// RUN: llvm-tblgen -gen-intrinsic-impl -I %p/../../include %s -DTEST_INTRINSICS_SUPPRESS_DEFS | FileCheck %s
22

33
// This test is validating that it an Intrinsic with an LLVMPointerType to
44
// llvm_any_ty still properly work after r363233. That patch rewrote the
55
// substitution handling code in the Intrinsic Emitter, and didn't consider this
66
// case, so TableGen would hit an assertion in EncodeFixedType that was checking
77
// to ensure that the substitution being processed was correctly replaced.
88

9-
class IntrinsicProperty<bit is_default = 0> {
10-
bit IsDefault = is_default;
11-
}
12-
13-
class SDNodeProperty;
14-
15-
class ValueType<int size, int value> {
16-
string Namespace = "MVT";
17-
int Size = size;
18-
int Value = value;
19-
}
20-
21-
def iPTR : ValueType<0 , 254>;
22-
def Any : ValueType<0 , 255>;
23-
24-
class LLVMType<ValueType vt> {
25-
ValueType VT = vt;
26-
int isAny = 0;
27-
}
28-
29-
30-
class Intrinsic<list<LLVMType> ret_types> {
31-
string LLVMName = "";
32-
string TargetPrefix = ""; // Set to a prefix for target-specific intrinsics.
33-
list<LLVMType> RetTypes = ret_types;
34-
list<LLVMType> ParamTypes = [];
35-
list<IntrinsicProperty> IntrProperties = [];
36-
list<SDNodeProperty> Properties = [];
37-
bit isTarget = 0;
38-
bit DisableDefaultAttributes = 1;
39-
}
40-
41-
class LLVMQualPointerType<LLVMType elty>
42-
: LLVMType<iPTR>{
43-
LLVMType ElTy = elty;
44-
int AddrSpace = 0;
45-
}
46-
47-
class LLVMPointerType<LLVMType elty>
48-
: LLVMQualPointerType<elty>;
49-
50-
let isAny = 1 in {
51-
def llvm_any_ty : LLVMType<Any>;
52-
}
53-
def i8 : ValueType<8, 5>;
54-
def llvm_i8_ty : LLVMType<i8>;
9+
include "llvm/IR/Intrinsics.td"
5510

5611
def int_has_ptr_to_any : Intrinsic<[LLVMPointerType<llvm_any_ty>, llvm_i8_ty]>;
5712
// CHECK: /* 0 */ 21, 14, 15, 0, 2, 0
Lines changed: 3 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,7 @@
1-
// RUN: llvm-tblgen -gen-intrinsic-impl -I %p/../../include %s | FileCheck %s
1+
// RUN: llvm-tblgen -gen-intrinsic-impl -I %p/../../include %s -DTEST_INTRINSICS_SUPPRESS_DEFS | FileCheck %s
22
// XFAIL: vg_leak
33

4-
include "llvm/CodeGen/ValueTypes.td"
5-
6-
class IntrinsicProperty<bit is_default = 0> {
7-
bit IsDefault = is_default;
8-
}
9-
class SDNodeProperty;
10-
11-
class LLVMType<ValueType vt> {
12-
ValueType VT = vt;
13-
}
14-
15-
class Intrinsic<string name, list<LLVMType> param_types = []> {
16-
string LLVMName = name;
17-
bit isTarget = 0;
18-
string TargetPrefix = "";
19-
list<LLVMType> RetTypes = [];
20-
list<LLVMType> ParamTypes = param_types;
21-
list<IntrinsicProperty> IntrProperties = [];
22-
list<SDNodeProperty> Properties = [];
23-
bit DisableDefaultAttributes = 1;
24-
}
25-
26-
def llvm_vararg_ty : LLVMType<isVoid>; // this means vararg here
4+
include "llvm/IR/Intrinsics.td"
275

286
// CHECK: /* 0 */ 0, 29, 0,
29-
def int_foo : Intrinsic<"llvm.foo", [llvm_vararg_ty]>;
7+
def int_foo : Intrinsic<[], [llvm_vararg_ty]>;

0 commit comments

Comments
 (0)