[llvm-commits] [llvm] r140884 - /llvm/trunk/test/TableGen/LoLoL.td

David Greene greened at obbligato.org
Fri Sep 30 13:59:52 PDT 2011


Author: greened
Date: Fri Sep 30 15:59:52 2011
New Revision: 140884

URL: http://llvm.org/viewvc/llvm-project?rev=140884&view=rev
Log:
Test More Complicated Lists

Test of indexing lists of lists of lists works.  This also exercises
some operators.

Added:
    llvm/trunk/test/TableGen/LoLoL.td

Added: llvm/trunk/test/TableGen/LoLoL.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/TableGen/LoLoL.td?rev=140884&view=auto
==============================================================================
--- llvm/trunk/test/TableGen/LoLoL.td (added)
+++ llvm/trunk/test/TableGen/LoLoL.td Fri Sep 30 15:59:52 2011
@@ -0,0 +1,17 @@
+// RUN: tblgen %s | FileCheck %s
+
+class Base<list<int> v> {
+  list<int> values = v;
+}
+
+class Derived<list<int> v> : Base<!if(!empty(v),[0],v)>;
+
+multiclass Multi<list<list<list<int>>> v> {
+  def ONE : Derived<!if(!empty(v),[]<int>,!if(!empty(!head(v)),[]<int>,v[0][0]))>;
+  def TWO : Derived<!if(!empty(v),[]<int>,!if(!empty(!tail(v)),!if(!empty(!head(v)),[]<int>,v[0][0]),v[1][0]))>;
+}
+
+defm Def : Multi<[[[]],[[1, 2, 3]]]>;
+
+// CHECK: values = [0]
+// CHECK: values = [1, 2, 3]





More information about the llvm-commits mailing list