-
Notifications
You must be signed in to change notification settings - Fork 10.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TableGen: Allow lists to be concatenated through '#'
Currently one can concatenate strings using hash(#), but not lists, although that would be a natural thing to do. This patch allows one to write something like: def : A<!listconcat([1,2], [3,4])>; simply as : def : A<[1,2] # [3,4]>; This was missing feature was highlighted by Nicolai at FOSDEM talk. Reviewed by: nhaehnle, hfinkel Differential Revision: https://reviews.llvm.org/D58895 llvm-svn: 355414
- Loading branch information
1 parent
05812b6
commit 34d3b80
Showing
4 changed files
with
78 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// RUN: llvm-tblgen %s | FileCheck %s | ||
|
||
// CHECK: class A<bit A:x = ?> { | ||
// CHECK: list<int> lst = !listconcat([], !if(A:x, [], [4])); | ||
// CHECK: } | ||
class A<bit x> { | ||
list<int> lst = [] # !if(x, [], [4]); | ||
} | ||
|
||
// CHECK: class A1<list<int> A1:l = ?> { | ||
// CHECK: list<int> A1List = A1:l; | ||
// CHECK: } | ||
class A1<list<int> l> { | ||
list<int> A1List = l; | ||
} | ||
|
||
// CHECK: def A0 { | ||
// CHECK: list<int> lst = [4]; | ||
// CHECK: } | ||
def A0 : A<0>; | ||
|
||
// CHECK: def A1 { | ||
// CHECK: list<int> lst = []; | ||
// CHECK: } | ||
def A1 : A<1>; | ||
|
||
// CHECK: def A1_0 { | ||
// CHECK: list<int> A1List = [1, 2, 3, 4]; | ||
// CHECK: } | ||
def A1_0 : A1<[1,2] # [3,4]>; | ||
|
||
// CHECK: def A1_1 { | ||
// CHECK: list<int> A1List = [1, 2]; | ||
// CHECK: } | ||
def A1_1 : A1<[] # [1,2]>; | ||
|
||
// CHECK: def A1_2 { // A1 | ||
// CHECK: list<int> A1List = [1, 2]; | ||
// CHECK: } | ||
def A1_2 : A1<[1,2] # []>; |