llvm.org GIT mirror llvm / df50f41
[TABLEGEN] Do not crash on intrinsics with names longer than 40 characters Differential Revision: http://reviews.llvm.org/D4537 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@213253 91177308-0d34-0410-b5e6-96231b3b80d8 Justin Holewinski 5 years ago
2 changed file(s) with 35 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
0 // RUN: llvm-tblgen -gen-intrinsic %s | FileCheck %s
1 // XFAIL: vg_leak
2
3 class IntrinsicProperty;
4
5 class ValueType {
6 string Namespace = "MVT";
7 int Size = size;
8 int Value = value;
9 }
10
11 class LLVMType {
12 ValueType VT = vt;
13 }
14
15 class Intrinsic param_types = []> {
16 string LLVMName = name;
17 bit isTarget = 0;
18 string TargetPrefix = "";
19 list RetTypes = [];
20 list ParamTypes = param_types;
21 list Properties = [];
22 }
23
24 def iAny : ValueType<0, 254>;
25 def llvm_anyint_ty : LLVMType;
26
27 // Make sure we generate the long name without crashing
28 // CHECK: this_is_a_really_long_intrinsic_name_but_we_should_still_not_crash // llvm.this.is.a.really.long.intrinsic.name.but.we.should.still.not.crash
29 def int_foo : Intrinsic<"llvm.foo", [llvm_anyint_ty]>;
30 def int_this_is_a_really_long_intrinsic_name_but_we_should_still_not_crash : Intrinsic<"llvm.this.is.a.really.long.intrinsic.name.but.we.should.still.not.crash", [llvm_anyint_ty]>;
31
128128 for (unsigned i = 0, e = Ints.size(); i != e; ++i) {
129129 OS << " " << Ints[i].EnumName;
130130 OS << ((i != e-1) ? ", " : " ");
131 OS << std::string(40-Ints[i].EnumName.size(), ' ')
132 << "// " << Ints[i].Name << "\n";
131 if (Ints[i].EnumName.size() < 40)
132 OS << std::string(40-Ints[i].EnumName.size(), ' ');
133 OS << " // " << Ints[i].Name << "\n";
133134 }
134135 OS << "#endif\n\n";
135136 }