llvm.org GIT mirror llvm / 8910947
Teach TableGen Intrin Emitter to handle LLVMPointerType<llvm_any_ty> r363233 rewrote a bunch of the Intrin Emitter code, however the new function to update the arg codes did not properly consider a pointer to an any. This patch adds that logic. Differential Revision: https://reviews.llvm.org/D63507 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@364364 91177308-0d34-0410-b5e6-96231b3b80d8 Erich Keane a month ago
2 changed file(s) with 56 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
0 // RUN: llvm-tblgen -gen-intrinsic-impl %s | FileCheck %s
1
2 // This test is validating that it an Intrinsic with an LLVMPointerType to
3 // llvm_any_ty still properly work after r363233. That patch rewrote the
4 // substitution handling code in the Intrinsic Emitter, and didn't consider this
5 // case, so TableGen would hit an assertion in EncodeFixedType that was checking
6 // to ensure that the substitution being processed was correctly replaced.
7
8 class IntrinsicProperty;
9 class SDNodeProperty;
10
11 class ValueType {
12 string Namespace = "MVT";
13 int Size = size;
14 int Value = value;
15 }
16
17 def iPTR : ValueType<0 , 254>;
18 def Any : ValueType<0 , 255>;
19
20 class LLVMType {
21 ValueType VT = vt;
22 int isAny = 0;
23 }
24
25
26 class Intrinsic ret_types> {
27 string LLVMName = "";
28 string TargetPrefix = ""; // Set to a prefix for target-specific intrinsics.
29 list RetTypes = ret_types;
30 list ParamTypes = [];
31 list IntrProperties = [];
32 list Properties = [];
33 bit isTarget = 0;
34 }
35
36 class LLVMQualPointerType
37 : LLVMType{
38 LLVMType ElTy = elty;
39 int AddrSpace = 0;
40 }
41
42 class LLVMPointerType
43 : LLVMQualPointerType;
44
45 let isAny = 1 in {
46 def llvm_any_ty : LLVMType;
47 }
48 def i8 : ValueType<8, 3>;
49 def llvm_i8_ty : LLVMType;
50
51 def int_has_ptr_to_any : Intrinsic<[LLVMPointerType, llvm_i8_ty]>;
52 // CHECK: /* 0 */ 21, 14, 15, 0, 2, 0
371371 unsigned Tmp = 0;
372372 switch (getValueType(R->getValueAsDef("VT"))) {
373373 default: break;
374 case MVT::iPTR:
375 UpdateArgCodes(R->getValueAsDef("ElTy"), ArgCodes, NumInserted, Mapping);
376 break;
374377 case MVT::iPTRAny:
375378 ++Tmp;
376379 LLVM_FALLTHROUGH;