Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[TableGen] Introduce !listsplat 'binary' operator
Summary: ``` ``!listsplat(a, size)`` A list value that contains the value ``a`` ``size`` times. Example: ``!listsplat(0, 2)`` results in ``[0, 0]``. ``` I plan to use this in X86ScheduleBdVer2.td for LoadRes handling. This is a little bit controversial because unlike every other binary operator the types aren't identical. Reviewers: stoklund, javed.absar, nhaehnle, craig.topper Reviewed By: javed.absar Subscribers: llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D60367 llvm-svn: 358117
- Loading branch information
Showing
9 changed files
with
140 additions
and
5 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
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,75 @@ | ||
// RUN: llvm-tblgen %s | FileCheck %s | ||
|
||
// CHECK: ------------- Classes ----------------- | ||
// CHECK-NEXT: class X<int X:a = ?, int X:b = ?> { | ||
// CHECK-NEXT: list<int> x = !listsplat(X:a, X:b); | ||
// CHECK-NEXT: } | ||
// CHECK-NEXT: class Y<string Y:a = ?, int Y:b = ?> { | ||
// CHECK-NEXT: list<string> x = !listsplat(Y:a, Y:b); | ||
// CHECK-NEXT: } | ||
// CHECK-NEXT: ------------- Defs ----------------- | ||
// CHECK-NEXT: def DX00 { // X | ||
// CHECK-NEXT: list<int> x = []; | ||
// CHECK-NEXT: } | ||
// CHECK-NEXT: def DX01 { // X | ||
// CHECK-NEXT: list<int> x = [0]; | ||
// CHECK-NEXT: } | ||
// CHECK-NEXT: def DX02 { // X | ||
// CHECK-NEXT: list<int> x = [0, 0]; | ||
// CHECK-NEXT: } | ||
// CHECK-NEXT: def DX10 { // X | ||
// CHECK-NEXT: list<int> x = []; | ||
// CHECK-NEXT: } | ||
// CHECK-NEXT: def DX11 { // X | ||
// CHECK-NEXT: list<int> x = [1]; | ||
// CHECK-NEXT: } | ||
// CHECK-NEXT: def DX12 { // X | ||
// CHECK-NEXT: list<int> x = [1, 1]; | ||
// CHECK-NEXT: } | ||
// CHECK-NEXT: def DYa0 { // Y | ||
// CHECK-NEXT: list<string> x = []; | ||
// CHECK-NEXT: } | ||
// CHECK-NEXT: def DYa1 { // Y | ||
// CHECK-NEXT: list<string> x = ["a"]; | ||
// CHECK-NEXT: } | ||
// CHECK-NEXT: def DYa2 { // Y | ||
// CHECK-NEXT: list<string> x = ["a", "a"]; | ||
// CHECK-NEXT: } | ||
// CHECK-NEXT: def DYe0 { // Y | ||
// CHECK-NEXT: list<string> x = []; | ||
// CHECK-NEXT: } | ||
// CHECK-NEXT: def DYe1 { // Y | ||
// CHECK-NEXT: list<string> x = [""]; | ||
// CHECK-NEXT: } | ||
// CHECK-NEXT: def DYe2 { // Y | ||
// CHECK-NEXT: list<string> x = ["", ""]; | ||
// CHECK-NEXT: } | ||
// CHECK-NEXT: def DZ { // X | ||
// CHECK-NEXT: list<int> x = [42, 42, 42]; | ||
// CHECK-NEXT: } | ||
|
||
class X<int a, int b> { | ||
list<int> x = !listsplat(a, b); | ||
} | ||
|
||
class Y<string a, int b> { | ||
list<string> x = !listsplat(a, b); | ||
} | ||
|
||
def DX00 : X<0, 0>; | ||
def DX01 : X<0, 1>; | ||
def DX02 : X<0, 2>; | ||
|
||
def DX10 : X<1, 0>; | ||
def DX11 : X<1, 1>; | ||
def DX12 : X<1, 2>; | ||
|
||
def DYe0 : Y<"", 0>; | ||
def DYe1 : Y<"", 1>; | ||
def DYe2 : Y<"", 2>; | ||
|
||
def DYa0 : Y<"a", 0>; | ||
def DYa1 : Y<"a", 1>; | ||
def DYa2 : Y<"a", 2>; | ||
|
||
def DZ : X<42, !size([1, 2, 3])>; |
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