mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-24 03:33:20 +01:00
173ca6da08
This patch extends TableGen language with !cond operator. Instead of embedding !if inside !if which can get cumbersome, one can now use !cond. Below is an example to convert an integer 'x' into a string: !cond(!lt(x,0) : "Negative", !eq(x,0) : "Zero", !eq(x,1) : "One, 1 : "MoreThanOne") Reviewed By: hfinkel, simon_tatham, greened Differential Revision: https://reviews.llvm.org/D55758 llvm-svn: 352185
12 lines
328 B
TableGen
12 lines
328 B
TableGen
// Check that not specifying a valid condition results in error
|
|
|
|
// RUN: not llvm-tblgen %s 2>&1 | FileCheck %s
|
|
// XFAIL: vg_leak
|
|
|
|
class C<int x> {
|
|
string s = !cond(!lt(x,0) : "negative", !gt(x,0) : "positive");
|
|
}
|
|
|
|
def Zero : C<0>;
|
|
//CHECK: error: Zero does not have any true condition in:!cond(0: "negative", 0: "positive")
|