aboutsummaryrefslogtreecommitdiffstats
path: root/test/TableGen
diff options
context:
space:
mode:
authorDavid Greene <greened@obbligato.org>2009-04-22 16:42:54 +0000
committerDavid Greene <greened@obbligato.org>2009-04-22 16:42:54 +0000
commitde444af6bb9a8a7bb95e2a274d8fa8697e8f4e3f (patch)
tree77c944279ee1bc9f17ad62b8ad34cc567084ecfa /test/TableGen
parent20900cae35c0d18eed449a985d452a74c98ecdb2 (diff)
downloadexternal_llvm-de444af6bb9a8a7bb95e2a274d8fa8697e8f4e3f.zip
external_llvm-de444af6bb9a8a7bb95e2a274d8fa8697e8f4e3f.tar.gz
external_llvm-de444af6bb9a8a7bb95e2a274d8fa8697e8f4e3f.tar.bz2
Implement multiclass inheritance.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69810 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/TableGen')
-rw-r--r--test/TableGen/MultiClassInherit.td32
1 files changed, 32 insertions, 0 deletions
diff --git a/test/TableGen/MultiClassInherit.td b/test/TableGen/MultiClassInherit.td
new file mode 100644
index 0000000..5a1fc7e
--- /dev/null
+++ b/test/TableGen/MultiClassInherit.td
@@ -0,0 +1,32 @@
+// RUN: tblgen %s | grep {zing = 4} | count 4
+
+class C1<int A, string B> {
+ int bar = A;
+ string thestr = B;
+ int zing;
+}
+
+def T : C1<4, "blah">;
+
+multiclass t<int a> {
+ def S1 : C1<a, "foo"> {
+ int foo = 4;
+ let bar = 1;
+ }
+ def S2 : C1<a, "bar">;
+}
+
+multiclass s<int a, int b> : t<a> {
+ def S3 : C1<b, "moo"> {
+ int moo = 3;
+ let bar = 1;
+ }
+ def S4 : C1<b, "baz">;
+}
+
+defm FOO : s<42, 24>;
+
+def T4 : C1<6, "foo">;
+
+let zing = 4 in
+ defm BAZ : s<3, 4>;