[PATCH] D63507: Teach TableGen Intrin Emitter to handle LLVMPointerType<llvm_any_ty>
Erich Keane via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 18 11:30:20 PDT 2019
erichkeane created this revision.
erichkeane added reviewers: sdesmalen, arsenm, RKSimon, greened.
Herald added a subscriber: wdng.
Herald added a project: LLVM.
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.
https://reviews.llvm.org/D63507
Files:
llvm/test/TableGen/intrinsic-pointer-to-any.td
llvm/utils/TableGen/IntrinsicEmitter.cpp
Index: llvm/utils/TableGen/IntrinsicEmitter.cpp
===================================================================
--- llvm/utils/TableGen/IntrinsicEmitter.cpp
+++ llvm/utils/TableGen/IntrinsicEmitter.cpp
@@ -372,6 +372,9 @@
unsigned Tmp = 0;
switch (getValueType(R->getValueAsDef("VT"))) {
default: break;
+ case MVT::iPTR:
+ UpdateArgCodes(R->getValueAsDef("ElTy"), ArgCodes, NumInserted, Mapping);
+ break;
case MVT::iPTRAny:
++Tmp;
LLVM_FALLTHROUGH;
Index: llvm/test/TableGen/intrinsic-pointer-to-any.td
===================================================================
--- /dev/null
+++ llvm/test/TableGen/intrinsic-pointer-to-any.td
@@ -0,0 +1,51 @@
+// RUN: llvm-tblgen -gen-intrinsic-impl %s | FileCheck %s
+
+class IntrinsicProperty;
+class SDNodeProperty;
+
+class ValueType<int size, int value> {
+ string Namespace = "MVT";
+ int Size = size;
+ int Value = value;
+}
+
+def iPTR : ValueType<0 , 254>;
+def Any : ValueType<0 , 255>;
+
+class LLVMType<ValueType vt> {
+ ValueType VT = vt;
+ int isAny = 0;
+}
+
+
+class Intrinsic<list<LLVMType> ret_types,
+ list<LLVMType> param_types = [],
+ list<IntrinsicProperty> intr_properties = [],
+ string name = ""> {
+ string LLVMName = name;
+ string TargetPrefix = ""; // Set to a prefix for target-specific intrinsics.
+ list<LLVMType> RetTypes = ret_types;
+ list<LLVMType> ParamTypes = param_types;
+ list<IntrinsicProperty> IntrProperties = intr_properties;
+ list<SDNodeProperty> Properties = [];
+
+ bit isTarget = 0;
+}
+
+class LLVMQualPointerType<LLVMType elty, int addrspace>
+ : LLVMType<iPTR>{
+ LLVMType ElTy = elty;
+ int AddrSpace = addrspace;
+}
+
+class LLVMPointerType<LLVMType elty>
+ : LLVMQualPointerType<elty, 0>;
+
+let isAny = 1 in {
+ def llvm_any_ty : LLVMType<Any>;
+}
+def i8 : ValueType<8, 3>;
+def llvm_i8_ty : LLVMType<i8>;
+
+def int_has_ptr_to_any : Intrinsic<[LLVMPointerType<llvm_any_ty>, llvm_i8_ty]>;
+// CHECK: /* 0 */ 21, 14, 15, 0, 2, 0
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D63507.205405.patch
Type: text/x-patch
Size: 2043 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190618/e496451c/attachment.bin>
More information about the llvm-commits
mailing list