TableGen: Delay instantiating inline anonymous records
Summary:
Only instantiate anonymous records once all variable references in template
arguments have been resolved. This allows patterns like the new test case,
which in practice can appear in expressions like:
class IntrinsicTypeProfile<list<LLVMType> ty, int shift> {
list<LLVMType> types =
!listconcat(ty, [llvm_any_ty, LLVMMatchType<shift>]);
}
class FooIntrinsic<IntrinsicTypeProfile P, ...>
: Intrinsic<..., P.types, ...>;
Without this change, the anonymous LLVMMatchType instantiation would
never get resolved.
Another consequence of this change is that anonymous inline
instantiations are uniqued via the folding set of the newly introduced
VarDefInit.
Change-Id: I7a7041a20e297cf98c9109b28d85e64e176c932a
Reviewers: arsenm, craig.topper, tra, MartinO
Subscribers: wdng, llvm-commits
Differential Revision: https://reviews.llvm.org/D43756
llvm-svn: 326788
2018-03-06 21:49:01 +08:00
|
|
|
// RUN: llvm-tblgen %s | FileCheck %s
|
2010-03-21 07:08:45 +08:00
|
|
|
// XFAIL: vg_leak
|
2005-09-09 02:47:43 +08:00
|
|
|
|
TableGen: Delay instantiating inline anonymous records
Summary:
Only instantiate anonymous records once all variable references in template
arguments have been resolved. This allows patterns like the new test case,
which in practice can appear in expressions like:
class IntrinsicTypeProfile<list<LLVMType> ty, int shift> {
list<LLVMType> types =
!listconcat(ty, [llvm_any_ty, LLVMMatchType<shift>]);
}
class FooIntrinsic<IntrinsicTypeProfile P, ...>
: Intrinsic<..., P.types, ...>;
Without this change, the anonymous LLVMMatchType instantiation would
never get resolved.
Another consequence of this change is that anonymous inline
instantiations are uniqued via the folding set of the newly introduced
VarDefInit.
Change-Id: I7a7041a20e297cf98c9109b28d85e64e176c932a
Reviewers: arsenm, craig.topper, tra, MartinO
Subscribers: wdng, llvm-commits
Differential Revision: https://reviews.llvm.org/D43756
llvm-svn: 326788
2018-03-06 21:49:01 +08:00
|
|
|
// CHECK: --- Defs ---
|
|
|
|
|
|
|
|
// CHECK: def X {
|
|
|
|
// CHECK: foo Y = anonymous_0;
|
|
|
|
// CHECK: }
|
|
|
|
|
|
|
|
// CHECK: def ZD {
|
|
|
|
// CHECK: foo Z = anonymous_1;
|
|
|
|
// CHECK: }
|
|
|
|
|
|
|
|
// CHECK: def anonymous_0 {
|
|
|
|
// CHECK: int THEVAL = 1;
|
|
|
|
// CHECK: }
|
|
|
|
|
|
|
|
// CHECK: def anonymous_1 {
|
|
|
|
// CHECK: int THEVAL = 42;
|
|
|
|
// CHECK: }
|
|
|
|
|
2005-09-09 02:47:43 +08:00
|
|
|
class foo<int X> { int THEVAL = X; }
|
|
|
|
def foo_imp : foo<1>;
|
|
|
|
|
|
|
|
def x {
|
|
|
|
foo Y = foo_imp; // This works.
|
|
|
|
}
|
|
|
|
|
|
|
|
def X {
|
|
|
|
foo Y = foo<1>; // This should work too, synthesizing a new foo<1>.
|
|
|
|
}
|
TableGen: Delay instantiating inline anonymous records
Summary:
Only instantiate anonymous records once all variable references in template
arguments have been resolved. This allows patterns like the new test case,
which in practice can appear in expressions like:
class IntrinsicTypeProfile<list<LLVMType> ty, int shift> {
list<LLVMType> types =
!listconcat(ty, [llvm_any_ty, LLVMMatchType<shift>]);
}
class FooIntrinsic<IntrinsicTypeProfile P, ...>
: Intrinsic<..., P.types, ...>;
Without this change, the anonymous LLVMMatchType instantiation would
never get resolved.
Another consequence of this change is that anonymous inline
instantiations are uniqued via the folding set of the newly introduced
VarDefInit.
Change-Id: I7a7041a20e297cf98c9109b28d85e64e176c932a
Reviewers: arsenm, craig.topper, tra, MartinO
Subscribers: wdng, llvm-commits
Differential Revision: https://reviews.llvm.org/D43756
llvm-svn: 326788
2018-03-06 21:49:01 +08:00
|
|
|
|
|
|
|
class Z<int X> {
|
|
|
|
foo Z = foo<X>;
|
|
|
|
}
|
|
|
|
|
|
|
|
def ZD : Z<42>;
|