aboutsummaryrefslogtreecommitdiffstats
path: root/test/TableGen
diff options
context:
space:
mode:
authorDavid Greene <greened@obbligato.org>2009-06-08 17:00:34 +0000
committerDavid Greene <greened@obbligato.org>2009-06-08 17:00:34 +0000
commit938c8ab0a0f4a52d7d6ddc975abe9de08fee06d5 (patch)
tree790c1f084b25650896b3b08b8811e9bb0d52d692 /test/TableGen
parent06bfa33eefd6c7b56fc354ab640a9175e82bf890 (diff)
downloadexternal_llvm-938c8ab0a0f4a52d7d6ddc975abe9de08fee06d5.zip
external_llvm-938c8ab0a0f4a52d7d6ddc975abe9de08fee06d5.tar.gz
external_llvm-938c8ab0a0f4a52d7d6ddc975abe9de08fee06d5.tar.bz2
Add a !regmatch operator to do pattern matching in TableGen.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73074 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/TableGen')
-rw-r--r--test/TableGen/regmatch.td11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/TableGen/regmatch.td b/test/TableGen/regmatch.td
new file mode 100644
index 0000000..3eb35df
--- /dev/null
+++ b/test/TableGen/regmatch.td
@@ -0,0 +1,11 @@
+// RUN: tblgen %s | grep {Match1 = 1} | count 1
+// RUN: tblgen %s | grep {Match2 = 1} | count 1
+
+class Foo<string v> {
+ string Value = v;
+ int Match1 = !regmatch(".*ps$", v);
+ int Match2 = !regmatch(".*pd$", v);
+}
+
+def Bar : Foo<"addps">;
+def Baz : Foo<"addpd">;